| java.lang.Object org.openrdf.sail.helpers.SailBase org.openrdf.sail.memory.MemoryStore
MemoryStore | public class MemoryStore extends SailBase (Code) | | An implementation of the Sail interface that stores its data in main memory
and that can use a file for persistent storage. This Sail implementation
supports single, isolated transactions. This means that changes to the data
are not visible until a transaction is committed and that concurrent
transactions are not possible. When another transaction is active, calls to
startTransaction() will block until the active transaction is
committed or rolled back.
author: Arjohn Kampman author: jeen |
Constructor Summary | |
public | MemoryStore() Creates a new MemoryStore. | public | MemoryStore(File dataDir) Creates a new persistent MemoryStore. |
Method Summary | |
protected Statement | addStatement(Resource subj, URI pred, Value obj, Resource context, boolean explicit) | protected void | cancelSyncTask() | protected void | cancelSyncTimer() | protected void | cleanSnapshots() Removes statements from old snapshots from the main statement list and
resets the snapshot to 1 for the rest of the statements. | protected void | commit() | protected CloseableIteration<MemStatement, X> | createStatementIterator(Class<X> excClass, Resource subj, URI pred, Value obj, boolean explicitOnly, int snapshot, ReadMode readMode, Resource... contexts) Creates a StatementIterator that contains the statements matching the
specified pattern of subject, predicate, object, context. | protected SailConnection | getConnectionInternal() | protected int | getCurrentSnapshot() | protected MemNamespaceStore | getNamespaceStore() | public boolean | getPersist() | protected MemStatementList | getStatements() | protected Lock | getStatementsReadLock() | public long | getSyncDelay() Gets the currently configured sync delay. | protected Lock | getTransactionLock() | public MemValueFactory | getValueFactory() | public void | initialize() Initializes this repository. | final protected boolean | isInitialized() Checks whether the Sail has been initialized. | public boolean | isWritable() Checks whether this Sail object is writable. | protected boolean | removeStatement(MemStatement st, boolean explicit) | protected void | rollback() | protected void | scheduleSnapshotCleanup() | protected void | scheduleSyncTask() | public void | setDataDir(File dataDir) | public void | setPersist(boolean persist) | public void | setSyncDelay(long syncDelay) Sets the time (in milliseconds) to wait after a transaction was commited
before writing the changed data to file. | protected void | shutDownInternal() | protected int | size() | protected void | startTransaction() | public void | sync() Synchronizes the contents of this repository with the data that is stored
on disk. |
DATA_FILE_NAME | final protected static String DATA_FILE_NAME(Code) | | |
MemoryStore | public MemoryStore()(Code) | | Creates a new MemoryStore.
|
MemoryStore | public MemoryStore(File dataDir)(Code) | | Creates a new persistent MemoryStore. If the specified data directory
contains an existing store, its contents will be restored upon
initialization.
Parameters: dataDir - the data directory to be used for persistence. |
cancelSyncTask | protected void cancelSyncTask()(Code) | | |
cancelSyncTimer | protected void cancelSyncTimer()(Code) | | |
cleanSnapshots | protected void cleanSnapshots() throws InterruptedException(Code) | | Removes statements from old snapshots from the main statement list and
resets the snapshot to 1 for the rest of the statements.
throws: InterruptedException - |
createStatementIterator | protected CloseableIteration<MemStatement, X> createStatementIterator(Class<X> excClass, Resource subj, URI pred, Value obj, boolean explicitOnly, int snapshot, ReadMode readMode, Resource... contexts)(Code) | | Creates a StatementIterator that contains the statements matching the
specified pattern of subject, predicate, object, context. Inferred
statements are excluded when explicitOnly is set to
true. Statements from the null context are excluded when
namedContextsOnly is set to true. The returned
StatementIterator will assume the specified read mode.
|
getCurrentSnapshot | protected int getCurrentSnapshot()(Code) | | |
getPersist | public boolean getPersist()(Code) | | |
getSyncDelay | public long getSyncDelay()(Code) | | Gets the currently configured sync delay.
syncDelay The sync delay in milliseconds. See Also: MemoryStore.setSyncDelay |
initialize | public void initialize() throws SailException(Code) | | Initializes this repository. If a persistence file is defined for the
store, the contents will be restored.
throws: SailException - when initialization of the store failed. |
isInitialized | final protected boolean isInitialized()(Code) | | Checks whether the Sail has been initialized.
true if the Sail has been initialized, falseotherwise. |
isWritable | public boolean isWritable()(Code) | | Checks whether this Sail object is writable. A MemoryStore is not writable
if a read-only data file is used.
|
scheduleSnapshotCleanup | protected void scheduleSnapshotCleanup()(Code) | | |
setDataDir | public void setDataDir(File dataDir)(Code) | | |
setPersist | public void setPersist(boolean persist)(Code) | | |
setSyncDelay | public void setSyncDelay(long syncDelay)(Code) | | Sets the time (in milliseconds) to wait after a transaction was commited
before writing the changed data to file. Setting this variable to 0 will
force a file sync immediately after each commit. A negative value will
deactivate file synchronization until the Sail is shut down. A positive
value will postpone the synchronization for at least that amount of
milliseconds. If in the meantime a new transaction is started, the file
synchronization will be rescheduled to wait for another syncDelay
ms. This way, bursts of transaction events can be combined in one file
sync.
The default value for this parameter is 0 (immediate
synchronization).
Parameters: syncDelay - The sync delay in milliseconds. |
size | protected int size()(Code) | | |
sync | public void sync() throws SailException(Code) | | Synchronizes the contents of this repository with the data that is stored
on disk. Data will only be written when the contents of the repository and
data in the file are out of sync.
|
|
|