|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmandala.rami.AbstractARFactory
mandala.rami.impl.AbstractARImplFactory
mandala.jacob.SORFactory
Creates asynchronous references of object stored in a given active map.
Note that when calling getInstance()
, objects are inserted
into ActiveMap
using Map.put(Object,
Object)
method whereas an Instanciator
is used when
newInstance()
is called.
The consequence is that if the related active map is remote,
getInstance()
can only insert serializable objects whereas
using newInstance()
allows non serializable objects to be
created remotely.
Notice that in the case of a RemoteActiveMap
, since
object are serialized, the singleton pattern is still achieve but
with the following difference:
The object returned by StoredObjectReference.getObject()
is the
serialized version of the object refered by the sor. Hence,
consider the following code:
Object o1 = new String("Dummy"); StoredObjectReference sor = new SORFactory(activeMap).getInstance(o1); Object o2 = sor.getObject();In the local case,
o1 == o2
returns true
whereas
it returns false
in the remote case. The reason is that in the
latter case, getInstance()
insert a serialized version - called
o3
of the object o1
in the specified remote
activeMap
. Then, the getObject()
returns the
serialized version of the object o3
and returns
o2
. Hence, even if o2.equals(o1)
, o2 !=
o1
.
Users may pay attention of both methods Object.equals(Object)
and
Object.hashCode()
of the object they insert in a remote active
map.
Framework.Factory
,
AsynchronousReference
,
StoredObjectReference
,
ActiveMap
,
Instanciator
Field Summary |
Fields inherited from class mandala.rami.impl.AbstractARImplFactory |
futureFactory |
Fields inherited from class mandala.rami.AbstractARFactory |
callbackManager |
Constructor Summary | |
SORFactory(ActiveMap activeMap)
Creates a new SORFactory instance. |
|
SORFactory(ActiveMap activeMap,
CallbackManager callbackManager)
Creates a new SORFactory instance. |
|
SORFactory(ActiveMap activeMap,
CallbackManager callbackManager,
FutureFactory futureFactory)
Creates a new SORFactory instance. |
|
SORFactory(ActiveMap activeMap,
FutureFactory futureFactory)
Creates a new SORFactory instance. |
Method Summary | |
ActiveMap |
getActiveMap()
Returns the ActiveMap this factory uses. |
protected AsynchronousReference |
getInstance(java.lang.Object object,
CallbackManager callbackManager,
FutureFactory futureFactory)
Gets a StoredObjectReference on the specified
object. |
AsynchronousReference |
newInstance(ConstructorOp constructor,
java.lang.Object[] args)
Returns a StoredObjectReference on a new object. |
Methods inherited from class mandala.rami.impl.AbstractARImplFactory |
getDefaultFutureFactory, getInstance, getInstance |
Methods inherited from class mandala.rami.AbstractARFactory |
getDefaultCallbackManager |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SORFactory(ActiveMap activeMap)
Creates a new SORFactory
instance.
Equivalent to this(activeMap, getDefaultCallbackManager(),
getDefaultFutureFactory());
.
activeMap
- an ActiveMap
valuepublic SORFactory(ActiveMap activeMap, FutureFactory futureFactory)
Creates a new SORFactory
instance.
Equivalent to this(activeMap, getDefaultCallbackManager(),
futureFactory);
.
activeMap
- an ActiveMap
valuefutureFactory
- a FutureFactory
valuepublic SORFactory(ActiveMap activeMap, CallbackManager callbackManager)
Creates a new SORFactory
instance.
Equivalent to this(activeMap, callbackManager,
getDefaultFutureFactory());
.
activeMap
- an ActiveMap
valuecallbackManager
- a CallbackManager
valuepublic SORFactory(ActiveMap activeMap, CallbackManager callbackManager, FutureFactory futureFactory)
Creates a new SORFactory
instance.
If the given activeMap
is in fact a remote active
map (activeMap instanceof RemoteActiveMap
returns
true
), and if the given futureFactory
is not a
RemoteFutureFactory
(futureFactory instanceof
RemoteFutureFactory
returns false
), then the
futureFactory
is wrapped into the remote one returned
by:
RemoteActiveMap.getDefaultFutureFactoryWrapper(FutureFactory
futureFactory)
;
activeMap
- the ActiveMap
where stored objects must
be inserted and referenced.callbackManager
- the CallbackManager
to use on
asynchronous method invocationfutureFactory
- the FutureFactory
to use on
asynchronous method invocationMethod Detail |
protected AsynchronousReference getInstance(java.lang.Object object, CallbackManager callbackManager, FutureFactory futureFactory)
Gets a StoredObjectReference
on the specified
object.
If the object is not already stored into the ActiveMap
returned by getActiveMap()
it is inserted in it with a unique
key.
The consequence is that when the ActiveMap
is remote,
object
must must be serializable.
getInstance
in class AbstractARImplFactory
object
- an Object
valuecallbackManager
- a CallbackManager
valuefutureFactory
- a FutureFactory
value
StoredObjectReference
on the stored objectStoredObjectReference
public AsynchronousReference newInstance(ConstructorOp constructor, java.lang.Object[] args)
Returns a StoredObjectReference
on a new object.
Note that the object is created using an Instanciator
so if
the active map is remote (getActiveMap() instanceof
mandala.jacob.remote.RemoteActiveMap)
returns true
),
the instanciation is done remotely.
newInstance
in interface Framework.Factory
newInstance
in class AbstractARFactory
constructor
- a ConstructorOp
valueargs
- an Object[]
value
AsynchronousReference
valuepublic ActiveMap getActiveMap()
Returns the ActiveMap
this factory uses.
ActiveMap
value
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |