public class ParallelTaskBuilder extends Object
| Modifier and Type | Field and Description |
|---|---|
TaskRunMode |
mode
The mode.
|
| Constructor and Description |
|---|
ParallelTaskBuilder()
Instantiates a new parallel task builder.
|
| Modifier and Type | Method and Description |
|---|---|
ParallelTaskBuilder |
async()
Execute the task asynchronously.
|
ParallelTask |
execute(ParallecResponseHandler handler)
key function.
|
com.ning.http.client.AsyncHttpClient |
getAsyncHttpClient()
Gets the async http client.
|
int |
getConcurrency()
Gets the concurrency.
|
ParallelTaskConfig |
getConfig()
Gets the config.
|
HttpMeta |
getHttpMeta()
Gets the HttpMeta.
|
TaskRunMode |
getMode()
Gets the mode of either sync or async.
|
Map<String,String> |
getReplacementVarMap()
Gets the replacement var map.
|
Map<String,StrStrMap> |
getReplacementVarMapNodeSpecific()
Gets the replacement var map node specific.
|
RequestProtocol |
getRequestProtocol()
Gets the request protocol.
|
RequestReplacementType |
getRequestReplacementType()
Gets the request replacement type.
|
Map<String,Object> |
getResponseContext()
Gets the response context.
|
ITargetHostsBuilder |
getTargetHostBuilder()
Gets the TargetHostsBuilder.
|
TargetHostMeta |
getTargetHostMeta()
Gets the target host meta.
|
List<String> |
getTargetHosts()
Gets the target hosts.
|
TcpMeta |
getTcpMeta()
Gets the tcp meta.
|
UdpMeta |
getUdpMeta() |
ParallelTaskBuilder |
handleInManager()
Call response handler in manager (in a sequence after aggregation) Default mode.
|
ParallelTaskBuilder |
handleInWorker()
Call response handler in operation worker (in parallel before aggregation).
|
ParallelTaskBuilder |
setAsyncHttpClient(com.ning.http.client.AsyncHttpClient asyncHttpClient)
Sets the async http client.
|
ParallelTaskBuilder |
setAutoSaveLogToLocal(boolean autoSaveLogToLocal)
Sets the auto save log to local.
|
ParallelTaskBuilder |
setConcurrency(int concurrency)
Sets the max concurrency.
|
ParallelTaskBuilder |
setConfig(ParallelTaskConfig config)
Sets the config.
|
ParallelTaskBuilder |
setEnableCapacityAwareTaskScheduler(boolean enableCapacityAwareTaskScheduler)
Sets the enable capacity aware task scheduler.
|
ParallelTaskBuilder |
setHttpEntityBody(String body)
Sets the body.
|
ParallelTaskBuilder |
setHttpHeaders(ParallecHeader pheader)
this will create the adhoc header.
|
void |
setHttpMeta(HttpMeta httpMeta)
Sets the HttpMeta.
|
ParallelTaskBuilder |
setHttpPollable(boolean isPollable)
Sets the HTTP pollable.
|
ParallelTaskBuilder |
setHttpPollerProcessor(HttpPollerProcessor httpPollerProcessor)
Sets the HTTP poller processor to handle Async API.
|
ParallelTaskBuilder |
setHttpPort(int port)
Sets the port.
|
ParallelTaskBuilder |
setHttpPortReplaceable(String portVar)
Sets the port variable name such as $PORT
|
void |
setMode(TaskRunMode mode)
Sets the mode.
|
ParallelTaskBuilder |
setPingMode(PingMode mode)
Sets the ping mode.
|
ParallelTaskBuilder |
setPingNumRetries(int numRetries)
Sets the ping num retries.
|
ParallelTaskBuilder |
setPingTimeoutMillis(int pingTimeoutMillis)
Sets the ping timeout millis.
|
ParallelTaskBuilder |
setProtocol(RequestProtocol protocol)
Sets the protocol.
|
ParallelTaskBuilder |
setReplacementVarMap(Map<String,String> replacementVarMap)
Sets the replacement var map.
|
ParallelTaskBuilder |
setReplacementVarMapNodeSpecific(Map<String,StrStrMap> replacementVarMapNodeSpecific)
Sets the replacement var map node specific.
|
ParallelTaskBuilder |
setReplaceVarMapToSingleTarget(List<StrStrMap> replacementVarMapList,
String uniformTargetHost)
Sets the replace var map to single target.
|
ParallelTaskBuilder |
setReplaceVarMapToSingleTargetFromMap(Map<String,StrStrMap> replacementVarMapNodeSpecific,
String uniformTargetHost)
Sets the replace var map to single target from map.
|
ParallelTaskBuilder |
setReplaceVarMapToSingleTargetSingleVar(String variable,
List<String> replaceList,
String uniformTargetHost)
Sets the replace var map to single target single var.
|
ParallelTaskBuilder |
setRequestReplacementType(RequestReplacementType requestReplacementType)
Sets the request replacement type.
|
ParallelTaskBuilder |
setResponseContext(Map<String,Object> responseContext)
Sets the response context.
|
ParallelTaskBuilder |
setRunAsSuperUser(Boolean runAsSuperUser)
Sets the ssh runAsSuperUser
|
ParallelTaskBuilder |
setSaveResponseToTask(boolean saveResponseToTask)
Sets the save response to task.
|
ParallelTaskBuilder |
setSshCommandLine(String commandLine)
Sets the ssh command line.
|
ParallelTaskBuilder |
setSshConnectionTimeoutMillis(int sshConnectionTimeoutMillis)
Sets the ssh connection timeout millis.
|
ParallelTaskBuilder |
setSshLoginType(SshLoginType sshLoginType)
Sets the ssh login type.
|
ParallelTaskBuilder |
setSshPassword(String password)
Sets the ssh password.
|
ParallelTaskBuilder |
setSshPort(int sshPort)
Sets the ssh port.
|
ParallelTaskBuilder |
setSshPrivKeyRelativePath(String privKeyRelativePath)
Sets the ssh priv key relative path.
|
ParallelTaskBuilder |
setSshPrivKeyRelativePathWtihPassphrase(String privKeyRelativePath,
String passphrase)
Sets the ssh priv key relative path wtih passphrase.
|
ParallelTaskBuilder |
setSshUserName(String userName)
Sets the ssh user name.
|
void |
setTargetHostBuilder(ITargetHostsBuilder thb)
Sets the TargetHostsBuilder.
|
void |
setTargetHostMeta(TargetHostMeta targetHostMeta)
Sets the target host meta.
|
ParallelTaskBuilder |
setTargetHostsFromCmsQueryUrl(String cmsQueryUrl)
Sets the target hosts from cms query url.
|
ParallelTaskBuilder |
setTargetHostsFromCmsQueryUrl(String cmsQueryUrl,
String projection)
CMS: configuration-management-service.
|
ParallelTaskBuilder |
setTargetHostsFromJsonPath(String jsonPath,
String sourcePath,
HostsSourceType sourceType)
Sets the target hosts from json path.
|
ParallelTaskBuilder |
setTargetHostsFromLineByLineText(String sourcePath,
HostsSourceType sourceType)
Sets the target hosts from line by line text.
|
ParallelTaskBuilder |
setTargetHostsFromList(List<String> targetHosts)
Sets the target hosts from list.
|
ParallelTaskBuilder |
setTargetHostsFromString(String targetHostsStr)
Sets the target hosts from string.
|
ParallelTaskBuilder |
setTcpChannelFactory(org.jboss.netty.channel.ChannelFactory channelFactory)
Sets the tcp channel factory.
|
ParallelTaskBuilder |
setTcpConnectTimeoutMillis(int tcpConnectTimeoutMillis)
Sets the tcp connect timeout millis.
|
ParallelTaskBuilder |
setTcpIdleTimeoutSec(int tcpIdleTimeoutSec)
Sets the tcp idle timeout sec.
|
void |
setTcpMeta(TcpMeta tcpMeta)
Sets the tcp meta.
|
ParallelTaskBuilder |
setTcpPort(int tcpPort)
Sets the tcp port.
|
ParallelTaskBuilder |
setUdpIdleTimeoutSec(int udpIdleTimeoutSec)
Sets the udp read(idle) timeout millis.
|
void |
setUdpMeta(UdpMeta udpMeta) |
ParallelTaskBuilder |
setUdpPort(int udpPort)
Sets the udp port.
|
ParallelTaskBuilder |
sync()
Execute the task synchronously (the default run mode).
|
String |
toString() |
boolean |
validation()
add some validation to see if this miss anything.
|
public TaskRunMode mode
public ParallelTaskBuilder()
public Map<String,Object> getResponseContext()
public ParallelTaskBuilder setResponseContext(Map<String,Object> responseContext)
responseContext - the response contextpublic ParallelTaskBuilder handleInWorker()
public ParallelTaskBuilder handleInManager()
public ParallelTaskBuilder async()
public ParallelTaskBuilder sync()
public void setMode(TaskRunMode mode)
mode - the new modepublic ParallelTask execute(ParallecResponseHandler handler)
handler - the handlerpublic boolean validation()
throws ParallelTaskInvalidException
ParallelTaskInvalidException - the parallel task invalid exceptionpublic ParallelTaskBuilder setProtocol(RequestProtocol protocol)
protocol - the protocolpublic ParallelTaskBuilder setConcurrency(int concurrency)
concurrency - the concurrencypublic ParallelTaskBuilder setHttpEntityBody(String body)
body - the bodypublic ParallelTaskBuilder setHttpHeaders(ParallecHeader pheader)
pheader - the pheaderpublic ParallelTaskBuilder setHttpPort(int port)
port - the portpublic ParallelTaskBuilder setHttpPortReplaceable(String portVar)
portVar - the portpublic ParallelTaskBuilder setAsyncHttpClient(com.ning.http.client.AsyncHttpClient asyncHttpClient)
asyncHttpClient - the async http clientpublic HttpMeta getHttpMeta()
public void setHttpMeta(HttpMeta httpMeta)
httpMeta - the new httpMetapublic com.ning.http.client.AsyncHttpClient getAsyncHttpClient()
public List<String> getTargetHosts()
public ParallelTaskBuilder setTargetHostsFromList(List<String> targetHosts)
targetHosts - the target hostspublic ParallelTaskBuilder setTargetHostsFromString(String targetHostsStr)
targetHostsStr - the target hosts strpublic ParallelTaskBuilder setTargetHostsFromJsonPath(String jsonPath, String sourcePath, HostsSourceType sourceType) throws TargetHostsLoadException
jsonPath - the json pathsourcePath - the source pathsourceType - the source typeTargetHostsLoadException - the target hosts load exceptionpublic ParallelTaskBuilder setTargetHostsFromLineByLineText(String sourcePath, HostsSourceType sourceType) throws TargetHostsLoadException
sourcePath - the source pathsourceType - the source typeTargetHostsLoadException - the target hosts load exceptionpublic ParallelTaskBuilder setTargetHostsFromCmsQueryUrl(String cmsQueryUrl) throws TargetHostsLoadException
cmsQueryUrl - the cms query urlTargetHostsLoadException - the target hosts load exceptionpublic ParallelTaskBuilder setTargetHostsFromCmsQueryUrl(String cmsQueryUrl, String projection) throws TargetHostsLoadException
cmsQueryUrl - the cms query urlprojection - the projectionTargetHostsLoadException - the target hosts load exceptionpublic ITargetHostsBuilder getTargetHostBuilder()
public void setTargetHostBuilder(ITargetHostsBuilder thb)
thb - the new thbpublic TaskRunMode getMode()
public TargetHostMeta getTargetHostMeta()
public void setTargetHostMeta(TargetHostMeta targetHostMeta)
targetHostMeta - the new target host metapublic Map<String,StrStrMap> getReplacementVarMapNodeSpecific()
public ParallelTaskBuilder setReplacementVarMapNodeSpecific(Map<String,StrStrMap> replacementVarMapNodeSpecific)
replacementVarMapNodeSpecific - the replacement var map node specificpublic ParallelTaskBuilder setReplaceVarMapToSingleTargetFromMap(Map<String,StrStrMap> replacementVarMapNodeSpecific, String uniformTargetHost)
replacementVarMapNodeSpecific - the replacement var map node specificuniformTargetHost - the uniform target hostpublic ParallelTaskBuilder setReplaceVarMapToSingleTargetSingleVar(String variable, List<String> replaceList, String uniformTargetHost)
variable - the variablereplaceList - : the list of strings that will replace the variableuniformTargetHost - the uniform target hostpublic ParallelTaskBuilder setReplaceVarMapToSingleTarget(List<StrStrMap> replacementVarMapList, String uniformTargetHost)
replacementVarMapList - the replacement var map listuniformTargetHost - the uniform target hostpublic Map<String,String> getReplacementVarMap()
public ParallelTaskBuilder setReplacementVarMap(Map<String,String> replacementVarMap)
replacementVarMap - the replacement var mappublic RequestReplacementType getRequestReplacementType()
public ParallelTaskBuilder setRequestReplacementType(RequestReplacementType requestReplacementType)
requestReplacementType - the new request replacement typepublic ParallelTaskBuilder setHttpPollable(boolean isPollable)
isPollable - the is pollablepublic ParallelTaskBuilder setHttpPollerProcessor(HttpPollerProcessor httpPollerProcessor)
httpPollerProcessor - the http poller processorpublic ParallelTaskBuilder setSshCommandLine(String commandLine)
commandLine - the command linepublic ParallelTaskBuilder setRunAsSuperUser(Boolean runAsSuperUser)
runAsSuperUser - the runAsSuperUserpublic ParallelTaskBuilder setSshPort(int sshPort)
sshPort - the ssh portpublic ParallelTaskBuilder setSshUserName(String userName)
userName - the user namepublic ParallelTaskBuilder setSshPassword(String password)
password - the passwordpublic ParallelTaskBuilder setSshLoginType(SshLoginType sshLoginType)
sshLoginType - the ssh login typepublic ParallelTaskBuilder setSshPrivKeyRelativePath(String privKeyRelativePath)
privKeyRelativePath - the priv key relative pathpublic ParallelTaskBuilder setSshPrivKeyRelativePathWtihPassphrase(String privKeyRelativePath, String passphrase)
privKeyRelativePath - the priv key relative pathpassphrase - the passphrasepublic ParallelTaskBuilder setSshConnectionTimeoutMillis(int sshConnectionTimeoutMillis)
sshConnectionTimeoutMillis - the ssh connection timeout millispublic ParallelTaskBuilder setTcpPort(int tcpPort)
tcpPort - the tcp portpublic ParallelTaskBuilder setTcpConnectTimeoutMillis(int tcpConnectTimeoutMillis)
tcpConnectTimeoutMillis - the tcp connect timeout millispublic ParallelTaskBuilder setTcpIdleTimeoutSec(int tcpIdleTimeoutSec)
tcpIdleTimeoutSec - the tcp idle timeout secpublic ParallelTaskBuilder setTcpChannelFactory(org.jboss.netty.channel.ChannelFactory channelFactory)
channelFactory - the channel factorypublic ParallelTaskBuilder setUdpPort(int udpPort)
udpPort - the udp portpublic ParallelTaskBuilder setUdpIdleTimeoutSec(int udpIdleTimeoutSec)
udpIdleTimeoutSec - the udp read timeout millispublic ParallelTaskBuilder setConfig(ParallelTaskConfig config)
config - the configpublic ParallelTaskConfig getConfig()
public ParallelTaskBuilder setSaveResponseToTask(boolean saveResponseToTask)
saveResponseToTask - the save response to taskpublic ParallelTaskBuilder setEnableCapacityAwareTaskScheduler(boolean enableCapacityAwareTaskScheduler)
enableCapacityAwareTaskScheduler - the enable capacity aware task schedulerpublic ParallelTaskBuilder setAutoSaveLogToLocal(boolean autoSaveLogToLocal)
autoSaveLogToLocal - the auto save log to localpublic TcpMeta getTcpMeta()
public void setTcpMeta(TcpMeta tcpMeta)
tcpMeta - the new tcp metapublic RequestProtocol getRequestProtocol()
public int getConcurrency()
public ParallelTaskBuilder setPingMode(PingMode mode)
mode - the modepublic ParallelTaskBuilder setPingTimeoutMillis(int pingTimeoutMillis)
pingTimeoutMillis - the ping timeout millispublic ParallelTaskBuilder setPingNumRetries(int numRetries)
numRetries - the num retriespublic UdpMeta getUdpMeta()
public void setUdpMeta(UdpMeta udpMeta)
Copyright © 2015–2016 eBay. All rights reserved.