public class TrsStoreSynchronizer extends Object
TrsStore. This class is to guarantee store methods are never executed concurrently but one at a time across the whole web application. It also provides a
ResourceEventStoreimplementation whose methods are synchronized, so that callers (usually listeners in the application) do not need to take care on their own about this.
|Constructor and Description|
Creates a synchronizer instance wrapping the specified store.
|Modifier and Type||Method and Description|
Executes a function using the underlying synchronizer, which guarantees only one function can be executed at a time across the whole web application.
Returns an event store designed for listeners registered in the application.
Determines whether the event store has remaining event storage requests being processed asynchronously.
public <R> R apply(TrsStoreFunction<R> function) throws TrsStoreException
R- the type of the result of the function
function- the function to execute through the synchronizer
TrsStoreException- when the function raises such exception or the synchronizer fails to complete the execution
public ResourceEventStore getResourceEventStore()
ResourceEventStore.store(ResourceEvent...)methods without taking care on their own of the synchronization. This store implementation records in memory the events to be stored and immediately returns, so that listeners are guaranteed not to be blocked until the events are stored. The actual storage is performed in a separate thread and synchronized with the TrsStore using the
public boolean isResourceEventStoreIdle()
trueif no event storage request is currently being processed,
falseif the store is actively storing data.