Class ConcurrentAuthorityFactory.DataAccessRef<DAO extends GeodeticAuthorityFactory>
java.lang.Object
org.apache.sis.referencing.factory.ConcurrentAuthorityFactory.DataAccessRef<DAO>
- Enclosing class:
- ConcurrentAuthorityFactory<DAO extends GeodeticAuthorityFactory>
private static final class ConcurrentAuthorityFactory.DataAccessRef<DAO extends GeodeticAuthorityFactory>
extends Object
Holds the reference to a Data Access Object used by
ConcurrentAuthorityFactory, together with
information about its usage. In a mono-thread application, there is typically only one DataAccessRef
instance at a given time. However if more than one than one thread are requesting new objects concurrently,
then many instances may exist for the same ConcurrentAuthorityFactory.
If the Data Access Object is currently in use, then DataAccessRef counts how many recursive
invocations of a factory createFoo(String) method is under way in the current thread.
This information is used in order to reuse the same factory instead of creating new instances
when a GeodeticAuthorityFactory implementation invokes itself indirectly through the
ConcurrentAuthorityFactory. This assumes that factory implementations are reentrant.
If the Data Access Object has been released, then DataAccessRef keep the release timestamp.
This information is used for prioritize the Data Access Objects to close.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) intIncremented on every call toConcurrentAuthorityFactory.getDataAccess()and decremented on every call toConcurrentAuthorityFactory.release(String, Class, String).(package private) final DAOThe factory used for data access.(package private) longThe timestamp (not relative to epoch) at the time the Data Access Object has been released. -
Constructor Summary
ConstructorsConstructorDescriptionDataAccessRef(DAO factory) Creates new Data Access Object information for the given factory. -
Method Summary
-
Field Details
-
factory
The factory used for data access. -
depth
int depthIncremented on every call toConcurrentAuthorityFactory.getDataAccess()and decremented on every call toConcurrentAuthorityFactory.release(String, Class, String). When this value reach zero, the factory is really released. -
timestamp
long timestampThe timestamp (not relative to epoch) at the time the Data Access Object has been released. This timestamp shall be obtained bySystem.nanoTime()for consistency withDelayedRunnable.
-
-
Constructor Details
-
DataAccessRef
DataAccessRef(DAO factory) Creates new Data Access Object information for the given factory.
-
-
Method Details