|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mandala.rami.Framework
This class is the starting point in RAMI.
This class helps the end-user to
Getting a total transparent asynchronous proxy on an object is
provided by the getTotalTransparentAsynchronousProxy(Object)
method:
MyInterface object = myLibrary.getOneMyInterfaceInstance(); MyInterface proxy = (MyInterface) Framework.getTotalTransparentAsynchronousProxy(object); Result result = proxy.myMethod(); // Total-transparent asynchronous call doSomethingElse(); // Concurrent execution with 'myMethod()' result.method(); // Wait-by-necessity mechanismWhereas this mechanism seems to be the easiest one, it has some problems and constraints. See the limitations for details.
The prefered way to deal with asynchronous method invocation is using semi transparent asynchronous proxies.
Getting a semi transparent asynchronous proxy on an object is
provided by the getSemiTransparentAsynchronousProxy(Object)
method:
myPackage.MyClass object = myLibrary.getOneMyClassInstance(); jaya.myPackage.MyClass proxy = (jaya.myPackage.MyClass) Framework.getSemiTransparentAsynchronousProxy(object); FutureClient future = proxy.rami_myMethod(); // Semi-transparent asynchronous call doSomethingElse(); // Concurrent execution with 'myMethod()' Result result; try{ result = future.waitForResult(); }catch(Throwable t) { // An exception occured during the execution of 'myMethod()' result = handleException(t); } result.method(); // Use the result
Note that you must have compiled a semi-transparent proxy using
the JayaCompiler
. See mandala.rami.transparency.semi
for details.
To Customize the creation of asynchronous references, you use the setFactory(Framework.Factory)
method and specify the factory to be used
such as in the following code:
Framework.setFactory(new Framework.Factory() { AsynchronousReference getInstance(Object object) { return SpecialAsynchronousReference.getInstance(object); };
The default factory used is an instance of ARFactory
instance.
Nested Class Summary | |
static interface |
Framework.Factory
The Factory used to instanciate
AsynchronousReference implementation. |
Field Summary | |
static Syslog |
syslog
|
Constructor Summary | |
Framework()
|
Method Summary | |
static Framework.Factory |
getFactory()
Gets the Factory currently used to create
AsynchronousReference implementation. |
static SemiTransparentAsynchronousProxy |
getSemiTransparentAsynchronousProxy(java.lang.Object object)
Equivalent to getSemiTransparentAsynchronousProxy(object,
Framework.getFactory()) . |
static SemiTransparentAsynchronousProxy |
getSemiTransparentAsynchronousProxy(java.lang.Object object,
java.lang.Class proxyClass)
Equivalent to getSemiTransparentAsynchronousProxy(object,
class, Framework.getFactory()) . |
static SemiTransparentAsynchronousProxy |
getSemiTransparentAsynchronousProxy(java.lang.Object object,
java.lang.Class proxyClass,
Framework.Factory factory)
Returns a semi-transparent asynchronous proxy on the specified object. |
static SemiTransparentAsynchronousProxy |
getSemiTransparentAsynchronousProxy(java.lang.Object object,
Framework.Factory factory)
Returns a semi-transparent asynchronous proxy on the specified object. |
static java.lang.Object |
getTotalTransparentAsynchronousProxy(java.lang.Object object)
Equivalent to getTotalTransparentAsynchronousProxy(object,
getFactory()) . |
static java.lang.Object |
getTotalTransparentAsynchronousProxy(java.lang.Object object,
Framework.Factory factory)
Returns a total-transparent asynchronous proxy on the specified object. |
static void |
setFactory(Framework.Factory factory)
Sets the Factory to use to create new
AsynchronousReference implementation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static Syslog syslog
Constructor Detail |
public Framework()
Method Detail |
public static void setFactory(Framework.Factory factory)
Sets the Factory
to use to create new
AsynchronousReference
implementation.
factory
- a Factory
valuepublic static Framework.Factory getFactory()
Gets the Factory
currently used to create
AsynchronousReference
implementation.
Factory
valuepublic static SemiTransparentAsynchronousProxy getSemiTransparentAsynchronousProxy(java.lang.Object object)
Equivalent to getSemiTransparentAsynchronousProxy(object,
Framework.getFactory())
.
public static SemiTransparentAsynchronousProxy getSemiTransparentAsynchronousProxy(java.lang.Object object, Framework.Factory factory)
Returns a semi-transparent asynchronous proxy on the specified object.
It the object class is not a public class, then the proxy returned is the jaya proxy of its first public superclass.
The factory
specified is used if a proxy has not yet
been created.
object
- the object to get a semi-transparent asynchronous proxy onfactory
- the Factory
to use to create an
AsynchronousReference
on the given object
Framework.Factory
,
AsynchronousReference
public static SemiTransparentAsynchronousProxy getSemiTransparentAsynchronousProxy(java.lang.Object object, java.lang.Class proxyClass)
Equivalent to getSemiTransparentAsynchronousProxy(object,
class, Framework.getFactory())
.
public static SemiTransparentAsynchronousProxy getSemiTransparentAsynchronousProxy(java.lang.Object object, java.lang.Class proxyClass, Framework.Factory factory)
Returns a semi-transparent asynchronous proxy on the specified object.
The proxy returned is an instance of the class specified on the specified object.
The factory
specified is used if a proxy has not yet
been created.
object
- the object to get a semi-transparent asynchronous proxy onproxyClass
- the class to use as the jaya semi transparent
asynchronous proxyfactory
- the Factory
to use to create an
AsynchronousReference
on the given object
Framework.Factory
,
AsynchronousReference
public static java.lang.Object getTotalTransparentAsynchronousProxy(java.lang.Object object)
Equivalent to getTotalTransparentAsynchronousProxy(object,
getFactory())
.
public static java.lang.Object getTotalTransparentAsynchronousProxy(java.lang.Object object, Framework.Factory factory)
Returns a total-transparent asynchronous proxy on the specified object.
object
- the object to get a total-transparent asynchronous proxy
onfactory
- the Factory
to use when creating the
associated AsynchronousReference
Framework.Factory
,
AsynchronousReference
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |