guarana.toolkit.adapter.proxy
Class Future

java.lang.Object
  extended by guarana.util.observer.remote.RemoteObservable
      extended by guarana.toolkit.adapter.proxy.Future
All Implemented Interfaces:
IStubFuture, Serializable, Remote

public class Future
extends guarana.util.observer.remote.RemoteObservable
implements IStubFuture, Serializable

A future object to be shared between the JBI container and the Guaranį DSL solution. This future object contains the response message to the port.

Since:
Guaranį SDK 1.0.0
Author:
Rafael Z. Frantz
See Also:
Serialized Form

Constructor Summary
Future(String host, int port)
          Constructs a new Future.
 
Method Summary
 void destroy()
          Unbind and removes this object from the RMI Registry if it is bound.
 String getId()
          Returns the unique ID that identifies this future.
 Message<?> getResult()
          Returns the response message from this future.
 boolean isDone()
          Checks if the future contains the response message.
 void setResult(Message<?> result)
          Sets a response message to this future.
 
Methods inherited from class guarana.util.observer.remote.RemoteObservable
addRemoteObserver, countRemoteObservers, notifyRemoteObservers, notifyRemoteObservers, removeAllRemoteObservers, removeRemoteObserver
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface guarana.toolkit.adapter.proxy.IStubFuture
addRemoteObserver
 

Constructor Detail

Future

public Future(String host,
              int port)
Constructs a new Future.

Parameters:
host - The host where this future is registered to the RMI Registry.
port - The port on which is running the RMI Registry.
Method Detail

isDone

public boolean isDone()
               throws RemoteException
Checks if the future contains the response message.

Specified by:
isDone in interface IStubFuture
Returns:
True if this future contains the response message; otherwise, False.
Throws:
RemoteException - if any remote exception is raised during this method execution.

setResult

public void setResult(Message<?> result)
               throws RemoteException
Sets a response message to this future. When the result is set this future object is ready to be returned.

Specified by:
setResult in interface IStubFuture
Parameters:
result - the response message.
Throws:
RemoteException - if any remote exception is raised during this method execution.

getResult

public Message<?> getResult()
                     throws RemoteException
Returns the response message from this future.

Specified by:
getResult in interface IStubFuture
Returns:
the response message.
Throws:
RemoteException - if any remote exception is raised during this method execution.

getId

public String getId()
             throws RemoteException
Returns the unique ID that identifies this future.

Specified by:
getId in interface IStubFuture
Returns:
the future id.
Throws:
RemoteException - if any remote exception is raised during this method execution.

destroy

public void destroy()
             throws RemoteException,
                    NotBoundException,
                    AccessException,
                    NoSuchObjectException
Unbind and removes this object from the RMI Registry if it is bound.

Specified by:
destroy in interface IStubFuture
Throws:
RemoteException - if a remote exception is raised during this method execution.
AccessException - if the method was invoked from a non-local host, then an AccessException is thrown.
NoSuchObjectException - if an attempt is made to invoke a method on an object that no longer exists in the remote virtual machine.
NotBoundException - if an attempt is made to lookup or unbind in the registry a name that has no associated binding.


Guaranį DSL Home