mandala.jacob.remote.rmi
Class RMIActiveMap

java.lang.Object
  extended bymandala.jacob.remote.AbstractRemote
      extended bymandala.jacob.remote.AbstractLocalReferenceRetriever
          extended bymandala.jacob.remote.rmi.RMISingletonRemoteProxy
              extended bymandala.jacob.remote.rmi.RMIMap
                  extended bymandala.jacob.remote.rmi.RMIActiveMap
All Implemented Interfaces:
ActiveMap, LocalReferenceRetriever, java.util.Map, java.rmi.Remote, Remote, RemoteActiveMap, RemoteMap, java.io.Serializable

public class RMIActiveMap
extends RMIMap
implements RemoteActiveMap

Java-RMI RemoteActiveMap implementation.

Version:
$Revision: 1.6 $
Author:
eipi
See Also:
AbstractRemote, RemoteActiveMap, ExceptionHandler, RMIMap, Serialized Form

Nested Class Summary
 
Nested classes inherited from class mandala.jacob.remote.rmi.RMIMap
RMIMap.RMIEntry
 
Nested classes inherited from class mandala.jacob.remote.RemoteActiveMap
RemoteActiveMap.CallRemoteExceptionInfo, RemoteActiveMap.RemoteActiveMapMethods, RemoteActiveMap.RemoteFutureFactory
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Nested classes inherited from class mandala.jacob.remote.RemoteMap
RemoteMap.RemoteEntry, RemoteMap.RemoteMapMethods
 
Field Summary
 
Fields inherited from class mandala.jacob.remote.rmi.RMIMap
singletonGiver
 
Fields inherited from class mandala.jacob.remote.AbstractRemote
defaultExceptionHandler, exceptionHandler, syslog
 
Method Summary
 Cancelable call(java.lang.Object key, FutureServer future)
          Allows objects to do an asynchronous call on a method of the object associated with the given key.
 RemoteActiveMap.RemoteFutureFactory getDefaultFutureFactoryWrapper(FutureFactory futureFactory)
          Return the default remote future factory wrapper of "standard" (local) future factory.
static RMIActiveMap newServer(ActiveMap activeMap)
          Creates a new RMIActiveMap server for the specified active map.
static RMIActiveMap newServer(ActiveMap activeMap, int port)
          Creates a new RMIActiveMap server for the specified active map.
 java.lang.String toString()
           
 
Methods inherited from class mandala.jacob.remote.rmi.RMIMap
clear, containsKey, containsValue, entrySet, get, isEmpty, keySet, newServer, newServer, put, putAll, putAll, readResolve, remove, size, values
 
Methods inherited from class mandala.jacob.remote.AbstractLocalReferenceRetriever
finalize, getID, getLocalReference
 
Methods inherited from class mandala.jacob.remote.AbstractRemote
getDefaultExceptionHandler, getExceptionHandler, getSyslog, handleException, setDefaultExceptionHandler, setExceptionHandler, setSyslog
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from interface mandala.jacob.remote.RemoteMap
entrySet, keySet, putAll, values
 
Methods inherited from interface mandala.jacob.remote.LocalReferenceRetriever
getID, getLocalReference
 
Methods inherited from interface mandala.jacob.remote.Remote
getExceptionHandler, setExceptionHandler
 

Method Detail

newServer

public static RMIActiveMap newServer(ActiveMap activeMap)
                              throws java.rmi.RemoteException

Creates a new RMIActiveMap server for the specified active map.

Parameters:
activeMap - the active map to serve remotely
Returns:
the RMIActiveMap instance representing the given active map
Throws:
java.rmi.RemoteException - if an error occurs

newServer

public static RMIActiveMap newServer(ActiveMap activeMap,
                                     int port)
                              throws java.rmi.RemoteException

Creates a new RMIActiveMap server for the specified active map.

Parameters:
activeMap - the active map to serve remotely
port - the port to listen to
Returns:
the RMIActiveMap instance representing the given active map
Throws:
java.rmi.RemoteException - if an error occurs

getDefaultFutureFactoryWrapper

public RemoteActiveMap.RemoteFutureFactory getDefaultFutureFactoryWrapper(FutureFactory futureFactory)
Description copied from interface: RemoteActiveMap

Return the default remote future factory wrapper of "standard" (local) future factory.

This method is tiedly coupled with the SORFactory class.

Every RemoteActiveMap implementation must provide default RemoteFutureFactory wrappers for traditionnal (i.e. local) FutureFactory in order to make remotely accessible the notion of futures which is decomposed in two parts:

The wrapper may for example make remote the FutureServer object so the RemoteActiveMap implementation can send/receive datas to/from it.

Another approach is to send the FutureServer on the other side, hence the result of method invocation can be keep on the host where the calculation have been made, and the RAMI Callback mechanism may be used to use this result where it is. In this case, no communication is necessary to send the result back to the client.

The last approach is to send both the FutureClient and the FutureServer on the other side, hence communication between FutureClient and FutureServer are done locally. A proxy must be created by the wrapper in order for local client to access to the remote FutureClient if necessary.

Specified by:
getDefaultFutureFactoryWrapper in interface RemoteActiveMap
Parameters:
futureFactory - the futureFactory which create futures to be wrapped
Returns:
the FutureFactory that wraps futures returned by the given futureFactory

call

public Cancelable call(java.lang.Object key,
                       FutureServer future)
Description copied from interface: ActiveMap

Allows objects to do an asynchronous call on a method of the object associated with the given key.

Invokes the method returned by futureServer.getMethod() on the object maps to the specified key (if it exists). The futureServer object is also used to sets the result once the method returns either normally or abruptly (exception) with the method futureServer.setResult()

The futureServer object given is used as specified in MethodInvoker.run()

Specified by:
call in interface ActiveMap
Parameters:
key - The key associated with the stored object.
future - A FutureServer object.
Returns:
the object you may used for cancelation
See Also:
FutureServer, MethodInvoker

toString

public java.lang.String toString()
Overrides:
toString in class RMIMap


Mandala help mailing list