com.nhncorp.neptune.common.ipc
Class NRPC

java.lang.Object
  extended by com.nhncorp.neptune.common.ipc.NRPC

public class NRPC
extends java.lang.Object

A simple RPC mechanism. A protocol is a Java interface. All parameters and return types must be one of:

All methods in the protocol should throw only IOException. No field data of the protocol instance is transmitted.


Nested Class Summary
static class NRPC.Server
          An RPC Server.
static class NRPC.VersionMismatch
          A version mismatch for the RPC protocol.
 
Method Summary
static java.lang.Object[] call(java.lang.reflect.Method method, java.lang.Object[][] params, java.net.InetSocketAddress[] addrs, NConfiguration conf)
          Expert: Make multiple, parallel calls to a set of servers.
static java.lang.Object getOnewayProxy(java.lang.Class<?> protocol, long clientVersion, java.net.InetSocketAddress addr, NConfiguration conf)
           
static NVersionedProtocol getProxy(java.lang.Class<?> protocol, long clientVersion, java.net.InetSocketAddress addr, NConfiguration conf)
          Construct a client-side proxy object with the default SocketFactory
static NVersionedProtocol getProxy(java.lang.Class<?> protocol, long clientVersion, java.net.InetSocketAddress addr, NConfiguration conf, javax.net.SocketFactory factory)
          Construct a client-side proxy object that implements the named protocol, talking to a server at the named address.
static NVersionedProtocol getProxyWithoutVersionChecking(java.lang.Class<?> protocol, long clientVersion, java.net.InetSocketAddress addr, NConfiguration conf)
           
static NRPC.Server getServer(com.nhncorp.pleiades.client.LockService lockService, java.lang.Object instance, java.lang.String bindAddress, int port, int numHandlers, boolean verbose, NConfiguration conf)
          Construct a server for a protocol implementation instance listening on a port and address.
static NRPC.Server getServer(com.nhncorp.pleiades.client.LockService lockService, java.lang.Object instance, java.lang.String bindAddress, int port, NConfiguration conf)
          Construct a server for a protocol implementation instance listening on a port and address.
static void stopClient()
          Stop all RPC client connections
static NVersionedProtocol waitForProxy(java.lang.Class protocol, long clientVersion, java.net.InetSocketAddress addr, NConfiguration conf)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

stopClient

public static void stopClient()
Stop all RPC client connections


waitForProxy

public static NVersionedProtocol waitForProxy(java.lang.Class protocol,
                                              long clientVersion,
                                              java.net.InetSocketAddress addr,
                                              NConfiguration conf)
                                       throws java.io.IOException
Throws:
java.io.IOException

getProxy

public static NVersionedProtocol getProxy(java.lang.Class<?> protocol,
                                          long clientVersion,
                                          java.net.InetSocketAddress addr,
                                          NConfiguration conf,
                                          javax.net.SocketFactory factory)
                                   throws java.io.IOException
Construct a client-side proxy object that implements the named protocol, talking to a server at the named address.

Throws:
java.io.IOException

getProxyWithoutVersionChecking

public static NVersionedProtocol getProxyWithoutVersionChecking(java.lang.Class<?> protocol,
                                                                long clientVersion,
                                                                java.net.InetSocketAddress addr,
                                                                NConfiguration conf)
                                                         throws java.io.IOException
Throws:
java.io.IOException

getOnewayProxy

public static java.lang.Object getOnewayProxy(java.lang.Class<?> protocol,
                                              long clientVersion,
                                              java.net.InetSocketAddress addr,
                                              NConfiguration conf)
                                       throws java.io.IOException
Throws:
java.io.IOException

getProxy

public static NVersionedProtocol getProxy(java.lang.Class<?> protocol,
                                          long clientVersion,
                                          java.net.InetSocketAddress addr,
                                          NConfiguration conf)
                                   throws java.io.IOException
Construct a client-side proxy object with the default SocketFactory

Parameters:
protocol -
clientVersion -
addr -
conf -
Returns:
a proxy instance
Throws:
java.io.IOException

call

public static java.lang.Object[] call(java.lang.reflect.Method method,
                                      java.lang.Object[][] params,
                                      java.net.InetSocketAddress[] addrs,
                                      NConfiguration conf)
                               throws java.io.IOException
Expert: Make multiple, parallel calls to a set of servers.

Throws:
java.io.IOException

getServer

public static NRPC.Server getServer(com.nhncorp.pleiades.client.LockService lockService,
                                    java.lang.Object instance,
                                    java.lang.String bindAddress,
                                    int port,
                                    NConfiguration conf)
                             throws java.io.IOException
Construct a server for a protocol implementation instance listening on a port and address.

Throws:
java.io.IOException

getServer

public static NRPC.Server getServer(com.nhncorp.pleiades.client.LockService lockService,
                                    java.lang.Object instance,
                                    java.lang.String bindAddress,
                                    int port,
                                    int numHandlers,
                                    boolean verbose,
                                    NConfiguration conf)
                             throws java.io.IOException
Construct a server for a protocol implementation instance listening on a port and address.

Throws:
java.io.IOException