he count int count = state.getCount(); if ( count == -1 ) { synchronized ( state ) { count = calculateCount(); state.setCount( count ); } }
Event Notification
The list of listeners interested in event notification as features are modified and edited is stored as part of ContentState. Each notification is considered to be broadcast from a specific FeatureSource. Since several ContentFeatureStores can be on the same transaction (and thus share a ContentState) the fire methods listed here require you pass in the FeatureSource making the change; this requires that your individual FeatureWriters keep a pointer to the ContentFeatureStore which created them.
You may also make use of {@link ContentFeatureSource#canEvent} value of {@code false} allowingthe base ContentFeatureStore class to take responsibility for sending event notifications.
Transaction Independence
The default ContentState implementation also supports the handling of {@link ContentFeatureSource#canTransaction} value of {@code false}. The implementation asks ContentState to store a {@link Diff} which is used to record any modifications made untilcommit is called.
Internally a {@link Transaction.State} is used to notify the implementation of{ {@link Transaction#commit} and {@link Transaction#rollback()}.
Extension
This class may be extended if your implementaiton wishes to capture additional information per transaction. A database implementation using a JDBCContentState to store a JDBC Connection remains a good example.
Subclasses may extend (not override) the following methods:
- {@link #flush()} - remember to call super.flush()
- {@link #close()} - remember to call super.close()
Subclasses should also override {@link #copy()} to ensure any additional state they are keepingis correctly accounted for.
@author Jody Garnett (LISASoft)
@author Justin Deoliveira, The Open Planning Project
@version 8.0
@since 2.6
@source $URL$