Package com.db4o.internal
Class TransportObjectContainer
- java.lang.Object
-
- com.db4o.internal.ObjectContainerBase
-
- com.db4o.internal.ExternalObjectContainer
-
- com.db4o.internal.LocalObjectContainer
-
- com.db4o.internal.TransportObjectContainer
-
- All Implemented Interfaces:
EmbeddedObjectContainer
,ExtObjectContainer
,InternalObjectContainer
,ObjectContainerSpec
,Internal4
,ObjectContainer
,TransientClass
public class TransportObjectContainer extends LocalObjectContainer
no reading no writing no updates no weak references navigation by ID only both sides need synchronised ClassCollections and MetaInformationCaches
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TransportObjectContainer.KnownObjectIdentity
-
Field Summary
-
Fields inherited from class com.db4o.internal.LocalObjectContainer
_fileHeader, _pointerIo
-
Fields inherited from class com.db4o.internal.ObjectContainerBase
_blockConverter, _classCollection, _config, _handlers, _lock, _timeStampIdGenerator, _transaction
-
-
Constructor Summary
Constructors Constructor Description TransportObjectContainer(ObjectContainerBase parent, MemoryBin memoryFile)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Slot
allocateSlot(int length)
void
backup(Storage targetStorage, java.lang.String path)
backs up a database file of an open ObjectContainer.void
backupSync(Storage targetStorage, java.lang.String path)
backs up a database file of an open ObjectContainer.byte
blockSize()
void
blockSize(int size)
protected void
checkReadOnly()
ClassMetadata
classMetadataForID(int id)
void
closeTransaction(Transaction transaction, boolean isSystemTransaction, boolean rollbackOnClose)
java.lang.Runnable
commitHook()
int
converterVersion()
protected void
createIdSystem()
ReferenceSystem
createReferenceSystem()
long
currentVersion()
Db4oType
db4oTypeStored(Transaction a_trans, java.lang.Object a_object)
allows special handling for all Db4oType objects.void
deferredOpen()
boolean
dispatchsEvents()
protected void
dropReferences()
protected void
fatalStorageShutdown()
long
fileLength()
java.lang.String
fileName()
protected void
finalize()
void
free(int a_address, int a_length)
void
free(Slot slot)
long
generateTimeStampId()
java.lang.Object
getByID2(Transaction ta, int id)
protected void
handleExceptionOnClose(java.lang.Exception exc)
protected boolean
hasShutDownHook()
Db4oDatabase
identity()
returns the Db4oDatabase object for this ObjectContainer.protected void
initalizeWeakReferenceSupport()
protected void
initialize1(Configuration config)
protected void
initializeClassMetadataRepository()
protected void
initializePostOpenExcludingTransportObjectContainer()
protected boolean
isValidPointer(int id)
boolean
maintainsIndices()
protected long
maximumDatabaseFileSize(Config4Impl configImpl)
boolean
needsLockFileThread()
Transaction
newTransaction(Transaction parentTransaction, ReferenceSystem referenceSystem, boolean isSystemTransaction)
protected void
openImpl()
void
overwriteDeletedBytes(int a_address, int a_length)
ClassMetadata
produceClassMetadata(ReflectClass claxx)
void
raiseCommitTimestamp(long a_minimumVersion)
void
readBytes(byte[] bytes, int address, int length)
void
readBytes(byte[] bytes, int address, int addressOffset, int length)
void
reserve(int byteCount)
void
shutdown()
protected void
shutdownDataStorage()
int
storeInternal(Transaction trans, java.lang.Object obj, UpdateDepth depth, boolean checkJustSet)
void
syncFiles()
void
syncFiles(java.lang.Runnable runnable)
void
writeBytes(ByteArrayBuffer buffer, int address, int addressOffset)
void
writeHeader(boolean startFileLockingThread, boolean shuttingDown)
-
Methods inherited from class com.db4o.internal.LocalObjectContainer
allocatePointerSlot, allocateSafeSlot, allocateSlotForNewUserObject, allocateSlotForUserObjectUpdate, appendBytes, blockSizeReadFromFile, classOnlyQuery, close2, closeIdSystem, commit1, commitTransaction, createBTreeClassIndex, debugReadPointerSlot, defaultToString, delete4, doFinalize, executeQuery, freespaceManager, from, generateNewIdentity, getAll, getFileHeader, getIDsForClass, idForNewUserObject, idSystem, installDebugFreespaceManager, instanceCount, isDeleted, localSystemTransaction, newEventRegistry, newQueryResult, newQueryResult, newTransactionalIdSystem, openSession, overwriteDeletedBlockedSlot, queryAllObjects, readBufferById, readBufferById, readBufferBySlot, readPointerSlot, readSlotBuffers, readStatefulBufferById, readStatefulBufferById, readStatefulBufferBySlot, releaseSemaphore, releaseSemaphore, releaseSemaphores, rollback1, setDirtyInSystemTransaction, setIdentity, setNextTimeStampId, setRegularEndAddress, setSemaphore, setSemaphore, setServer, systemData, systemInfo, writeDirtyClassMetadata, writeEncrypt, writeNew, writePointer, writeTransactionPointer, writeUpdate
-
Methods inherited from class com.db4o.internal.ExternalObjectContainer
activate, activate, bind, commit, deactivate, deactivate, delete, descend, ext, getByID, getByUUID, getID, getObjectInfo, inCallback, isActive, isCached, isStored, peekPersisted, purge, query, query, query, query, queryByExample, refresh, rollback, store, store, storedClass, storedClasses
-
Methods inherited from class com.db4o.internal.ObjectContainerBase
activate, activate, activationContextFor, activationDepthProvider, applyRenames, asTopLevelCall, backup, backupSync, bind, bind2, blockConverter, callbacks, callbacks, checkClosed, checkStillToSet, checkTransaction, checkTransaction, classCollection, classMetadataForName, classMetadataForObject, classMetadataForReflectClass, classMetadataIdForName, close, closeSystemTransaction, closeUserTransaction, commit, commitTimestampIndex, config, configImpl, configure, container, createBlockConverter, createClassMetadata, createStatefulBuffer, createStringIO, deactivate, deactivate, decryptedBufferByAddress, defaultActivationDepth, delete, delete1, delete2, deleteByID, detectSchemaChanges, environment, fatalShutdown, flagAsHandled, generateTransactionTimestamp, getActivatedObjectFromCache, getByID, getByUUID, getHardObjectReferenceById, getHardReferenceBySignature, getID, getNativeQueryHandler, getObjectInfo, handledInCurrentTopLevelCall, handlers, initializeTransactions, isCached, isClient, isClosed, isStored, knownClasses, lock, logMsg, needsUpdate, newSystemTransaction, newUserTransaction, newWeakReference, open, peekPersisted, peekPersisted, peekReference, purge, purge, query, query, query, query, query, queryByExample, rawBufferByAddress, readActivatedObjectNotInCache, readWriterByAddress, referenceSystemRegistry, reflector, refresh, refreshInternal, replaceClassMetadataRepository, replicationCallState, rollback, send, showInternalClasses, shutdownObjectContainer, stackDepth, stackDepth, stillToActivate, stillToDeactivate, stopSession, store, store, store2, storeAfterReplication, storeAll, storeAll, storeByNewReplication, storedClass, storedClasses, storeInternal, stringIO, syncExec, systemTransaction, threadPool, topLevelCallId, topLevelCallId, toString, transaction, tryGetByID, typeHandlerForClass, typeHandlerForClassMetadataID, updateDepthProvider, useDefaultTransactionTimestamp, uUIDIndex, version, versionIndex, withEnvironment, withTransaction
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.db4o.EmbeddedObjectContainer
backup
-
Methods inherited from interface com.db4o.ext.ExtObjectContainer
activate, backup, backupSync, bind, configure, deactivate, descend, getByID, getByUUID, getID, getObjectInfo, isActive, isCached, isClosed, isStored, knownClasses, lock, peekPersisted, purge, purge, reflector, refresh, store, storedClass, storedClasses, version
-
Methods inherited from interface com.db4o.internal.InternalObjectContainer
callbacks, callbacks, classMetadataForName, classMetadataForReflectClass, configImpl, container, getNativeQueryHandler, handlers, inCallback, isClient, storeAll, syncExec, transaction, updateDepthProvider
-
Methods inherited from interface com.db4o.ObjectContainer
activate, close, commit, deactivate, delete, ext, query, query, query, query, query, queryByExample, rollback, store
-
-
-
-
Constructor Detail
-
TransportObjectContainer
public TransportObjectContainer(ObjectContainerBase parent, MemoryBin memoryFile)
-
-
Method Detail
-
initialize1
protected void initialize1(Configuration config)
- Overrides:
initialize1
in classObjectContainerBase
-
initializeClassMetadataRepository
protected void initializeClassMetadataRepository()
- Overrides:
initializeClassMetadataRepository
in classObjectContainerBase
-
initalizeWeakReferenceSupport
protected void initalizeWeakReferenceSupport()
- Overrides:
initalizeWeakReferenceSupport
in classObjectContainerBase
-
initializePostOpenExcludingTransportObjectContainer
protected void initializePostOpenExcludingTransportObjectContainer()
- Overrides:
initializePostOpenExcludingTransportObjectContainer
in classObjectContainerBase
-
classMetadataForID
public ClassMetadata classMetadataForID(int id)
- Specified by:
classMetadataForID
in interfaceInternalObjectContainer
- Overrides:
classMetadataForID
in classObjectContainerBase
-
converterVersion
public int converterVersion()
- Overrides:
converterVersion
in classLocalObjectContainer
-
dropReferences
protected void dropReferences()
-
handleExceptionOnClose
protected void handleExceptionOnClose(java.lang.Exception exc)
- Overrides:
handleExceptionOnClose
in classObjectContainerBase
-
newTransaction
public final Transaction newTransaction(Transaction parentTransaction, ReferenceSystem referenceSystem, boolean isSystemTransaction)
- Overrides:
newTransaction
in classLocalObjectContainer
-
currentVersion
public long currentVersion()
- Overrides:
currentVersion
in classLocalObjectContainer
-
db4oTypeStored
public Db4oType db4oTypeStored(Transaction a_trans, java.lang.Object a_object)
Description copied from class:ObjectContainerBase
allows special handling for all Db4oType objects. Redirected here from #set() so only instanceof check is necessary in the #set() method.- Overrides:
db4oTypeStored
in classObjectContainerBase
- Returns:
- object if handled here and #set() should not continue processing
-
dispatchsEvents
public boolean dispatchsEvents()
- Overrides:
dispatchsEvents
in classObjectContainerBase
-
finalize
protected void finalize()
- Overrides:
finalize
in classObjectContainerBase
-
free
public final void free(int a_address, int a_length)
- Overrides:
free
in classLocalObjectContainer
-
free
public final void free(Slot slot)
- Overrides:
free
in classLocalObjectContainer
-
allocateSlot
public Slot allocateSlot(int length)
- Overrides:
allocateSlot
in classLocalObjectContainer
-
isValidPointer
protected boolean isValidPointer(int id)
- Overrides:
isValidPointer
in classLocalObjectContainer
-
identity
public Db4oDatabase identity()
Description copied from interface:ExtObjectContainer
returns the Db4oDatabase object for this ObjectContainer.- Specified by:
identity
in interfaceExtObjectContainer
- Overrides:
identity
in classLocalObjectContainer
- Returns:
- the Db4oDatabase identity object for this ObjectContainer.
-
maintainsIndices
public boolean maintainsIndices()
- Overrides:
maintainsIndices
in classObjectContainerBase
-
generateTimeStampId
public long generateTimeStampId()
- Overrides:
generateTimeStampId
in classObjectContainerBase
-
produceClassMetadata
public ClassMetadata produceClassMetadata(ReflectClass claxx)
- Overrides:
produceClassMetadata
in classObjectContainerBase
-
raiseCommitTimestamp
public void raiseCommitTimestamp(long a_minimumVersion)
- Overrides:
raiseCommitTimestamp
in classLocalObjectContainer
-
shutdown
public void shutdown()
- Overrides:
shutdown
in classLocalObjectContainer
-
writeHeader
public final void writeHeader(boolean startFileLockingThread, boolean shuttingDown)
- Overrides:
writeHeader
in classLocalObjectContainer
-
storeInternal
public int storeInternal(Transaction trans, java.lang.Object obj, UpdateDepth depth, boolean checkJustSet) throws DatabaseClosedException, DatabaseReadOnlyException
- Overrides:
storeInternal
in classObjectContainerBase
- Throws:
DatabaseClosedException
DatabaseReadOnlyException
-
checkReadOnly
protected final void checkReadOnly() throws DatabaseReadOnlyException
- Overrides:
checkReadOnly
in classObjectContainerBase
- Throws:
DatabaseReadOnlyException
-
getByID2
public java.lang.Object getByID2(Transaction ta, int id)
- Overrides:
getByID2
in classObjectContainerBase
-
deferredOpen
public void deferredOpen()
-
openImpl
protected final void openImpl() throws OldFormatException
- Specified by:
openImpl
in classObjectContainerBase
- Throws:
OldFormatException
-
backup
public void backup(Storage targetStorage, java.lang.String path) throws NotSupportedException
Description copied from interface:ExtObjectContainer
backs up a database file of an open ObjectContainer.
While the backup is running, the ObjectContainer can continue to be used. Changes that are made while the backup is in progress, will be applied to the open ObjectContainer and to the backup.
While the backup is running, the ObjectContainer should not be closed.
Note that this is designed to run as a background process: To avoid harming performance of concurrently active database operations, it tries to leave room for other threads as much as possible and thus will be orders of magnitude slower than a regular file copy. If you are looking for a faster backup (that will block all other database operations), useExtObjectContainer.backupSync(Storage, String)
instead.
If a file already exists at the specified path, it will be overwritten.
This method is intended for cross-storage backups, i.e. backup from an in-memory database to a file.- Specified by:
backup
in interfaceExtObjectContainer
- Specified by:
backup
in classExternalObjectContainer
- Parameters:
targetStorage
- theStorage
to be used for backuppath
- a fully qualified path- Throws:
NotSupportedException
- is thrown when the operation is not supported in current configuration/environment
-
backupSync
public void backupSync(Storage targetStorage, java.lang.String path) throws NotSupportedException
Description copied from interface:ExtObjectContainer
backs up a database file of an open ObjectContainer. While the backup is running, the ObjectContainer should not be closed.
Note that this blocks all other concurrently active database operations for the full duration of the backup. If you intend to run a backup as a less intrusive background process concurrently with other database operations, useExtObjectContainer.backup(Storage, String)
instead.
If a file already exists at the specified path, it will be overwritten.
This method can be used for cross-storage backups, i.e. backup from an in-memory database to a file.- Specified by:
backupSync
in interfaceExtObjectContainer
- Specified by:
backupSync
in classExternalObjectContainer
- Parameters:
targetStorage
- theStorage
to be used for backuppath
- a fully qualified path- Throws:
NotSupportedException
- is thrown when the operation is not supported in current configuration/environment
-
blockSize
public void blockSize(int size)
- Specified by:
blockSize
in classObjectContainerBase
-
closeTransaction
public void closeTransaction(Transaction transaction, boolean isSystemTransaction, boolean rollbackOnClose)
- Specified by:
closeTransaction
in classObjectContainerBase
-
shutdownDataStorage
protected void shutdownDataStorage()
- Specified by:
shutdownDataStorage
in classObjectContainerBase
-
fileLength
public long fileLength()
- Specified by:
fileLength
in classLocalObjectContainer
-
fileName
public java.lang.String fileName()
- Specified by:
fileName
in classLocalObjectContainer
-
hasShutDownHook
protected boolean hasShutDownHook()
- Overrides:
hasShutDownHook
in classObjectContainerBase
-
needsLockFileThread
public final boolean needsLockFileThread()
- Overrides:
needsLockFileThread
in classObjectContainerBase
-
readBytes
public void readBytes(byte[] bytes, int address, int length)
- Specified by:
readBytes
in classObjectContainerBase
-
readBytes
public void readBytes(byte[] bytes, int address, int addressOffset, int length)
- Specified by:
readBytes
in classObjectContainerBase
-
syncFiles
public void syncFiles()
- Specified by:
syncFiles
in classLocalObjectContainer
-
writeBytes
public void writeBytes(ByteArrayBuffer buffer, int address, int addressOffset)
- Specified by:
writeBytes
in classLocalObjectContainer
-
overwriteDeletedBytes
public void overwriteDeletedBytes(int a_address, int a_length)
- Specified by:
overwriteDeletedBytes
in classLocalObjectContainer
-
reserve
public void reserve(int byteCount)
- Specified by:
reserve
in classObjectContainerBase
-
blockSize
public byte blockSize()
- Specified by:
blockSize
in classObjectContainerBase
-
fatalStorageShutdown
protected void fatalStorageShutdown()
- Specified by:
fatalStorageShutdown
in classObjectContainerBase
-
createReferenceSystem
public ReferenceSystem createReferenceSystem()
- Overrides:
createReferenceSystem
in classObjectContainerBase
-
createIdSystem
protected void createIdSystem()
- Overrides:
createIdSystem
in classLocalObjectContainer
-
commitHook
public java.lang.Runnable commitHook()
- Overrides:
commitHook
in classLocalObjectContainer
-
syncFiles
public void syncFiles(java.lang.Runnable runnable)
- Specified by:
syncFiles
in classLocalObjectContainer
-
maximumDatabaseFileSize
protected long maximumDatabaseFileSize(Config4Impl configImpl)
- Overrides:
maximumDatabaseFileSize
in classLocalObjectContainer
-
-