public class OperationWorker
extends akka.actor.UntypedActor
Modifier and Type | Field and Description |
---|---|
private int |
actorMaxOperationTimeoutSec
The actor max operation timeout sec.
|
private akka.actor.ActorRef |
asyncWorker
The async worker.
|
private com.ning.http.client.AsyncHttpClient |
client
The client.
|
private HttpPollerProcessor |
httpPollerProcessor
The http poller processor.
|
private static org.slf4j.Logger |
logger
The logger.
|
private PollerData |
pollerData
Http Poller.
|
private int |
pollingErrorCount
The polling error count.
|
private akka.actor.Cancellable |
pollMessageCancellable
The poll message cancellable.
|
private TaskRequest |
request
The request.
|
private ResponseOnSingleTask |
response
The response.
|
private akka.actor.ActorRef |
sender
The sender.
|
private boolean |
sentReply
The sent reply.
|
private long |
startTimeMillis
The start time millis.
|
private scala.concurrent.duration.FiniteDuration |
timeoutDuration
The timeout duration.
|
private akka.actor.Cancellable |
timeoutMessageCancellable
The timeout message cancellable.
|
private java.lang.String |
trueTargetNode
The true target node.
|
Constructor and Description |
---|
OperationWorker(TaskRequest request,
com.ning.http.client.AsyncHttpClient client,
HttpPollerProcessor httpPollerProcessor)
Instantiates a new operation worker.
|
Modifier and Type | Method and Description |
---|---|
private void |
cancel()
Cancel.
|
private void |
cancelCancellable()
Cancel cancellable.
|
private void |
cancelExistingIfAnyAndScheduleTimeoutCall()
201412: now consider the poller.
|
private void |
handleHttpWorkerResponse(ResponseOnSingeRequest respOnSingleReq)
Handle http worker response.
|
void |
onReceive(java.lang.Object message) |
private void |
operationTimeout()
will trigger workers to cancel then wait for it to report back.
|
private void |
pollProgress()
Poller.
|
private void |
processMainRequest()
the 1st request from the manager.
|
private void |
reply(boolean error,
java.lang.String errorMessage,
java.lang.String stackTrace,
java.lang.String statusCode,
int statusCodeInt,
java.lang.String receiveTime,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> responseHeaders)
Reply.
|
private void |
replyErrors(java.lang.String errorMessage,
java.lang.String stackTrace,
java.lang.String statusCode,
int statusCodeInt)
Reply used in error cases.
|
akka$actor$Actor$_setter_$context_$eq, akka$actor$Actor$_setter_$self_$eq, aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, context, getContext, getSelf, getSender, postRestart, postStop, preRestart, preStart, receive, self, sender, supervisorStrategy, unhandled
private final com.ning.http.client.AsyncHttpClient client
private static org.slf4j.Logger logger
private int pollingErrorCount
private final TaskRequest request
private ResponseOnSingleTask response
private akka.actor.ActorRef asyncWorker
private akka.actor.ActorRef sender
private akka.actor.Cancellable timeoutMessageCancellable
private akka.actor.Cancellable pollMessageCancellable
private scala.concurrent.duration.FiniteDuration timeoutDuration
private int actorMaxOperationTimeoutSec
private long startTimeMillis
private boolean sentReply
private java.lang.String trueTargetNode
private PollerData pollerData
private HttpPollerProcessor httpPollerProcessor
public OperationWorker(TaskRequest request, com.ning.http.client.AsyncHttpClient client, HttpPollerProcessor httpPollerProcessor)
request
- the requestclient
- the clienthttpPollerProcessor
- the http poller processorpublic void onReceive(java.lang.Object message) throws java.lang.Exception
onReceive
in class akka.actor.UntypedActor
java.lang.Exception
private final void pollProgress()
private final void handleHttpWorkerResponse(ResponseOnSingeRequest respOnSingleReq) throws java.lang.Exception
respOnSingleReq
- the my responsejava.lang.Exception
- the exceptionprivate final void processMainRequest()
private void cancelExistingIfAnyAndScheduleTimeoutCall()
private final void operationTimeout()
private final void cancel()
private final void cancelCancellable()
private final void replyErrors(java.lang.String errorMessage, java.lang.String stackTrace, java.lang.String statusCode, int statusCodeInt)
errorMessage
- the error messagestackTrace
- the stack tracestatusCode
- the status codestatusCodeInt
- the status code intprivate final void reply(boolean error, java.lang.String errorMessage, java.lang.String stackTrace, java.lang.String statusCode, int statusCodeInt, java.lang.String receiveTime, java.util.Map<java.lang.String,java.util.List<java.lang.String>> responseHeaders)
error
- the errorerrorMessage
- the error messagestackTrace
- the stack tracestatusCode
- the status codestatusCodeInt
- the status code intreceiveTime
- the receive timeresponseHeaders
- the response headers