Class AbstractSail
java.lang.Object
org.eclipse.rdf4j.sail.helpers.AbstractSail
- All Implemented Interfaces:
Sail
- Direct Known Subclasses:
AbstractNotifyingSail
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<SailConnection, Throwable> Map used to track active connections and where these were acquired.protected longConnection timeout on shutdown (in ms).private FileDirectory to store information related to this sail in (if any).(package private) static final Stringprotected static final longDefault connection timeout on shutdown: 20,000 milliseconds.protected static final longdefault value for the Iteration item sync thresholdprivate IsolationLeveldefault transaction isolation level, set toIsolationLevels.READ_COMMITTED.private QueryEvaluationModedefault SPARQL query evaluation mode, set toQueryEvaluationMode.STRICTprotected final ReentrantReadWriteLockLock used to synchronize the initialization state of a sail.private booleanFlag indicating whether the Sail has been initialized.private longprivate static final org.slf4j.Loggerprivate List<IsolationLevel> list of supported isolation levels.private boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAppends the providedIsolationLevelsto the SAIL's list of supported isolation levels.protected voidconnectionClosed(SailConnection connection) Signals to the store that the supplied connection has been closed; called byAbstractSailConnection.close().protected static booleanOpens a connection on the Sail which can be used to query and update data.protected abstract SailConnectionReturns a store-specific SailConnection object.Gets the Sail's data directory.Retrieves the defaultIsolationLevellevel on which transactions in this Sail operate.longRetrieves the currently configured threshold for syncing query evaluation iteration caches to disk.Retrieve theIsolationLevels supported by this SAIL, ordered by increasing complexity.voidinit()Initializes the Sail.protected voidDo store-specific operations to initialize the store.protected booleanChecks whether the Sail has been initialized.booleanReturns the status of the result size tracking for the query plan.protected voidRemoves all occurrences of the providedIsolationLevelsin the list of supported Isolation levels.voidsetConnectionTimeOut(long connectionTimeOut) Set connection timeout on shutdown (in ms).voidsetDataDir(File dataDir) Sets the data directory for the Sail.voidsetDefaultIsolationLevel(IsolationLevel defaultIsolationLevel) Sets the defaultIsolationLevelon which transactions in this Sail operate.voidsetDefaultQueryEvaluationMode(QueryEvaluationMode defaultQueryEvaluationMode) voidsetIterationCacheSyncThreshold(long iterationCacheSyncThreshold) Set the threshold for syncing query evaluation iteration caches to disk.protected voidsetSupportedIsolationLevels(List<IsolationLevel> supportedIsolationLevels) Sets the list of supportedIsolationLevelss for this SAIL.protected voidsetSupportedIsolationLevels(IsolationLevel... supportedIsolationLevels) Sets the list of supportedIsolationLevelss for this SAIL.voidsetTrackResultSize(boolean trackResultSize) Enable or disable results size tracking for the query plan.voidshutDown()Shuts down the Sail, giving it the opportunity to synchronize any stale data.protected abstract voidDo store-specific operations to ensure proper shutdown of the store.toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Sail
getCollectionFactory, getValueFactory, isWritable
-
Field Details
-
DEFAULT_CONNECTION_TIMEOUT
protected static final long DEFAULT_CONNECTION_TIMEOUTDefault connection timeout on shutdown: 20,000 milliseconds.- See Also:
-
defaultIsolationLevel
default transaction isolation level, set toIsolationLevels.READ_COMMITTED. -
defaultQueryEvaluationMode
default SPARQL query evaluation mode, set toQueryEvaluationMode.STRICT -
supportedIsolationLevels
list of supported isolation levels. By default set to includeIsolationLevels.READ_UNCOMMITTEDandIsolationLevels.SERIALIZABLE. Specific store implementations are expected to alter this list according to their specific capabilities. -
DEFAULT_ITERATION_SYNC_THRESHOLD
protected static final long DEFAULT_ITERATION_SYNC_THRESHOLDdefault value for the Iteration item sync threshold- See Also:
-
DEBUG_PROP
- See Also:
-
logger
private static final org.slf4j.Logger logger -
dataDir
Directory to store information related to this sail in (if any). -
initialized
private volatile boolean initializedFlag indicating whether the Sail has been initialized. Sails are initialized frominitializationuntilshutdown. -
initializationLock
Lock used to synchronize the initialization state of a sail.- write lock: initialize(), shutDown()
- read lock: getConnection()
-
connectionTimeOut
protected volatile long connectionTimeOutConnection timeout on shutdown (in ms). Defaults toDEFAULT_CONNECTION_TIMEOUT. -
iterationCacheSyncThreshold
private long iterationCacheSyncThreshold -
trackResultSize
private boolean trackResultSize -
activeConnections
Map used to track active connections and where these were acquired. The Throwable value may be null in case debugging was disable at the time the connection was acquired.
-
-
Constructor Details
-
AbstractSail
public AbstractSail()
-
-
Method Details
-
debugEnabled
protected static boolean debugEnabled() -
setConnectionTimeOut
public void setConnectionTimeOut(long connectionTimeOut) Set connection timeout on shutdown (in ms).- Parameters:
connectionTimeOut- timeout (in ms)
-
setDataDir
Description copied from interface:SailSets the data directory for the Sail. The Sail can use this directory for storage of data, parameters, etc. This directory must be set before the Sail is.invalid reference
initialized- Specified by:
setDataDirin interfaceSail
-
getDataDir
Description copied from interface:SailGets the Sail's data directory.- Specified by:
getDataDirin interfaceSail- See Also:
-
toString
-
isInitialized
protected boolean isInitialized()Checks whether the Sail has been initialized. Sails are initialized frominitializationuntilshutdown.- Returns:
- true if the Sail has been initialized, false otherwise.
-
init
Description copied from interface:SailInitializes the Sail. Care should be taken that required initialization parameters have been set before this method is called. Please consult the specific Sail implementation for information about the relevant parameters.- Specified by:
initin interfaceSail- Throws:
SailException- If the Sail could not be initialized.
-
initializeInternal
Do store-specific operations to initialize the store. The default implementation of this method does nothing.- Throws:
SailException
-
shutDown
Description copied from interface:SailShuts down the Sail, giving it the opportunity to synchronize any stale data. Care should be taken that all initialized Sails are being shut down before an application exits to avoid potential loss of data. Once shut down, a Sail can no longer be used until it is re-initialized.- Specified by:
shutDownin interfaceSail- Throws:
SailException- If the Sail object encountered an error or unexpected situation internally.
-
shutDownInternal
Do store-specific operations to ensure proper shutdown of the store.- Throws:
SailException
-
getConnection
Description copied from interface:SailOpens a connection on the Sail which can be used to query and update data. Depending on how the implementation handles concurrent access, a call to this method might block when there is another open connection on this Sail.- Specified by:
getConnectionin interfaceSail- Throws:
SailException- If no transaction could be started, for example because the Sail is not writable.
-
getConnectionInternal
Returns a store-specific SailConnection object.- Returns:
- A connection to the store.
- Throws:
SailException
-
connectionClosed
Signals to the store that the supplied connection has been closed; called byAbstractSailConnection.close().- Parameters:
connection- The connection that has been closed.
-
addSupportedIsolationLevel
Appends the providedIsolationLevelsto the SAIL's list of supported isolation levels.- Parameters:
level- a supported IsolationLevel.
-
removeSupportedIsolationLevel
Removes all occurrences of the providedIsolationLevelsin the list of supported Isolation levels.- Parameters:
level- the isolation level to remove.
-
setSupportedIsolationLevels
Sets the list of supportedIsolationLevelss for this SAIL. The list is expected to be ordered in increasing complexity.- Parameters:
supportedIsolationLevels- a list of supported isolation levels.
-
setSupportedIsolationLevels
Sets the list of supportedIsolationLevelss for this SAIL. The list is expected to be ordered in increasing complexity.- Parameters:
supportedIsolationLevels- a list of supported isolation levels.
-
getSupportedIsolationLevels
Description copied from interface:SailRetrieve theIsolationLevels supported by this SAIL, ordered by increasing complexity.- Specified by:
getSupportedIsolationLevelsin interfaceSail- Returns:
- a non-empty List of supported Isolation Levels, in order of increasing complexity. Every SAIL supports at
least one
IsolationLevel.
-
getDefaultIsolationLevel
Description copied from interface:SailRetrieves the defaultIsolationLevellevel on which transactions in this Sail operate.- Specified by:
getDefaultIsolationLevelin interfaceSail- Returns:
- the
IsolationLevelthat will be used withSailConnection.begin(), for SAIL connections returned bySail.getConnection().
-
setDefaultIsolationLevel
Sets the defaultIsolationLevelon which transactions in this Sail operate.- Parameters:
defaultIsolationLevel- The defaultIsolationLevel to set.
-
getIterationCacheSyncThreshold
public long getIterationCacheSyncThreshold()Retrieves the currently configured threshold for syncing query evaluation iteration caches to disk.- Returns:
- Returns the iterationCacheSyncThreshold.
-
setIterationCacheSyncThreshold
public void setIterationCacheSyncThreshold(long iterationCacheSyncThreshold) Set the threshold for syncing query evaluation iteration caches to disk.- Parameters:
iterationCacheSyncThreshold- The iterationCacheSyncThreshold to set.
-
isTrackResultSize
public boolean isTrackResultSize()Returns the status of the result size tracking for the query plan. Useful to determine which parts of a query plan generated the most data.- Returns:
- true if result size tracking is enabled.
-
setTrackResultSize
public void setTrackResultSize(boolean trackResultSize) Enable or disable results size tracking for the query plan. Useful to determine which parts of a query plan generated the most data.- Parameters:
trackResultSize- true to enable tracking.
-
getDefaultQueryEvaluationMode
- Returns:
- the defaultQueryEvaluationMode
-
setDefaultQueryEvaluationMode
- Parameters:
defaultQueryEvaluationMode- the defaultQueryEvaluationMode to set
-