|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlivespace.services.Synchronizer
livespace.services.SizeSynchronizer
public class SizeSynchronizer
Used to wait for a limited time until a required number of elements arrive in a registry or IDataObject-based collection.
waitForEntity(EntityRegistry)
,
waitForEntities(EntityRegistry, int)
,
waitForElement(Collection)
,
waitForElements(Collection, int)
Field Summary |
---|
Fields inherited from class livespace.services.Synchronizer |
---|
source, synced |
Constructor Summary | |
---|---|
SizeSynchronizer(Collection<?> collection,
int requiredSize)
Create a new instance. |
|
SizeSynchronizer(EntityRegistry registry,
int requiredSize)
Create a new instance. |
Method Summary | |
---|---|
protected String |
createFailMessage()
Create an error message indicating why synchronization has failed. |
protected int |
getSize()
|
protected boolean |
isSynchronized()
Called to test whether the object is currently synchronized. |
static Object |
waitForElement(Collection<?> collection)
Shortcut to wait up to the default time (ENTITY_WAIT_TIMEOUT millis) for a single element to arrive. |
static void |
waitForElements(Collection<?> collection,
int requiredSize)
Shortcut to wait for up to a given time for a given number of entities to arrive. |
static void |
waitForElements(Collection<?> collection,
int requiredSize,
int timeout)
Shortcut to wait up to the default time (ENTITY_WAIT_TIMEOUT millis) for a given number of entities to arrive. |
static void |
waitForEntities(EntityRegistry registry,
int requiredSize)
Shortcut to wait up to the default time (ENTITY_WAIT_TIMEOUT millis) for a given number of entities to arrive. |
static Entity |
waitForEntity(EntityRegistry registry)
Shortcut to wait up to the default time (ENTITY_WAIT_TIMEOUT millis) for a single entity to arrive. |
Methods inherited from class livespace.services.Synchronizer |
---|
isSynchronized, propertyValueChanged, synchronize, synchronize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface dsto.dfc.databeans.PropertyListener |
---|
propertyValueChanged |
Constructor Detail |
---|
public SizeSynchronizer(EntityRegistry registry, int requiredSize)
waitForEntities(EntityRegistry, int)
instead.
registry
- The registry.requiredSize
- The required number of entities. To indicate
the a number of entities (eg >= requiredSize), using a
negative number. eg for >= 3 entities, use -3.public SizeSynchronizer(Collection<?> collection, int requiredSize)
waitForElements(Collection, int)
instead.
collection
- The collection. This must also implement the
IDataObject interface.requiredSize
- The required number of entities. To indicate
the a number of entities (eg >= requiredSize), using a
negative number. eg for >= 3 entities, use -3.Method Detail |
---|
public static Entity waitForEntity(EntityRegistry registry) throws SynchronizationException
registry
- The registry to listen to.
SynchronizationException
- if exactly one entity isn't in
the registry by the given timeout.waitForEntities(EntityRegistry, int)
public static void waitForEntities(EntityRegistry registry, int requiredSize) throws SynchronizationException
registry
- The registry to listen to.requiredSize
- The required number of entities. To indicate
the a number of entities (eg >= requiredSize), using a
negative number. eg for >= 3 entities, use -3.
SynchronizationException
- if exactly one entity isn't in
the registry by the given timeout.public static Object waitForElement(Collection<?> collection) throws SynchronizationException
collection
- The collection. This must also implement the
IDataObject interface.
SynchronizationException
- if exactly one entity isn't in
the collection by the given timeout.waitForElements(Collection, int)
public static void waitForElements(Collection<?> collection, int requiredSize) throws SynchronizationException
collection
- The collection. This must also implement the
IDataObject interface.requiredSize
- The required number of entities. To indicate
the a number of entities (eg >= requiredSize), using a
negative number. eg for >= 3 entities, use -3.
SynchronizationException
- if exactly one entity isn't in
the registry by the given timeout.waitForElements(Collection,int,int)
public static void waitForElements(Collection<?> collection, int requiredSize, int timeout) throws SynchronizationException
collection
- The collection. This must also implement the
IDataObject interface.requiredSize
- The required number of entities. To indicate
the a number of entities (eg >= requiredSize), using a
negative number. eg for >= 3 entities, use -3.timeout
- The max amount of time (in millis) to wait.
SynchronizationException
- if exactly one entity isn't in
the registry by the given timeout.waitForElement(Collection)
protected boolean isSynchronized()
Synchronizer
isSynchronized
in class Synchronizer
protected int getSize()
protected String createFailMessage()
Synchronizer
createFailMessage
in class Synchronizer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |