org.semispace.comet.client
Class SemiSpaceCometProxy

java.lang.Object
  extended by org.semispace.comet.client.SemiSpaceCometProxy
All Implemented Interfaces:
SemiSpaceInterface

public class SemiSpaceCometProxy
extends Object
implements SemiSpaceInterface

Client side of comet proxy


Constructor Summary
SemiSpaceCometProxy()
           
 
Method Summary
 void destroy()
           
 void init(String endpoint)
           
 SemiEventRegistration notify(Object template, SemiEventListener listener, long duration)
          Register a listener for a particular template search.
<T> T
read(T template, long duration)
          Read an object from the space, which has matching fields (or getters) with the template
<T> T
readIfExists(T template)
          Same as read, with duration 0
<T> T
take(T template, long duration)
          Same as read, except that the object is removed from the space.
<T> T
takeIfExists(T template)
          Same as take, with a duration of 0
 SemiLease write(Object obj, long timeToLiveMs)
          Write object into tuple space, with a life time given in ms.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SemiSpaceCometProxy

public SemiSpaceCometProxy()
Method Detail

init

public void init(String endpoint)

destroy

public void destroy()

write

public SemiLease write(Object obj,
                       long timeToLiveMs)
Description copied from interface: SemiSpaceInterface
Write object into tuple space, with a life time given in ms.

Specified by:
write in interface SemiSpaceInterface
Parameters:
obj - Object to be written into the space
timeToLiveMs - Life time in milliseconds of the written object
Returns:
null Always returning null, as lease is not supported for written objects.

read

public <T> T read(T template,
                  long duration)
Description copied from interface: SemiSpaceInterface
Read an object from the space, which has matching fields (or getters) with the template

Specified by:
read in interface SemiSpaceInterface
Parameters:
template - Object of exactly the same type as what is wanted as return value, with zero or more none-null fields or getters.
duration - How long you are willing to wait for an answer / match.
Returns:
An object when matches the template, or null of none are found.

readIfExists

public <T> T readIfExists(T template)
Description copied from interface: SemiSpaceInterface
Same as read, with duration 0

Specified by:
readIfExists in interface SemiSpaceInterface
See Also:
SemiSpaceInterface.read(Object, long)

take

public <T> T take(T template,
                  long duration)
Description copied from interface: SemiSpaceInterface
Same as read, except that the object is removed from the space.

Specified by:
take in interface SemiSpaceInterface
See Also:
SemiSpaceInterface.read(Object, long)

takeIfExists

public <T> T takeIfExists(T template)
Description copied from interface: SemiSpaceInterface
Same as take, with a duration of 0

Specified by:
takeIfExists in interface SemiSpaceInterface
See Also:
SemiSpaceInterface.take(Object, long), SemiSpaceInterface.read(Object, long)

notify

public SemiEventRegistration notify(Object template,
                                    SemiEventListener listener,
                                    long duration)
Description copied from interface: SemiSpaceInterface
Register a listener for a particular template search.

Specified by:
notify in interface SemiSpaceInterface
Parameters:
template - Template to be matched.
listener - Listener to be notified when object with a matching template is found
duration - How long this particular listener is valid.
Returns:
The resulting lease, or null if lease were not obtained


Copyright © 2008-2012. All Rights Reserved.