public class MultiThreadedUdpRpcDatagramHandler extends UdpRpcDatagramHandler implements RpcPacketHandler
Extend the basic UDP RPC handler class to process RPC requests using a thread pool.
Modifier and Type | Class and Description |
---|---|
protected class |
MultiThreadedUdpRpcDatagramHandler.DatagramSender
Datagram Sender Thread Inner Class
|
Modifier and Type | Field and Description |
---|---|
static int |
DefaultPacketPoolSize |
static int |
DefaultSmallPacketSize |
Constructor and Description |
---|
MultiThreadedUdpRpcDatagramHandler(String name,
String protocol,
RpcProcessor rpcServer,
NetworkServer server,
InetAddress addr,
int port,
int maxSize)
Class constructor
|
Modifier and Type | Method and Description |
---|---|
protected byte[] |
allocateBuffer(int bufSize)
Allocate a buffer for the next datagram
|
void |
closeSessionHandler(NetworkServer server)
Close the session handler
|
void |
initializeSessionHandler(NetworkServer server)
Initialize the session handler
|
protected boolean |
processDatagram(DatagramPacket pkt)
Process the RPC request
|
protected void |
queueRpcRequest(RpcPacket rpc)
Queue an RPC request to the thread pool for processing
|
void |
sendRpcResponse(RpcPacket rpc)
Send an RPC response using the datagram socket
|
void |
setPacketPool(int poolSize)
Set the packet pool size
|
void |
setPacketPool(int smallSize,
int smallPool,
int largeSize,
int largePool)
Set the packet pool size
|
void |
setPacketPool(RpcPacketPool pktPool)
Set the packet pool
|
void |
setThreadPool(int numThreads)
Set the thread pool size
|
void |
setThreadPool(RpcRequestThreadPool threadPool)
Set the thread pool
|
getRpcProcessor
clearShutdown, getBindAddres, getDatagramSocket, getHandlerName, getMaximumDatagramSize, getNextSessionId, getPort, getProtocolName, hasBindAddress, hasDebug, hasShutdown, run, sendDatagram, setDebug, setMaximumDatagramSize, setPort
public static final int DefaultPacketPoolSize
public static final int DefaultSmallPacketSize
public MultiThreadedUdpRpcDatagramHandler(String name, String protocol, RpcProcessor rpcServer, NetworkServer server, InetAddress addr, int port, int maxSize)
name
- Stringprotocol
- StringrpcServer
- RpcProcessorserver
- NetworkServeraddr
- InetAddressport
- intmaxSize
- intpublic void initializeSessionHandler(NetworkServer server) throws IOException
initializeSessionHandler
in interface SessionHandlerInterface
initializeSessionHandler
in class DatagramSessionHandler
server
- NetworkServerIOException
protected boolean processDatagram(DatagramPacket pkt) throws IOException
processDatagram
in class UdpRpcDatagramHandler
pkt
- DatagramPacketIOException
protected final void queueRpcRequest(RpcPacket rpc)
rpc
- RpcPacketprotected byte[] allocateBuffer(int bufSize)
allocateBuffer
in class DatagramSessionHandler
bufSize
- intpublic void sendRpcResponse(RpcPacket rpc) throws IOException
sendRpcResponse
in interface RpcPacketHandler
rpc
- RpcPacketIOException
public final void setPacketPool(int smallSize, int smallPool, int largeSize, int largePool)
smallSize
- intsmallPool
- intlargeSize
- intlargePool
- intpublic final void setPacketPool(int poolSize)
poolSize
- intpublic final void setPacketPool(RpcPacketPool pktPool)
pktPool
- RpcPacketPoolpublic final void setThreadPool(int numThreads)
numThreads
- intpublic final void setThreadPool(RpcRequestThreadPool threadPool)
threadPool
- RpcRequestThreadPoolpublic void closeSessionHandler(NetworkServer server)
closeSessionHandler
in interface SessionHandlerInterface
closeSessionHandler
in class DatagramSessionHandler
server
- NetworkServerCopyright © 2005–2018 Alfresco Software. All rights reserved.