public class TcpRpcPacketHandler extends SocketPacketHandler implements Runnable
Processes RPC requests received via TCP session.
Constructor and Description |
---|
TcpRpcPacketHandler(Socket socket,
int maxRpcSize)
Class constructor to create a TCP RPC handler for a client.
|
TcpRpcPacketHandler(TcpRpcSessionHandler handler,
int sessId,
RpcProcessor server,
Socket socket,
int maxRpcSize)
Class constructor to create a TCP RPC handler for a server.
|
Modifier and Type | Method and Description |
---|---|
protected RpcPacket |
allocateRpcPacket(int maxSize)
Allocate an RPC packet for receiving an incoming request.
|
void |
closePacketHandler()
Close the session
|
protected void |
deallocateRpcPacket(RpcPacket pkt)
Deallocate an RPC packet, default method does nothing but a pooled implementation may
return the packet to the pool.
|
protected TcpRpcSessionHandler |
getHandler()
Return the associated session handler
|
int |
getMaximumRpcSize()
Return the maximum RPC size accepted
|
String |
getProtocolName()
Return the protocol name
|
int |
getSessionId()
Return the session id
|
protected void |
processRpc(RpcPacket rpc)
Process an RPC request.
|
protected int |
receiveRpc(byte[] buffer,
int offset,
int maxLen)
Read an RPC request/response
|
protected int |
receiveRpc(RpcPacket rpc)
Read an RPC request/response
|
void |
run()
Thread to read and process the RPC requests for this session
|
protected void |
sendRpc(RpcPacket rpc)
Send an RPC request/response packet
|
availableBytes, getSocket, readPacket, writePacket
public TcpRpcPacketHandler(TcpRpcSessionHandler handler, int sessId, RpcProcessor server, Socket socket, int maxRpcSize) throws IOException
handler
- TcpRpcSessionHandlersessId
- intserver
- RpcProcessorsocket
- SocketmaxRpcSize
- intIOException
public TcpRpcPacketHandler(Socket socket, int maxRpcSize) throws IOException
socket
- SocketmaxRpcSize
- intIOException
public String getProtocolName()
getProtocolName
in interface PacketHandlerInterface
getProtocolName
in class SocketPacketHandler
public final int getSessionId()
public final int getMaximumRpcSize()
protected final TcpRpcSessionHandler getHandler()
public void run()
public void closePacketHandler()
closePacketHandler
in interface PacketHandlerInterface
closePacketHandler
in class SocketPacketHandler
protected final void sendRpc(RpcPacket rpc) throws IOException
rpc
- RpcPacketIOException
protected final int receiveRpc(RpcPacket rpc) throws IOException
rpc
- RpcPacketIOException
protected final int receiveRpc(byte[] buffer, int offset, int maxLen) throws IOException
buffer
- byte[]offset
- intmaxLen
- intIOException
protected RpcPacket allocateRpcPacket(int maxSize)
maxSize
- intprotected void deallocateRpcPacket(RpcPacket pkt)
pkt
- RpcPacketprotected void processRpc(RpcPacket rpc) throws IOException
rpc
- RpcPacketIOException
Copyright © 2005–2017 Alfresco Software. All rights reserved.