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(java.lang.String name,
java.lang.String protocol,
RpcProcessor rpcServer,
NetworkServer server,
java.net.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(java.net.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(java.lang.String name, java.lang.String protocol, RpcProcessor rpcServer, NetworkServer server, java.net.InetAddress addr, int port, int maxSize)
name
- Stringprotocol
- StringrpcServer
- RpcProcessorserver
- NetworkServeraddr
- InetAddressport
- intmaxSize
- intpublic void initializeSessionHandler(NetworkServer server) throws java.io.IOException
initializeSessionHandler
in interface SessionHandlerInterface
initializeSessionHandler
in class DatagramSessionHandler
server
- NetworkServerjava.io.IOException
protected boolean processDatagram(java.net.DatagramPacket pkt) throws java.io.IOException
processDatagram
in class UdpRpcDatagramHandler
pkt
- DatagramPacketjava.io.IOException
protected final void queueRpcRequest(RpcPacket rpc)
rpc
- RpcPacketprotected byte[] allocateBuffer(int bufSize)
allocateBuffer
in class DatagramSessionHandler
bufSize
- intpublic void sendRpcResponse(RpcPacket rpc) throws java.io.IOException
sendRpcResponse
in interface RpcPacketHandler
rpc
- RpcPacketjava.io.IOException
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 - 2010 Alfresco Software, Inc. All Rights Reserved.