Package com.gigaspaces.lrmi.nio
Class CPeer
java.lang.Object
com.j_spaces.kernel.pool.Resource
com.gigaspaces.lrmi.ConnectionResource
com.gigaspaces.lrmi.BaseClientPeer
com.gigaspaces.lrmi.nio.CPeer
- All Implemented Interfaces:
ClientPeer,Peer,IResource
CPeer is the LRMI over NIO Client Peer.
- Since:
- 4.0
- Author:
- Igor Goldenberg
-
Constructor Summary
ConstructorsConstructorDescriptionCPeer(PAdapter pAdapter, ClientHandler handler, ClientConversationRunner clientConversationRunner, PlatformLogicalVersion serviceVersion) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidclose()voidconnect(String connectionURL, LRMIMethod lrmiMethod) Connects to the remote server peer.voidconnectAsync(String connectionURL, LRMIMethod lrmiMethod) voidconnectSync(String connectionURL, LRMIMethod lrmiMethod) voiddisable()voidDisconnects, effectively closes the connection.booleanstatic LongAdderlonglonginthashCode()voidinit(ITransportConfig config) invoke(Object proxy, LRMIMethod lrmiMethod, Object[] args, ConnectionPool connPool) Invokes a method on the remote object this peer is connected to.protected booleanisClosed()booleanSends a dummy one way request to the server - to check if it's alivetoString()Methods inherited from class com.gigaspaces.lrmi.BaseClientPeer
finalize, getConnectionURL, getConnectRetries, getObjectId, getProtocolAdapter, isConnected, setConnected, setConnectionURL, setConnectRetries, setObjectIdMethods inherited from class com.gigaspaces.lrmi.ConnectionResource
clearMethods inherited from class com.j_spaces.kernel.pool.Resource
acquire, isAcquired, isFromPool, release, setAcquired, setFromPool
-
Constructor Details
-
CPeer
public CPeer(PAdapter pAdapter, ClientHandler handler, ClientConversationRunner clientConversationRunner, PlatformLogicalVersion serviceVersion)
-
-
Method Details
-
getConnectionsCounter
-
init
-
getMonitoringModule
- Specified by:
getMonitoringModulein classConnectionResource
-
connect
public void connect(String connectionURL, LRMIMethod lrmiMethod) throws MalformedURLException, RemoteException Description copied from interface:ClientPeerConnects to the remote server peer.- Parameters:
connectionURL- usually of the form:// : /<remote-object-id-string> - Throws:
MalformedURLException- if the URL is not understood by the implementationRemoteException
-
connectAsync
public void connectAsync(String connectionURL, LRMIMethod lrmiMethod) throws MalformedURLException, RemoteException - Throws:
MalformedURLExceptionRemoteException
-
connectSync
public void connectSync(String connectionURL, LRMIMethod lrmiMethod) throws MalformedURLException, RemoteException - Throws:
MalformedURLExceptionRemoteException
-
close
public void close()- Specified by:
closein classConnectionResource
-
isClosed
protected boolean isClosed()- Specified by:
isClosedin classConnectionResource
-
disconnect
public void disconnect()Description copied from interface:PeerDisconnects, effectively closes the connection. -
getReader
-
getChannel
-
getWriter
-
afterInvoke
public void afterInvoke() -
getClassProvider
-
invoke
public Object invoke(Object proxy, LRMIMethod lrmiMethod, Object[] args, ConnectionPool connPool) throws ApplicationException, ProtocolException, RemoteException, InterruptedException Description copied from interface:ClientPeerInvokes a method on the remote object this peer is connected to. This method should propagate the methodName, arguments and security context associated with this peer (if exists), in a protocol specific format to the remote server peer, and return the result to the caller.lrmiMethod- contains necessary information about invocation remote callargs- arguments to the method- Throws:
ProtocolException- a result of a remote method invocation is thrown while unmarshalling the arguments or de/serialization request/reply packet.RemoteException- failed to open/close connection with remote endpoint.ApplicationExceptionInterruptedException
-
getGeneratedTraffic
public long getGeneratedTraffic()- Specified by:
getGeneratedTrafficin classConnectionResource
-
getReceivedTraffic
public long getReceivedTraffic()- Specified by:
getReceivedTrafficin classConnectionResource
-
disable
public void disable()- Specified by:
disablein classConnectionResource
-
sendKeepAlive
public boolean sendKeepAlive()Sends a dummy one way request to the server - to check if it's alive- Returns:
- true if keep alive was sent successfully
-
getServiceVersion
-
getAsyncContext
-
clearAsyncContext
public void clearAsyncContext() -
hashCode
public int hashCode() -
toString
-
equals
-