| Interface | Description |
|---|---|
| ClassResolver |
Defines a custom class loading scheme for a
Session. |
| Completion<V> |
A
Completion is a Future which also allows registration into
a completion queue. |
| Link |
Represents an established connection between two endpoints.
|
| Pipe |
A pipe is a bidirectional stream which can be established via an
asynchronous remote method. |
| Session |
Remote method invocation session.
|
| SessionAcceptor |
Accepts sessions from remote endpoints.
|
| SessionAware |
Remote objects implementing this interface can access the current session
link which is making a remote method invocation. |
| SessionCloseListener |
Receives notification when a
Session is closed. |
| SessionConnector |
Connects to remote endpoints and establishes sessions.
|
| SessionListener |
Listener is called asynchronously as sessions are established.
|
| Unreferenced |
By implementing this interface (or the superinterface), a remote object
implementation receives notification when a
Session no longer
references it. |
| Class | Description |
|---|---|
| Environment |
Sharable environment for connecting and accepting remote sessions.
|
| Response | |
| SessionAccess |
Provides session link access for client-side and server-side remote objects.
|
| Enum | Description |
|---|---|
| CallMode |
Various
Asynchronous and Batched calling modes. |
| SessionCloseListener.Cause |
| Exception | Description |
|---|---|
| ClosedException |
Generic exception indicating that an I/O channel is closed.
|
| ConnectException |
Thrown if a connection is refused to the remote host for a remote method call.
|
| MalformedRemoteObjectException |
Thrown when a remote object cannot be transferred because it has a malformed
specification.
|
| NoSuchClassException |
Thrown when a client is requesting information about a class that is unknown
to the server.
|
| NoSuchObjectException |
Thrown if an attempt is made to invoke a method on an object that no longer
exists in the remote virtual machine.
|
| ReconstructedException |
Thrown by a remote method or
Pipe.readThrowable() if the Throwable was
not serializable or depends on classes that are not found. |
| RejectedException |
Exception indicating that an I/O operation failed because no threads are
available.
|
| RemoteTimeoutException |
Thrown when a remote method has not responded in time.
|
| UnimplementedMethodException |
Thrown when a remote method has not been implemented by the remote
server.
|
| UnknownHostException |
Thrown if an
UnknownHostException occurs while creating a
connection to the remote host for a remote method call. |
| Annotation Type | Description |
|---|---|
| Asynchronous |
Identify a method as being asynchronous, which does not imply
non-blocking.
|
| Batched |
Identify a method as being batched and asynchronous, which does not imply
non-blocking.
|
| Disposer |
Identify a method as being a disposer of the enclosing remote object.
|
| Ordered |
Ensure that invocation of method is ordered with respect to other remote
methods in the same object.
|
| RemoteFailure |
Annotate a remote method or interface to specify what exception is to be
used to indicate a remote call failure.
|
| Timeout |
Remote method timeout policy annotation, which can target a remote interface
or method.
|
| TimeoutParam |
Used in conjunction with the
Timeout annotation to define a remote
method timeout policy. |
| TimeoutUnit |
Used in conjunction with the
Timeout annotation to define a remote
method timeout policy. |
| Trace |
Method annotation which indicates that it can be traced.
|
| Unbatched |
Identify a method which should never be included in a
batched request. |
Environment, and then create a SessionAcceptor or SessionConnector. Here is a very simple example, starting
with the remote interface:
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface HelloDirmi extends Remote {
void greetings(String name) throws RemoteException;
}
The server-side implementation looks like:
import org.cojen.dirmi.Environment;
public class HelloDirmiServer implements HelloDirmi {
public static void main(String[] args) throws Exception {
Environment env = new Environment();
HelloDirmi server = new HelloDirmiServer();
int port = 1234;
env.newSessionAcceptor(port).acceptAll(server);
}
public void greetings(String name) {
System.out.println("Hello " + name);
}
}
The client is:
import org.cojen.dirmi.Environment;
import org.cojen.dirmi.Session;
public class HelloDirmiClient {
public static void main(String[] args) throws Exception {
Environment env = new Environment();
String host = args[0];
int port = 1234;
Session session = env.newSessionConnector(host, 1234).connect();
HelloDirmi client = (HelloDirmi) session.receive();
client.greetings("Dirmi");
env.close();
}
}
Copyright © 2006–2015 Cojen. All rights reserved.