Note that data store deletion may happen inside one of two different methods;
either in shutdown or in init. This is due to the current
implementation and the fact that dropping a database is done through the
file IO interface by deleting the service root. As the deletion then becomes
a two step process, someone else may boot the database again before the
reference to the store has been removed. To avoid this, the
init-method will never initialize with a store scheduled for
deletion. I have only seen this issue in heavily loaded multithreaded
environments (2 CPUs/cores should be enough to reproduce).
| Modifier and Type | Field and Description |
|---|---|
| private String | canonicalName
The canonical (unique) name of the database (absolute path). |
| private static final Map | DATABASES
References to the databases created / existing. |
| private StorageFile | dataDirectory
The data directory of the database. |
| private DataStore | dbData
The data store used for the database. |
| private static final DataStore | DUMMY_STORE
Dummy store used to carry out frequent operations that don't require a "proper store", for instance getting the canonical name of the data store. |
| private StorageFile | tempDir
The temporary directory for the database (absolute path). |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public StorageFile | Returns: A handle to the temporary file.requested prefix for the file name prefix, String requested suffix for the file name, if suffix)null then
.tmp will be usedImplements org. Creates a handle to a temporary file. |
| private void | dbDropCleanupInDummy(String
absolute path of the dropped database dbPath)Cleans up the internal dummy data store after a database has been dropped. |
| public String | getCanonicalName()
Implements org. Get the canonical name of the database. |
| public char | Returns: PathUtil.SEPImplements org. Returns the path separator used by this storage factory. |
| public int | |
| public StorageFile | Returns: AStorageFile-object representing the temp directory.Implements org. Returns the temporary directory for this storage factory instance. |
| public void | init(String
the value of home, String system.home for this storage factorythe name of the database, all relative pathnames are
relative to this name databaseName, String ignored tempDirNameIgnored, String used to determine when the temporary directory can be
created, but not to name the temporary directory itself uniqueName)Implements org. Initializes the storage factory instance by setting up a temporary directory, the database directory and checking if the database being named already exists. |
| public boolean | Returns: trueImplements org. The service is fast and supports random access. |
| public boolean | Returns: falseImplements org. The service supports writes. |
| public StorageFile | Returns: A path handle.the path of the file or directory path)Implements org. Returns a handle to the specific storage file. |
| public StorageFile | Returns: A path handle.the name of the parent directory directoryName, String the name of the file fileName)Implements org. Returns a handle to the specified storage file. |
| public StorageFile | Returns: A path handle.the name of the parent directory directoryName, String the name of the file fileName)Implements org. Returns a handle to the specified storage file. |
| private String | Returns: A path.parent directory, if dir, String null the dataDirectory
will be usedthe file name ( file)null not allowed)Returns a normalized absolute path. |
| private String | Returns: A path.path, if path)null the dataDirectory will be usedReturns a normalized absolute path. |
| public void | setCanonicalName(String
uniquely identifiable name for this database name)Implements org. Set the canonicalName. |
| public void | shutdown()
Implements org. Normally does nothing, but if the database is in a state such that it should be deleted this will happen here. |
| public boolean | Returns: trueImplements org. The service supports random access. |
| public boolean | supportsWriteSync()
Implements org. This method tests whether the StorageRandomAccessFile "rws" and "rwd" modes are implemented. |
| public void | sync(OutputStream
ignored stream, boolean ignored metaData)Implements org. The sync method is a no-op for this storage factory. |
| canonicalName | back to summary |
|---|---|
| private String canonicalName The canonical (unique) name of the database (absolute path). | |
| DATABASES | back to summary |
|---|---|
| private static final Map<String, DataStore> DATABASES References to the databases created / existing. | |
| dataDirectory | back to summary |
|---|---|
| private StorageFile dataDirectory The data directory of the database. | |
| dbData | back to summary |
|---|---|
| private DataStore dbData The data store used for the database. | |
| DUMMY_STORE | back to summary |
|---|---|
| private static final DataStore DUMMY_STORE Dummy store used to carry out frequent operations that don't require a "proper store", for instance getting the canonical name of the data store. | |
| tempDir | back to summary |
|---|---|
| private StorageFile tempDir The temporary directory for the database (absolute path). | |
| VFMemoryStorageFactory | back to summary |
|---|---|
| public VFMemoryStorageFactory() Creates a new, uninitialized instance of the storage factory.
To initialize the instance,
| |
| createTemporaryFile | back to summary |
|---|---|
| public StorageFile createTemporaryFile(String prefix, String suffix) Implements org. Creates a handle to a temporary file.
| |
| dbDropCleanupInDummy | back to summary |
|---|---|
| private void dbDropCleanupInDummy(String dbPath) Cleans up the internal dummy data store after a database has been dropped.
| |
| getCanonicalName | back to summary |
|---|---|
| public String getCanonicalName() Implements org. Doc from org. Get the canonical name of the database. This is a name that uniquely identifies it. It is system dependent. The normal, disk based implementation uses method java.io.File.getCanonicalPath on the directory holding the database to construct the canonical name.
| |
| getSeparator | back to summary |
|---|---|
| public char getSeparator() Implements org. Returns the path separator used by this storage factory.
| |
| getStorageFactoryVersion | back to summary |
|---|---|
| public int getStorageFactoryVersion() Implements org.
| |
| getTempDir | back to summary |
|---|---|
| public StorageFile getTempDir() Implements org. Returns the temporary directory for this storage factory instance.
| |
| init | back to summary |
|---|---|
| public void init(String home, String databaseName, String tempDirNameIgnored, String uniqueName) throws IOException Implements org. Initializes the storage factory instance by setting up a temporary directory, the database directory and checking if the database being named already exists.
| |
| isFast | back to summary |
|---|---|
| public boolean isFast() Implements org. The service is fast and supports random access.
| |
| isReadOnlyDatabase | back to summary |
|---|---|
| public boolean isReadOnlyDatabase() Implements org. The service supports writes.
| |
| newStorageFile | back to summary |
|---|---|
| public StorageFile newStorageFile(String path) Implements org. Returns a handle to the specific storage file.
| |
| newStorageFile | back to summary |
|---|---|
| public StorageFile newStorageFile(String directoryName, String fileName) Implements org. Returns a handle to the specified storage file.
| |
| newStorageFile | back to summary |
|---|---|
| public StorageFile newStorageFile(StorageFile directoryName, String fileName) Implements org. Returns a handle to the specified storage file.
| |
| normalizePath | back to summary |
|---|---|
| private String normalizePath(String dir, String file) Returns a normalized absolute path.
| |
| normalizePath | back to summary |
|---|---|
| private String normalizePath(String path) Returns a normalized absolute path. | |
| setCanonicalName | back to summary |
|---|---|
| public void setCanonicalName(String name) Implements org. Set the canonicalName. May need adjustment due to DERBY-5096
| |
| shutdown | back to summary |
|---|---|
| public void shutdown() Implements org. Normally does nothing, but if the database is in a state such that it should be deleted this will happen here. | |
| supportsRandomAccess | back to summary |
|---|---|
| public boolean supportsRandomAccess() Implements org. The service supports random access.
| |
| supportsWriteSync | back to summary |
|---|---|
| public boolean supportsWriteSync() Implements org. Doc from org. This method tests whether the StorageRandomAccessFile "rws" and "rwd" modes are implemented. If the "rws" and "rwd" modes are supported then the database engine will conclude that the write methods of "rws"/"rwd" mode StorageRandomAccessFiles are slow but the sync method is fast and optimize accordingly.
| |
| sync | back to summary |
|---|---|
| public void sync(OutputStream stream, boolean metaData) Implements org. The sync method is a no-op for this storage factory.
| |