PS
- the type of AbstractPersistentStorepublic abstract class AbstractPersistenceManager<PS extends AbstractPersistenceManager.AbstractPersistentStore> extends Base implements com.oracle.datagrid.persistence.PersistenceManager<ReadBuffer>
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractPersistenceManager.AbstractPersistenceSnapshotTools
Abstract implementation of PersistenceTools which can be extended to support local snapshot operations for specific implementations.
|
class |
AbstractPersistenceManager.AbstractPersistentStore
Abstract implementation of a ReadBuffer-based PersistentStore.
|
class |
AbstractPersistenceManager.Task
Runnable extension that adds the ability to notify the task that it has been canceled.
|
Base.LoggingWriter, Base.StackFrame
Modifier and Type | Field and Description |
---|---|
protected File |
f_dirActive
The directory used to store persisted data.
|
protected File |
f_dirLock
The directory used to store lock files (to protect against multi-process file system clean up).
|
protected File |
f_dirTrash
The directory used to store "safe-deleted" data.
|
protected Map<String,PS> |
f_mapStores
Map of open AbstractPersistentStore instances.
|
protected Set<AbstractPersistenceManager.Task> |
f_setTasks
Set of outstanding tasks.
|
protected String |
f_sName
The name of this AbstractPersistenceManager.
|
protected AbstractPersistenceEnvironment |
m_env
The environment that created this AbstractPersistenceManager.
|
protected com.tangosol.internal.util.DaemonPool |
m_pool
An optional DaemonPool used to execute tasks.
|
protected static long[] |
NO_LONGS
An empty long array (by definition immutable).
|
protected static String[] |
NO_STRINGS
An empty String array (by definition immutable).
|
Constructor and Description |
---|
AbstractPersistenceManager(File fileData, File fileTrash, String sName)
Create a new AbstractPersistenceManager.
|
Modifier and Type | Method and Description |
---|---|
void |
close(String sId)
Close the associated PersistentStore and release exclusive access to the associated resources.
|
boolean |
delete(String sId, boolean fSafe)
Remove the PersistentStore associated with the specified identifier.
|
protected com.oracle.datagrid.persistence.PersistenceException |
ensurePersistenceException(Throwable eCause)
Return a PersistenceException with the given cause.
|
protected com.oracle.datagrid.persistence.PersistenceException |
ensurePersistenceException(Throwable eCause, String sMessage)
Return a PersistenceException with the given cause and detail message.
|
protected void |
executeTask(AbstractPersistenceManager.Task task)
Execute the specified task with the calling thread.
|
protected void |
executeTaskExclusive(AbstractPersistenceManager.Task task)
Execute the specified task with the calling thread.
|
com.tangosol.internal.util.DaemonPool |
getDaemonPool()
Return the optional DaemonPool used to execute tasks.
|
File |
getDataDirectory()
Return the directory used to store persisted data.
|
protected abstract int |
getImplVersion()
Return the implementation version of this manager.
|
protected File |
getLockDirectory()
Return the directory used to store lock files.
|
protected Properties |
getMetadata()
Return metadata for this manager.
|
String |
getName()
Return the name of this manager.
|
protected AbstractPersistenceEnvironment |
getPersistenceEnvironment()
Return the environment that created this manager.
|
com.oracle.datagrid.persistence.PersistenceTools |
getPersistenceTools()
Return an instance of
PersistenceTools allowing offline operations to be performed against the associated PersistenceManager and appropriate PersistentStore . |
Map<String,PS> |
getPersistentStoreMap()
Return the map of open PersistentStore instances keyed by their identifiers.
|
protected abstract String |
getStorageFormat()
Return the storage format used by this manager.
|
protected abstract int |
getStorageVersion()
Return the version of the storage format used by this manager.
|
File |
getTrashDirectory()
Return the directory used to store "safe-deleted" persisted data.
|
protected abstract com.oracle.datagrid.persistence.PersistenceTools |
instantiatePersistenceTools(com.oracle.datagrid.persistence.OfflinePersistenceInfo info)
Factory method to create a
PersistenceTools implementation. |
protected abstract PS |
instantiatePersistentStore(String sId)
Factory method for PersistentStore implementations managed by this PersistenceManager.
|
protected boolean |
isMetadataCompatible(Properties prop)
Determine if the given metadata is compatible with this manager.
|
protected boolean |
isMetadataComplete(Properties prop)
Determine if the given metadata in the
Properties is complete. |
String[] |
list()
Return the identifiers of the PersistentStores known to this manager.
|
String[] |
listOpen()
Return the identifiers of PersistentStores that are currently open.
|
com.oracle.datagrid.persistence.PersistentStore<ReadBuffer> |
open(String sId)
Open or create a PersistentStore associated with the specified identifier.
|
void |
read(String sId, InputStream in)
Read the PersistenceStore associated with the specified identifier from the given input stream, making it available to this manager.
|
protected Properties |
readMetadata(File fileDir)
Read persistence metadata from the specified directory.
|
void |
release()
Release all resources held by this manager.
|
void |
setDaemonPool(com.tangosol.internal.util.DaemonPool pool)
Configure the DaemonPool used to execute tasks.
|
protected void |
setPersistenceEnvironment(AbstractPersistenceEnvironment env)
Configure the environment that created this manager.
|
protected void |
submitTask(AbstractPersistenceManager.Task task)
Submit the given task for execution by the daemon pool.
|
String |
toString()
Return a human readable description of this AbstractPersistenceManager.
|
String |
validatePersistentStoreId(String sId)
Validate that the given identifier can be used for a persistent store.
|
void |
write(String sId, OutputStream out)
Write the PersistentStore associated with the specified identifier to the given output stream.
|
protected void |
writeMetadata(File fileDir)
Write persistence metadata for this manager to the specified directory.
|
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, 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, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, 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 long[] NO_LONGS
protected static final String[] NO_STRINGS
protected final File f_dirActive
protected final File f_dirTrash
protected final File f_dirLock
protected final String f_sName
protected final Map<String,PS extends AbstractPersistenceManager.AbstractPersistentStore> f_mapStores
protected final Set<AbstractPersistenceManager.Task> f_setTasks
protected AbstractPersistenceEnvironment m_env
protected com.tangosol.internal.util.DaemonPool m_pool
public AbstractPersistenceManager(File fileData, File fileTrash, String sName) throws IOException
fileData
- the directory used to store persisted datafileTrash
- an optional trash directorysName
- an optional name to give the new managerIOException
- on error creating the data or trash directorypublic String getName()
getName
in interface com.oracle.datagrid.persistence.PersistenceManager<ReadBuffer>
public com.oracle.datagrid.persistence.PersistentStore<ReadBuffer> open(String sId)
open
in interface com.oracle.datagrid.persistence.PersistenceManager<ReadBuffer>
sId
- a unique identifier for the storepublic void close(String sId)
close
in interface com.oracle.datagrid.persistence.PersistenceManager<ReadBuffer>
sId
- a unique identifier of the store to closepublic boolean delete(String sId, boolean fSafe)
delete
in interface com.oracle.datagrid.persistence.PersistenceManager<ReadBuffer>
sId
- a unique identifier of the store to removefSafe
- if true, remove the store by moving it to a restorable location (if possible) rather than deleting itpublic String[] list()
list
in interface com.oracle.datagrid.persistence.PersistenceManager<ReadBuffer>
public String[] listOpen()
listOpen
in interface com.oracle.datagrid.persistence.PersistenceManager<ReadBuffer>
public void read(String sId, InputStream in) throws IOException
read
in interface com.oracle.datagrid.persistence.PersistenceManager<ReadBuffer>
sId
- a unique identifier of the store to readin
- the stream to read fromIOException
- if an error occurred while reading from the streampublic void write(String sId, OutputStream out) throws IOException
write
in interface com.oracle.datagrid.persistence.PersistenceManager<ReadBuffer>
sId
- a unique identifier of the store to writeout
- the stream to write toIOException
- if an error occurred while writing to the streampublic void release()
release
in interface com.oracle.datagrid.persistence.PersistenceManager<ReadBuffer>
public com.oracle.datagrid.persistence.PersistenceTools getPersistenceTools()
com.oracle.datagrid.persistence.PersistenceManager
PersistenceTools
allowing offline operations to be performed against the associated PersistenceManager and appropriate PersistentStore
.getPersistenceTools
in interface com.oracle.datagrid.persistence.PersistenceManager<ReadBuffer>
public String toString()
protected Properties getMetadata()
protected Properties readMetadata(File fileDir) throws IOException
fileDir
- the directory to read metadata fromIOException
- on error reading the metadata fileprotected void writeMetadata(File fileDir) throws IOException
fileDir
- the directory to write metadata toIOException
- on error writing the metadata fileprotected boolean isMetadataComplete(Properties prop)
Properties
is complete.prop
- the metadata to analyzeprotected boolean isMetadataCompatible(Properties prop)
prop
- the metadata to analyzeprotected abstract int getImplVersion()
protected abstract String getStorageFormat()
protected abstract int getStorageVersion()
protected com.oracle.datagrid.persistence.PersistenceException ensurePersistenceException(Throwable eCause)
eCause
- an optional causeprotected com.oracle.datagrid.persistence.PersistenceException ensurePersistenceException(Throwable eCause, String sMessage)
eCause
- an optional causesMessage
- an optional detail messagepublic String validatePersistentStoreId(String sId)
sId
- the identifier to checkprotected void submitTask(AbstractPersistenceManager.Task task)
task
- the task to submitprotected void executeTask(AbstractPersistenceManager.Task task)
task
- the task to executeprotected void executeTaskExclusive(AbstractPersistenceManager.Task task)
task
- the task to executeprotected abstract PS instantiatePersistentStore(String sId)
sId
- the identifier of the store to createprotected abstract com.oracle.datagrid.persistence.PersistenceTools instantiatePersistenceTools(com.oracle.datagrid.persistence.OfflinePersistenceInfo info)
PersistenceTools
implementation.info
- the OfflinePersistenceInfo
relevant to the PersistenceToolspublic com.tangosol.internal.util.DaemonPool getDaemonPool()
public void setDaemonPool(com.tangosol.internal.util.DaemonPool pool)
pool
- the DaemonPoolpublic File getDataDirectory()
public File getTrashDirectory()
protected File getLockDirectory()
protected AbstractPersistenceEnvironment getPersistenceEnvironment()
protected void setPersistenceEnvironment(AbstractPersistenceEnvironment env)
env
- the environment that created this managerpublic Map<String,PS> getPersistentStoreMap()
Note: The return map is "live". Any attempt to access or mutate it should be done while holding a monitor on this manager.