public abstract class AbstractPersistenceEnvironment extends Base implements com.oracle.datagrid.persistence.PersistenceEnvironment<ReadBuffer>, PersistenceEnvironmentInfo
Modifier and Type | Class and Description |
---|---|
static class |
AbstractPersistenceEnvironment.DefaultFailureContinuation
Continuation implementation that accepts a Throwable and throws a
PersistenceException.
|
Base.LoggingWriter, Base.StackFrame
Modifier and Type | Field and Description |
---|---|
protected static String |
DELETED_PREFIX
A filename prefix for deleted snapshots used to handle concurrent
deletions.
|
protected AtomicInteger |
f_atomicRemovesCounter
An atomic counter counter used during
snapshot removal . |
protected File |
f_fileActive
The data directory of the active persistence manager.
|
protected File |
f_fileSnapshot
The snapshot directory.
|
protected File |
f_fileTrash
An optional trash directory.
|
protected Map<String,AbstractPersistenceManager> |
f_mapSnapshots
The map of snapshots, keyed by snapshot name.
|
protected AbstractPersistenceManager<?> |
m_managerActive
This singleton active manager.
|
protected com.tangosol.internal.util.DaemonPool |
m_pool
An optional DaemonPool used to execute tasks.
|
protected static String[] |
NO_STRINGS
An empty String array (by definition immutable).
|
Constructor and Description |
---|
AbstractPersistenceEnvironment(File fileActive,
File fileSnapshot,
File fileTrash)
Create a new AbstractPersistenceEnvironment that manages a singleton
AbstractPersistenceManager with the specified data directory and that
creates, opens, and deletes snapshots under the specified snapshot
directory.
|
Modifier and Type | Method and Description |
---|---|
protected Path |
createHiddenSnapshotDirectory(String sPrefix)
Return a Path to a hidden directory within the snapshot directory that
does not exist.
|
com.oracle.coherence.persistence.PersistenceManager<ReadBuffer> |
createSnapshot(String sSnapshot,
com.oracle.coherence.persistence.PersistenceManager<ReadBuffer> manager)
Create a PersistenceManager used to manage the snapshot with the
specified identifier.
|
protected abstract AbstractPersistenceManager |
createSnapshotInternal(File fileSnapshot,
String sSnapshot,
com.oracle.coherence.persistence.PersistenceManager<ReadBuffer> manager)
Create a snapshot with the specified identifier.
|
protected com.oracle.coherence.persistence.PersistenceException |
ensurePersistenceException(Throwable eCause)
Return a PersistenceException with the given cause.
|
protected com.oracle.coherence.persistence.PersistenceException |
ensurePersistenceException(Throwable eCause,
String sMessage)
Return a PersistenceException with the given cause and detail message.
|
com.tangosol.internal.util.DaemonPool |
getDaemonPool()
Return the optional DaemonPool used to execute tasks.
|
File |
getPersistenceActiveDirectory()
Return the directory under which cached data is actively persisted
by the environment.
|
long |
getPersistenceActiveSpaceUsed()
Return the total size in bytes used by the persistence layer to
persist mutating cache operations.
|
File |
getPersistenceSnapshotDirectory()
Return the directory under which copies of cached data are persisted
by the environment.
|
File |
getPersistenceTrashDirectory()
Return the directory under which potentially corrupted persisted data
is stored by the environment.
|
String[] |
listSnapshots()
Return the identifiers of the snapshots known to this environment.
|
protected void |
onReleased(AbstractPersistenceManager manager)
Called by the specified manager when it has been released.
|
com.oracle.coherence.persistence.PersistenceManager<ReadBuffer> |
openActive()
Open and return the singleton active PersistenceManager.
|
protected abstract AbstractPersistenceManager |
openActiveInternal()
Open the active manager.
|
com.oracle.coherence.persistence.PersistenceManager<ReadBuffer> |
openSnapshot(String sSnapshot)
Open a PersistenceManager used to access the snapshot with the
specified identifier.
|
protected abstract AbstractPersistenceManager |
openSnapshotInternal(File fileSnapshot,
String sSnapshot)
Open the snapshot with the specified identifier.
|
void |
release()
Release all resources held by this environment.
|
boolean |
removeSnapshot(String sSnapshot)
Remove the persistent artifacts associated with the snapshot with the
specified identifier.
|
protected boolean |
removeSnapshotInternal(File fileSnapshot,
String sSnapshot)
Remove the snapshot with the specified identifier.
|
void |
setDaemonPool(com.tangosol.internal.util.DaemonPool pool)
Configure the DaemonPool used to execute tasks.
|
String |
toString()
Return a human readable description of this AbstractPersistenceManager.
|
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
protected static final String[] NO_STRINGS
protected static final String DELETED_PREFIX
protected final AtomicInteger f_atomicRemovesCounter
snapshot removal
.protected final File f_fileActive
protected final File f_fileSnapshot
protected final File f_fileTrash
protected AbstractPersistenceManager<?> m_managerActive
protected final Map<String,AbstractPersistenceManager> f_mapSnapshots
protected com.tangosol.internal.util.DaemonPool m_pool
public AbstractPersistenceEnvironment(File fileActive, File fileSnapshot, File fileTrash) throws IOException
fileActive
- the data directory of the singleton active
manager or null if an active manager shouldn't
be maintained by this environmentfileSnapshot
- the snapshot directoryfileTrash
- an optional trash directory used for "safe"
deletesIOException
- if the data directory could not be createdIllegalArgumentException
- if the data, snapshot, and trash
directories are not uniquepublic com.oracle.coherence.persistence.PersistenceManager<ReadBuffer> openActive()
openActive
in interface com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer>
public com.oracle.coherence.persistence.PersistenceManager<ReadBuffer> openSnapshot(String sSnapshot)
openSnapshot
in interface com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer>
sSnapshot
- the snapshot identifierpublic com.oracle.coherence.persistence.PersistenceManager<ReadBuffer> createSnapshot(String sSnapshot, com.oracle.coherence.persistence.PersistenceManager<ReadBuffer> manager)
createSnapshot
in interface com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer>
sSnapshot
- the snapshot identifiermanager
- the optional PersistenceManager to create a snapshot
of; if null, an empty snapshot will be createdpublic boolean removeSnapshot(String sSnapshot)
removeSnapshot
in interface com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer>
sSnapshot
- the snapshot identifierpublic String[] listSnapshots()
listSnapshots
in interface com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer>
public void release()
release
in interface com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer>
public File getPersistenceActiveDirectory()
getPersistenceActiveDirectory
in interface PersistenceEnvironmentInfo
public File getPersistenceSnapshotDirectory()
getPersistenceSnapshotDirectory
in interface PersistenceEnvironmentInfo
public File getPersistenceTrashDirectory()
getPersistenceTrashDirectory
in interface PersistenceEnvironmentInfo
public long getPersistenceActiveSpaceUsed()
getPersistenceActiveSpaceUsed
in interface PersistenceEnvironmentInfo
protected com.oracle.coherence.persistence.PersistenceException ensurePersistenceException(Throwable eCause)
eCause
- an optional causeprotected com.oracle.coherence.persistence.PersistenceException ensurePersistenceException(Throwable eCause, String sMessage)
eCause
- an optional causesMessage
- an optional detail messageprotected void onReleased(AbstractPersistenceManager manager)
manager
- the manager that was releasedprotected abstract AbstractPersistenceManager openActiveInternal()
Note: this method is guaranteed to only be called by a thread that holds a monitor on this environment.
com.oracle.coherence.persistence.PersistenceException
- if a general persistence error occursprotected abstract AbstractPersistenceManager openSnapshotInternal(File fileSnapshot, String sSnapshot)
Note: this method is guaranteed to only be called by a thread that holds a monitor on this environment.
fileSnapshot
- the directory of the snapshotsSnapshot
- the snapshot identifiercom.oracle.coherence.persistence.PersistenceException
- if a general persistence error occursprotected abstract AbstractPersistenceManager createSnapshotInternal(File fileSnapshot, String sSnapshot, com.oracle.coherence.persistence.PersistenceManager<ReadBuffer> manager)
Note: this method is guaranteed to only be called by a thread that holds a monitor on this environment.
fileSnapshot
- the directory of the snapshotsSnapshot
- the snapshot identifiermanager
- the optional manager to create a snapshot of; if
null, an empty snapshot will be createdcom.oracle.coherence.persistence.PersistenceException
- if a general persistence error occursIllegalArgumentException
- if the specified manager is
incompatible with this environmentprotected boolean removeSnapshotInternal(File fileSnapshot, String sSnapshot)
Note: this method is guaranteed to only be called by a thread that holds a monitor on this environment.
fileSnapshot
- the directory of the snapshotsSnapshot
- the snapshot identifiercom.oracle.coherence.persistence.PersistenceException
- if a general persistence error occursprotected Path createHiddenSnapshotDirectory(String sPrefix)
sPrefix
- a prefix for the directory namepublic String toString()
public com.tangosol.internal.util.DaemonPool getDaemonPool()
public void setDaemonPool(com.tangosol.internal.util.DaemonPool pool)
pool
- the DaemonPool