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 classTransportObjectContainer.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 SlotallocateSlot(int length)voidbackup(Storage targetStorage, java.lang.String path)backs up a database file of an open ObjectContainer.voidbackupSync(Storage targetStorage, java.lang.String path)backs up a database file of an open ObjectContainer.byteblockSize()voidblockSize(int size)protected voidcheckReadOnly()ClassMetadataclassMetadataForID(int id)voidcloseTransaction(Transaction transaction, boolean isSystemTransaction, boolean rollbackOnClose)java.lang.RunnablecommitHook()intconverterVersion()protected voidcreateIdSystem()ReferenceSystemcreateReferenceSystem()longcurrentVersion()Db4oTypedb4oTypeStored(Transaction a_trans, java.lang.Object a_object)allows special handling for all Db4oType objects.voiddeferredOpen()booleandispatchsEvents()protected voiddropReferences()protected voidfatalStorageShutdown()longfileLength()java.lang.StringfileName()protected voidfinalize()voidfree(int a_address, int a_length)voidfree(Slot slot)longgenerateTimeStampId()java.lang.ObjectgetByID2(Transaction ta, int id)protected voidhandleExceptionOnClose(java.lang.Exception exc)protected booleanhasShutDownHook()Db4oDatabaseidentity()returns the Db4oDatabase object for this ObjectContainer.protected voidinitalizeWeakReferenceSupport()protected voidinitialize1(Configuration config)protected voidinitializeClassMetadataRepository()protected voidinitializePostOpenExcludingTransportObjectContainer()protected booleanisValidPointer(int id)booleanmaintainsIndices()protected longmaximumDatabaseFileSize(Config4Impl configImpl)booleanneedsLockFileThread()TransactionnewTransaction(Transaction parentTransaction, ReferenceSystem referenceSystem, boolean isSystemTransaction)protected voidopenImpl()voidoverwriteDeletedBytes(int a_address, int a_length)ClassMetadataproduceClassMetadata(ReflectClass claxx)voidraiseCommitTimestamp(long a_minimumVersion)voidreadBytes(byte[] bytes, int address, int length)voidreadBytes(byte[] bytes, int address, int addressOffset, int length)voidreserve(int byteCount)voidshutdown()protected voidshutdownDataStorage()intstoreInternal(Transaction trans, java.lang.Object obj, UpdateDepth depth, boolean checkJustSet)voidsyncFiles()voidsyncFiles(java.lang.Runnable runnable)voidwriteBytes(ByteArrayBuffer buffer, int address, int addressOffset)voidwriteHeader(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:
initialize1in classObjectContainerBase
-
initializeClassMetadataRepository
protected void initializeClassMetadataRepository()
- Overrides:
initializeClassMetadataRepositoryin classObjectContainerBase
-
initalizeWeakReferenceSupport
protected void initalizeWeakReferenceSupport()
- Overrides:
initalizeWeakReferenceSupportin classObjectContainerBase
-
initializePostOpenExcludingTransportObjectContainer
protected void initializePostOpenExcludingTransportObjectContainer()
- Overrides:
initializePostOpenExcludingTransportObjectContainerin classObjectContainerBase
-
classMetadataForID
public ClassMetadata classMetadataForID(int id)
- Specified by:
classMetadataForIDin interfaceInternalObjectContainer- Overrides:
classMetadataForIDin classObjectContainerBase
-
converterVersion
public int converterVersion()
- Overrides:
converterVersionin classLocalObjectContainer
-
dropReferences
protected void dropReferences()
-
handleExceptionOnClose
protected void handleExceptionOnClose(java.lang.Exception exc)
- Overrides:
handleExceptionOnClosein classObjectContainerBase
-
newTransaction
public final Transaction newTransaction(Transaction parentTransaction, ReferenceSystem referenceSystem, boolean isSystemTransaction)
- Overrides:
newTransactionin classLocalObjectContainer
-
currentVersion
public long currentVersion()
- Overrides:
currentVersionin classLocalObjectContainer
-
db4oTypeStored
public Db4oType db4oTypeStored(Transaction a_trans, java.lang.Object a_object)
Description copied from class:ObjectContainerBaseallows special handling for all Db4oType objects. Redirected here from #set() so only instanceof check is necessary in the #set() method.- Overrides:
db4oTypeStoredin classObjectContainerBase- Returns:
- object if handled here and #set() should not continue processing
-
dispatchsEvents
public boolean dispatchsEvents()
- Overrides:
dispatchsEventsin classObjectContainerBase
-
finalize
protected void finalize()
- Overrides:
finalizein classObjectContainerBase
-
free
public final void free(int a_address, int a_length)- Overrides:
freein classLocalObjectContainer
-
free
public final void free(Slot slot)
- Overrides:
freein classLocalObjectContainer
-
allocateSlot
public Slot allocateSlot(int length)
- Overrides:
allocateSlotin classLocalObjectContainer
-
isValidPointer
protected boolean isValidPointer(int id)
- Overrides:
isValidPointerin classLocalObjectContainer
-
identity
public Db4oDatabase identity()
Description copied from interface:ExtObjectContainerreturns the Db4oDatabase object for this ObjectContainer.- Specified by:
identityin interfaceExtObjectContainer- Overrides:
identityin classLocalObjectContainer- Returns:
- the Db4oDatabase identity object for this ObjectContainer.
-
maintainsIndices
public boolean maintainsIndices()
- Overrides:
maintainsIndicesin classObjectContainerBase
-
generateTimeStampId
public long generateTimeStampId()
- Overrides:
generateTimeStampIdin classObjectContainerBase
-
produceClassMetadata
public ClassMetadata produceClassMetadata(ReflectClass claxx)
- Overrides:
produceClassMetadatain classObjectContainerBase
-
raiseCommitTimestamp
public void raiseCommitTimestamp(long a_minimumVersion)
- Overrides:
raiseCommitTimestampin classLocalObjectContainer
-
shutdown
public void shutdown()
- Overrides:
shutdownin classLocalObjectContainer
-
writeHeader
public final void writeHeader(boolean startFileLockingThread, boolean shuttingDown)- Overrides:
writeHeaderin classLocalObjectContainer
-
storeInternal
public int storeInternal(Transaction trans, java.lang.Object obj, UpdateDepth depth, boolean checkJustSet) throws DatabaseClosedException, DatabaseReadOnlyException
- Overrides:
storeInternalin classObjectContainerBase- Throws:
DatabaseClosedExceptionDatabaseReadOnlyException
-
checkReadOnly
protected final void checkReadOnly() throws DatabaseReadOnlyException- Overrides:
checkReadOnlyin classObjectContainerBase- Throws:
DatabaseReadOnlyException
-
getByID2
public java.lang.Object getByID2(Transaction ta, int id)
- Overrides:
getByID2in classObjectContainerBase
-
deferredOpen
public void deferredOpen()
-
openImpl
protected final void openImpl() throws OldFormatException- Specified by:
openImplin classObjectContainerBase- Throws:
OldFormatException
-
backup
public void backup(Storage targetStorage, java.lang.String path) throws NotSupportedException
Description copied from interface:ExtObjectContainerbacks 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:
backupin interfaceExtObjectContainer- Specified by:
backupin classExternalObjectContainer- Parameters:
targetStorage- theStorageto 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:ExtObjectContainerbacks 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:
backupSyncin interfaceExtObjectContainer- Specified by:
backupSyncin classExternalObjectContainer- Parameters:
targetStorage- theStorageto 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:
blockSizein classObjectContainerBase
-
closeTransaction
public void closeTransaction(Transaction transaction, boolean isSystemTransaction, boolean rollbackOnClose)
- Specified by:
closeTransactionin classObjectContainerBase
-
shutdownDataStorage
protected void shutdownDataStorage()
- Specified by:
shutdownDataStoragein classObjectContainerBase
-
fileLength
public long fileLength()
- Specified by:
fileLengthin classLocalObjectContainer
-
fileName
public java.lang.String fileName()
- Specified by:
fileNamein classLocalObjectContainer
-
hasShutDownHook
protected boolean hasShutDownHook()
- Overrides:
hasShutDownHookin classObjectContainerBase
-
needsLockFileThread
public final boolean needsLockFileThread()
- Overrides:
needsLockFileThreadin classObjectContainerBase
-
readBytes
public void readBytes(byte[] bytes, int address, int length)- Specified by:
readBytesin classObjectContainerBase
-
readBytes
public void readBytes(byte[] bytes, int address, int addressOffset, int length)- Specified by:
readBytesin classObjectContainerBase
-
syncFiles
public void syncFiles()
- Specified by:
syncFilesin classLocalObjectContainer
-
writeBytes
public void writeBytes(ByteArrayBuffer buffer, int address, int addressOffset)
- Specified by:
writeBytesin classLocalObjectContainer
-
overwriteDeletedBytes
public void overwriteDeletedBytes(int a_address, int a_length)- Specified by:
overwriteDeletedBytesin classLocalObjectContainer
-
reserve
public void reserve(int byteCount)
- Specified by:
reservein classObjectContainerBase
-
blockSize
public byte blockSize()
- Specified by:
blockSizein classObjectContainerBase
-
fatalStorageShutdown
protected void fatalStorageShutdown()
- Specified by:
fatalStorageShutdownin classObjectContainerBase
-
createReferenceSystem
public ReferenceSystem createReferenceSystem()
- Overrides:
createReferenceSystemin classObjectContainerBase
-
createIdSystem
protected void createIdSystem()
- Overrides:
createIdSystemin classLocalObjectContainer
-
commitHook
public java.lang.Runnable commitHook()
- Overrides:
commitHookin classLocalObjectContainer
-
syncFiles
public void syncFiles(java.lang.Runnable runnable)
- Specified by:
syncFilesin classLocalObjectContainer
-
maximumDatabaseFileSize
protected long maximumDatabaseFileSize(Config4Impl configImpl)
- Overrides:
maximumDatabaseFileSizein classLocalObjectContainer
-
-