@Singleton @Named public final class DefaultSyncContextFactory extends java.lang.Object implements SyncContextFactory, Service
SyncContextFactory
implementation that uses named locks.
The implementation relies fully on NamedLockFactoryAdapterFactory
and all it does is just "stuff" the
adapter instance into session, hence factory is called only when given session has no instance created.
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
ADAPTER_KEY |
private NamedLockFactoryAdapterFactory |
namedLockFactoryAdapterFactory |
Constructor and Description |
---|
DefaultSyncContextFactory()
Deprecated.
Will be removed once ServiceLocator removed.
|
DefaultSyncContextFactory(NamedLockFactoryAdapterFactory namedLockFactoryAdapterFactory)
Constructor used with DI, where factories are injected and selected based on key.
|
Modifier and Type | Method and Description |
---|---|
void |
initService(ServiceLocator locator)
Provides the opportunity to initialize this service and to acquire other services for its operation from the
locator.
|
SyncContext |
newInstance(RepositorySystemSession session,
boolean shared)
Creates a new synchronization context.
|
private static final java.lang.String ADAPTER_KEY
private NamedLockFactoryAdapterFactory namedLockFactoryAdapterFactory
@Inject public DefaultSyncContextFactory(NamedLockFactoryAdapterFactory namedLockFactoryAdapterFactory)
@Deprecated public DefaultSyncContextFactory()
public void initService(ServiceLocator locator)
Service
initService
in interface Service
locator
- The service locator, must not be null
.public SyncContext newInstance(RepositorySystemSession session, boolean shared)
SyncContextFactory
newInstance
in interface SyncContextFactory
session
- The repository session during which the context will be used, must not be null
.shared
- A flag indicating whether access to the artifacts/metadata associated with the new context can be
shared among concurrent readers or whether access needs to be exclusive to the calling thread.null
.RepositorySystem.newSyncContext(RepositorySystemSession, boolean)