|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmandala.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(Object object)
Returns a semi-transparent asynchronous proxy on the specified object. |
static SemiTransparentAsynchronousProxy |
getSemiTransparentAsynchronousProxy(Object object,
Class proxyClass)
Returns a semi-transparent asynchronous proxy on the specified object. |
static Object |
getTotalTransparentAsynchronousProxy(Object object)
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(Object object)
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.
object
- the object to get a semi-transparent asynchronous proxy on
public static SemiTransparentAsynchronousProxy getSemiTransparentAsynchronousProxy(Object object, Class proxyClass)
Returns a semi-transparent asynchronous proxy on the specified object.
The proxy returned is an instance of the class specified on the specified object.
object
- the object to get a semi-transparent asynchronous proxy onproxyClass
- the class to use as the jaya semi transparent
asynchronous proxy
public static Object getTotalTransparentAsynchronousProxy(Object object)
Returns a total-transparent asynchronous proxy on the specified object.
object
- the object to get a total-transparent asynchronous proxy
on
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |