| Modifier and Type | Method and Description |
|---|---|
void |
addCloseListener(SessionCloseListener listener)
Add a listener which receives notification when this session is
closed.
|
void |
close()
Closes the session.
|
static Session |
create(IOExecutor executor,
ChannelBroker broker) |
static Session |
create(IOExecutor executor,
ChannelBroker broker,
long timeout,
TimeUnit unit) |
static Session |
create(IOExecutor executor,
ChannelBroker broker,
Timer timer) |
void |
flush()
|
Object |
getLocalAddress() |
Object |
getRemoteAddress() |
Object |
receive()
Receives a
Remote or Serializable object sent by the
remote session. |
Object |
receive(long timeout,
TimeUnit unit)
Receives a
Remote or Serializable object sent by the
remote session. |
void |
send(Object obj)
Sends a
Remote or Serializable object to be received by
the remote session. |
void |
send(Object obj,
long timeout,
TimeUnit unit)
Sends a
Remote or Serializable object to be received by
the remote session. |
void |
setClassLoader(ClassLoader loader)
Convenience method to use a ClassLoader for resolving classes.
|
void |
setClassResolver(ClassResolver resolver)
Can be called at most once to control how deserialized classes and
remote interfaces are resolved.
|
String |
toString() |
public static Session create(IOExecutor executor, ChannelBroker broker) throws IOException
executor - shared executor for remote methodsbroker - channel broker must always connect to same remote serverIOExceptionpublic static Session create(IOExecutor executor, ChannelBroker broker, long timeout, TimeUnit unit) throws IOException
executor - shared executor for remote methodsbroker - channel broker must always connect to same remote serverIOExceptionpublic static Session create(IOExecutor executor, ChannelBroker broker, Timer timer) throws IOException
executor - shared executor for remote methodsbroker - channel broker must always connect to same remote serverIOExceptionpublic void send(Object obj) throws RemoteException
SessionRemote or Serializable object to be received by
the remote session. Any failure during the send forces the session to be
closed.send in interface Sessionobj - remote or serializable object to send; can be nullRemoteExceptionpublic void send(Object obj, long timeout, TimeUnit unit) throws RemoteException
SessionRemote or Serializable object to be received by
the remote session. Any failure or timeout during the send forces the
session to be closed.send in interface Sessionobj - remote or serializable object to send; can be nulltimeout - how long to wait before timing out, in units of unitunit - a TimeUnit determining how to interpret the timeout parameterRemoteTimeoutException - if timeout elapsesRemoteExceptionpublic Object receive() throws RemoteException
SessionRemote or Serializable object sent by the
remote session. Any failure during the receive forces the session to be
closed.receive in interface SessionRemoteExceptionpublic Object receive(long timeout, TimeUnit unit) throws RemoteException
SessionRemote or Serializable object sent by the
remote session. Any failure or timeout during the receive forces the
session to be closed.receive in interface Sessiontimeout - how long to wait before timing out, in units of unitunit - a TimeUnit determining how to interpret the timeout parameterRemoteTimeoutException - if timeout elapsesRemoteExceptionpublic void addCloseListener(SessionCloseListener listener)
SessionaddCloseListener in interface Sessionpublic void setClassResolver(ClassResolver resolver)
SessionsetClassResolver in interface Sessionresolver - resolves deserialized classes and interfaces; pass null
to always use default resolverpublic void setClassLoader(ClassLoader loader)
SessionsetClassLoader in interface Sessionloader - resolves deserialized classes and interfaces; pass null
to always use default resolverpublic void flush()
throws IOException
Sessionbatch calls and eventual asynchronous
methods.flush in interface Flushableflush in interface SessionIOExceptionpublic void close()
throws IOException
Sessionclose in interface Closeableclose in interface AutoCloseableclose in interface SessionIOExceptionpublic Object getRemoteAddress()
getRemoteAddress in interface LinkgetRemoteAddress in interface Sessionpublic Object getLocalAddress()
getLocalAddress in interface LinkgetLocalAddress in interface SessionCopyright © 2006–2015 Cojen. All rights reserved.