public class UdpWorker
extends akka.actor.UntypedActor
Modifier and Type | Class and Description |
---|---|
static class |
UdpWorker.MyIdleHandler
how to pass the idle event back to the worker.
|
static class |
UdpWorker.UdpChannelHandler
The Netty response/channel handler.
|
static class |
UdpWorker.UdpPipelineFactory
define the list of handlers for this channel.
|
Modifier and Type | Field and Description |
---|---|
private int |
actorMaxOperationTimeoutSec
The actor max operation timeout sec.
|
private java.lang.Throwable |
cause
The cause.
|
private org.jboss.netty.channel.Channel |
channel
The channel.
|
private static org.slf4j.Logger |
logger
The logger.
|
private java.lang.StringBuilder |
responseSb
The response sb.
|
private akka.actor.ActorRef |
sender
The sender.
|
private boolean |
sentReply
The sent reply.
|
private java.lang.String |
targetHost
The target host.
|
private scala.concurrent.duration.FiniteDuration |
timeoutDuration
The timeout duration.
|
private akka.actor.Cancellable |
timeoutMessageCancellable
The timeout message cancellable.
|
private int |
tryCount
The try count.
|
private UdpMeta |
udpMeta
The udp meta.
|
Constructor and Description |
---|
UdpWorker(int actorMaxOperationTimeoutSec,
UdpMeta udpMeta,
java.lang.String targetHost)
Instantiates a new udp worker.
|
Modifier and Type | Method and Description |
---|---|
org.jboss.netty.bootstrap.ConnectionlessBootstrap |
bootStrapUdpClient()
Creates the udpClient with proper handler.
|
void |
cancelCancellable()
Cancel cancellable.
|
static org.slf4j.Logger |
getLogger()
Gets the logger.
|
void |
onComplete(java.lang.String response,
boolean error,
java.lang.String errorMessage,
java.lang.String stackTrace,
java.lang.String statusCode,
int statusCodeInt)
On complete.
|
void |
onReceive(java.lang.Object message) |
private void |
reply(java.lang.String response,
boolean error,
java.lang.String errorMessage,
java.lang.String stackTrace,
java.lang.String statusCode,
int statusCodeInt)
First close the connection.
|
static void |
setLogger(org.slf4j.Logger logger)
Sets the logger.
|
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 int actorMaxOperationTimeoutSec
private final UdpMeta udpMeta
private java.lang.String targetHost
private static org.slf4j.Logger logger
private akka.actor.ActorRef sender
private java.lang.Throwable cause
private int tryCount
private akka.actor.Cancellable timeoutMessageCancellable
private scala.concurrent.duration.FiniteDuration timeoutDuration
private boolean sentReply
private org.jboss.netty.channel.Channel channel
private java.lang.StringBuilder responseSb
public UdpWorker(int actorMaxOperationTimeoutSec, UdpMeta udpMeta, java.lang.String targetHost)
actorMaxOperationTimeoutSec
- the actor max operation timeout secudpMeta
- the udp metatargetHost
- the target hostpublic org.jboss.netty.bootstrap.ConnectionlessBootstrap bootStrapUdpClient() throws HttpRequestCreateException
HttpRequestCreateException
- the http request create exceptionpublic void onReceive(java.lang.Object message) throws java.lang.Exception
onReceive
in class akka.actor.UntypedActor
java.lang.Exception
public void cancelCancellable()
private void reply(java.lang.String response, boolean error, java.lang.String errorMessage, java.lang.String stackTrace, java.lang.String statusCode, int statusCodeInt)
response
- the responseerror
- the errorerrorMessage
- the error messagestackTrace
- the stack tracestatusCode
- the status codestatusCodeInt
- the status code intpublic void onComplete(java.lang.String response, boolean error, java.lang.String errorMessage, java.lang.String stackTrace, java.lang.String statusCode, int statusCodeInt)
response
- the responseerror
- the errorerrorMessage
- the error messagestackTrace
- the stack tracestatusCode
- the status codestatusCodeInt
- the status code intpublic static org.slf4j.Logger getLogger()
public static void setLogger(org.slf4j.Logger logger)
logger
- the new logger