|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object livespace.services.Synchronizer
public abstract class Synchronizer
Base for classes that support synchronizing a thread with a
property change triggered by another thread. Subclasses need to
implement isSynchronized()
which is called whenever a
property change takes place.
isSynchronized()
,
SizeSynchronizer
,
PropertySynchronizer
Field Summary | |
---|---|
protected IDataObject |
source
|
protected boolean |
synced
|
Constructor Summary | |
---|---|
Synchronizer(IDataObject source)
Create a new instance. |
Method Summary | |
---|---|
protected abstract String |
createFailMessage()
Create an error message indicating why synchronization has failed. |
protected abstract boolean |
isSynchronized()
Called to test whether the object is currently synchronized. |
protected boolean |
isSynchronized(PropertyEvent e)
This is called whenever a property changes on the object of interest. |
void |
propertyValueChanged(PropertyEvent e)
|
void |
synchronize()
Wait up to the default time (ENTITY_RESPONSE_TIMEOUT millis) for synchronization to take place, |
void |
synchronize(long maxWait)
Wait a given amount of time for a synchronization. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected IDataObject source
protected boolean synced
Constructor Detail |
---|
public Synchronizer(IDataObject source)
source
- The source to listen for property changes on.Method Detail |
---|
public void synchronize() throws SynchronizationException
SynchronizationException
- if exactly one entity isn't in
the registry by the given timeout.public void synchronize(long maxWait) throws SynchronizationException
maxWait
- The maximum time (in millis) to wait.
SynchronizationException
- if synchronization hasn't
occurred by the given timeout.protected boolean isSynchronized(PropertyEvent e)
isSynchronized()
.
Subclasses may override this if they want to use the property
change event as part of the test.
protected abstract boolean isSynchronized()
protected abstract String createFailMessage()
public void propertyValueChanged(PropertyEvent e)
propertyValueChanged
in interface PropertyListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |