Package com.gigaspaces.lrmi
Interface ClientPeer
- All Superinterfaces:
Peer
- All Known Implementing Classes:
BaseClientPeer,ConnectionResource,CPeer
ClientPeer extends Peer with client-specific operations. A client peer is maintaining a
logical connection with a remote object with a unique id. The client peer usually connects to the
server peer, invokes operations on the remote object using the server peer, and disconnects.
A pair of getter/setter methods control connection retries. The connection itself is URL
based. The connection URL is protocol adapter specific, but it usually has the following format:
://:/<remote-object-id-string> A client can obtain the
connection URL from a directory service, via e-mail or in some other way. The client can save the
connection URL and connect to the same logical remote object at a later time.
- Since:
- 4.0
- Author:
- Igor Goldenberg
-
Method Summary
Modifier and TypeMethodDescriptionvoidconnect(String connectionURL, LRMIMethod lrmiMethod) Connects to the remote server peer.Returns the connection URL associated with this peer.intReturns the number of connection retries associated with this peer.longvoidinit(ITransportConfig config) invoke(Object proxy, LRMIMethod lrmiMethod, Object[] args, ConnectionPool connPool) Invokes a method on the remote object this peer is connected to.booleanSend keep alive request to servervoidsetConnectRetries(int connectRetries) Sets the number of connection retries associated with this peer.voidsetObjectId(long objectId) Methods inherited from interface com.gigaspaces.lrmi.Peer
disconnect, getProtocolAdapter, isConnected
-
Method Details
-
init
-
connect
void connect(String connectionURL, LRMIMethod lrmiMethod) throws MalformedURLException, RemoteException Connects 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
-
getConnectionURL
String getConnectionURL()Returns the connection URL associated with this peer.- Returns:
- the connection URL associated with this peer.
-
getConnectRetries
int getConnectRetries()Returns the number of connection retries associated with this peer.- Returns:
- the number of connection retries associated with this peer.
-
setConnectRetries
void setConnectRetries(int connectRetries) Sets the number of connection retries associated with this peer. -
invoke
Object invoke(Object proxy, LRMIMethod lrmiMethod, Object[] args, ConnectionPool connPool) throws ApplicationException, ProtocolException, RemoteException, InterruptedException Invokes 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.- Parameters:
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
-
getObjectId
long getObjectId() -
setObjectId
void setObjectId(long objectId) -
sendKeepAlive
boolean sendKeepAlive()Send keep alive request to server- Returns:
- true if keep alive was sent successfully
-