Package com.gigaspaces.lrmi.nio
Class Pivot
java.lang.Object
com.gigaspaces.lrmi.nio.Pivot
The Pivot is the center of the NIO Protocol Adapter server-side implementation. It handles
channel (connection) management, thread allocation and request/reply transmission. The Pivot
runs several types:
- SelectorThread: 1. Which listens on a port and accepts connection requests. When a new connection is accepted, the connection is added to the table of open connections. 2. Charge of selecting connections that have pending data (available for read).
- A group of worker threads that can handle invocation requests.
- Since:
- 4.0
- Author:
- Igor Goldenberg
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcloseConnection(ChannelEntry channelEntry) Called by anyone who wants to close a connection.intcountRemoteObjectConnections(long remoteObjID) static StringextractMonitoringId(RequestPacket requestPacket) getChannelEntryFromChannel(SocketChannel channel) getChannelEntryState(SocketAddress monitoredClient) protected List<ChannelEntry>getChannels(long remoteObjID) intgetPort()getRemoteObjectConnectionsList(long remoteObjID) static StringgetServiceDetails(Remote exportedService) booleanhandleExceptionFromServer(Writer writer, Reader reader, Throwable ex) send if possible the catch server exception to the clientvoidhandleProtocolValidation(ChannelEntry channelEntry, Reader.ProtocolValidationContext context, ReadSelectorThread handler) voidhandleReadRequest(ChannelEntry channelEntry, Reader.Context ctx, ReadSelectorThread handler) Called by a Reader Selector when it detects that a channel has pending data for read.voidhandleRequest(RequestPacket requestPacket, ChannelEntry channelEntry) Handles client request and sends reply to the client.static booleanbooleannewConnection(ReadSelectorThread readHandler, SelectionKey key) Called by the ConnMgr thread when a new connection is created.voidrequestPending(ChannelEntry channel, ReplyPacket<?> respPacket, IResponseContext responseContext) voidsendResponse(ChannelEntry channelEntry, ReplyPacket replyPacket, IResponseContext respContext) voidunexport(long remoteObjID) unexport supplied remote objectID and close all channel sockets
-
Constructor Details
-
Pivot
- Throws:
IOException
-
-
Method Details
-
getPort
public int getPort() -
getHostName
-
isMonitorActivity
public static boolean isMonitorActivity() -
handleExceptionFromServer
send if possible the catch server exception to the client -
newConnection
Called by the ConnMgr thread when a new connection is created. -
closeConnection
Called by anyone who wants to close a connection. -
handleProtocolValidation
public void handleProtocolValidation(ChannelEntry channelEntry, Reader.ProtocolValidationContext context, ReadSelectorThread handler) -
handleReadRequest
public void handleReadRequest(ChannelEntry channelEntry, Reader.Context ctx, ReadSelectorThread handler) Called by a Reader Selector when it detects that a channel has pending data for read.- Parameters:
channelEntry- the channel representing the client connection.
-
requestPending
public void requestPending(ChannelEntry channel, ReplyPacket<?> respPacket, IResponseContext responseContext) -
getChannelEntryFromChannel
-
getServerBindInetSocketAddress
- Returns:
- the INetSocketAddress this Selector bind to.
-
handleRequest
Handles client request and sends reply to the client. Called in the following cases: 1. by the ChannelThread when it detects that a channel has a pending two way request. 2. by the Worker in case of a one way request processing.- Parameters:
requestPacket- the requestchannelEntry- a channel(socket) wrapper
-
extractMonitoringId
-
sendResponse
public void sendResponse(ChannelEntry channelEntry, ReplyPacket replyPacket, IResponseContext respContext) -
getChannels
- Returns:
- all channels of supplied remote objectID
-
unexport
public void unexport(long remoteObjID) unexport supplied remote objectID and close all channel sockets -
getRemoteObjectConnectionsList
- Returns:
- the Transport connection info list for the supplied remote objectID.
-
countRemoteObjectConnections
public int countRemoteObjectConnections(long remoteObjID) -
isProtocolValidationEnabled
public boolean isProtocolValidationEnabled() -
getMonitoringDetails
-
getSystemRequestHandler
-
getChannelEntryState
-
getServiceDetails
-