/ARMI

asynchronous RMI for Java

Primary LanguageJava

ARMI - Asynchronous RMI for Java

So far this project is mostly a learning experience. It lacks error handling and full connection life cycle handling.

##Intro##

The great thing about ARMI is that the interface is dead simple.

Client Side

    client = ARMIClient.create(ServerInterface.class);
    client.connect(host, port, new CompletionCallback<Void>() {
			@Override
			public void operationCompleted(Void retVal) {
			    ServerInterface remoteServ = client.getServerMethods();
			    remoteServ.doSomething(param1, param2, ...);
			    remoteServ.doSomethingElse();
			}
	});

Server Side

    server = ARMIServer.create(ServerImpl, ClientInterface.class);
    server.listen(host, port);

Servers can call their clients:

    server.getClientMethods().someClientMethod(params...);

Clients can be called back when server methods return by providing a callback as the last parameter:

    ServerInterface serverMethods = client.getServerMethods();
    serverMethods.someMethod(params..., new CompletionCallback<Type>() {
        @Override
        public void operationCompleted(Type retVal) {
            ...
        }
    });

Clients can register themselves or callbacks with a server to be called:

    client = ARMIClient.create(ServerInterface.class, CallbackInterface.class);
    client.registerClient(new ClientInterfaceImpl());
    client.registerClient(new ClientInterfaceImpl());
    ...

A crappy console chat is provided in the examples directory as well as a client/server loop that times how long it takes to fire a 20K requests and get 20K callbacks. Currently getting 20K per second on a core-i5.