public class TcpRpcPacketHandler extends SocketPacketHandler implements java.lang.Runnable
Processes RPC requests received via TCP session.
Constructor and Description |
---|
TcpRpcPacketHandler(java.net.Socket socket,
int maxRpcSize)
Class constructor to create a TCP RPC handler for a client.
|
TcpRpcPacketHandler(TcpRpcSessionHandler handler,
int sessId,
RpcProcessor server,
java.net.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
|
java.lang.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, java.net.Socket socket, int maxRpcSize) throws java.io.IOException
handler
- TcpRpcSessionHandlersessId
- intserver
- RpcProcessorsocket
- SocketmaxRpcSize
- intjava.io.IOException
public TcpRpcPacketHandler(java.net.Socket socket, int maxRpcSize) throws java.io.IOException
socket
- SocketmaxRpcSize
- intjava.io.IOException
public java.lang.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()
run
in interface java.lang.Runnable
public void closePacketHandler()
closePacketHandler
in interface PacketHandlerInterface
closePacketHandler
in class SocketPacketHandler
protected final void sendRpc(RpcPacket rpc) throws java.io.IOException
rpc
- RpcPacketjava.io.IOException
protected final int receiveRpc(RpcPacket rpc) throws java.io.IOException
rpc
- RpcPacketjava.io.IOException
protected final int receiveRpc(byte[] buffer, int offset, int maxLen) throws java.io.IOException
buffer
- byte[]offset
- intmaxLen
- intjava.io.IOException
protected RpcPacket allocateRpcPacket(int maxSize)
maxSize
- intprotected void deallocateRpcPacket(RpcPacket pkt)
pkt
- RpcPacketprotected void processRpc(RpcPacket rpc) throws java.io.IOException
rpc
- RpcPacketjava.io.IOException
Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.