org.semispace
Interface SemiSpaceInterface

All Known Implementing Classes:
SemiSpace

public interface SemiSpaceInterface

Operations possible to perform on space, inspired by the JavaSpace interface.


Method Summary
 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 duration)
          Write object into tuple space, with a life time given in ms.
 

Method Detail

write

SemiLease write(Object obj,
                long duration)
Write object into tuple space, with a life time given in ms.

Parameters:
obj - Object to be written into the space
duration - Life time in milliseconds of the written object
Returns:
either the resulting lease, or null if an error occurred

read

<T> T read(T template,
           long duration)
Read an object from the space, which has matching fields (or getters) with the template

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

<T> T readIfExists(T template)
Same as read, with duration 0

See Also:
read(Object, long)

take

<T> T take(T template,
           long duration)
Same as read, except that the object is removed from the space.

See Also:
read(Object, long)

takeIfExists

<T> T takeIfExists(T template)
Same as take, with a duration of 0

See Also:
take(Object, long), read(Object, long)

notify

SemiEventRegistration notify(Object template,
                             SemiEventListener listener,
                             long duration)
Register a listener for a particular template search.

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:
An event registration or null


Copyright © 2008-2012. All Rights Reserved.