org.eclipse.jpt.common.utility.synchronizers
Interface Synchronizer

All Known Subinterfaces:
CallbackSynchronizer
All Known Implementing Classes:
CallbackSynchronizer.Null, Synchronizer.Null

public interface Synchronizer

This interface defines the protocol for starting, stopping, and executing a long-running, repeatable, and possibly recursive "synchronization" process. The intent is for the synchronizer to synchronize a "secondary" model with a "primary" model. Any change to the "primary" model will trigger the synchronization. The synchronizer implementation will determine whether the "secondary" model remains in sync synchronously or asynchronously.

The assumption is that the start() and stop() methods will be called from a single master thread that would control the synchronizer's lifecycle and the synchronize() method will be called multiple times, possibly from multiple threads.


Nested Class Summary
static class Synchronizer.Null
          Singleton implementation of the Synchronizer interface that will do nothing.
 
Method Summary
 void start()
          Enable the synchronizer to allow future synchronizations as requested by calls to synchronize().
 void stop()
          Stop the synchronizer immediately or, if a synchronization is currently in progress, when it completes.
 void synchronize()
          Synchronize the dependent model with the primary model.
 

Method Detail

start

void start()
Enable the synchronizer to allow future synchronizations as requested by calls to synchronize().


synchronize

void synchronize()
Synchronize the dependent model with the primary model. Do nothing if start() has not previously been called. Do nothing if stop() has been called (without any intermediate call to start().


stop

void stop()
Stop the synchronizer immediately or, if a synchronization is currently in progress, when it completes. Return when the synchronizer is stopped. No further synchonizations will performed until start() is called.