Package com.db4o.internal
Class ObjectContainerBase
- java.lang.Object
-
- com.db4o.internal.ObjectContainerBase
-
- All Implemented Interfaces:
ExtObjectContainer,InternalObjectContainer,ObjectContainerSpec,Internal4,ObjectContainer,TransientClass
- Direct Known Subclasses:
ExternalObjectContainer
public abstract class ObjectContainerBase extends java.lang.Object implements TransientClass, Internal4, ObjectContainerSpec, InternalObjectContainer
-
-
Field Summary
Fields Modifier and Type Field Description protected BlockConverter_blockConverterprotected ClassMetadataRepository_classCollectionprotected Config4Impl_configHandlerRegistry_handlersprotected java.lang.Object_lockprotected TimeStampIdGenerator_timeStampIdGeneratorprotected Transaction_transaction
-
Constructor Summary
Constructors Modifier Constructor Description protectedObjectContainerBase(Configuration config)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidactivate(Transaction trans, java.lang.Object obj)voidactivate(Transaction trans, java.lang.Object obj, ActivationDepth depth)ActivationContext4activationContextFor(Transaction ta, java.lang.Object obj, ActivationDepth depth)ActivationDepthProvideractivationDepthProvider()protected booleanapplyRenames(Config4Impl config)protected <R> RasTopLevelCall(Function4<Transaction,R> block, Transaction trans)voidbackup(java.lang.String path)backs up a database file of an open ObjectContainer.voidbackupSync(java.lang.String path)backs up a database file of an open ObjectContainer.voidbind(Transaction trans, java.lang.Object obj, long id)ObjectReferencebind2(Transaction trans, ObjectReference oldRef, java.lang.Object obj)BlockConverterblockConverter()abstract byteblockSize()abstract voidblockSize(int size)Callbackscallbacks()voidcallbacks(Callbacks cb)voidcheckClosed()protected voidcheckReadOnly()voidcheckStillToSet()TransactioncheckTransaction()TransactioncheckTransaction(Transaction ta)ClassMetadataRepositoryclassCollection()ClassMetadataclassMetadataForID(int id)ClassMetadataclassMetadataForName(java.lang.String name)ClassMetadataclassMetadataForObject(java.lang.Object obj)ClassMetadataclassMetadataForReflectClass(ReflectClass claxx)intclassMetadataIdForName(java.lang.String name)abstract QueryResultclassOnlyQuery(QQueryBase queryBase, ClassMetadata clazz)booleanclose()Closes the ObjectContainer.protected abstract voidclose2()protected abstract voidcloseIdSystem()protected voidcloseSystemTransaction()abstract voidcloseTransaction(Transaction transaction, boolean isSystemTransaction, boolean rollbackOnClose)protected voidcloseUserTransaction()voidcommit(Transaction trans)abstract voidcommit1(Transaction trans)CommitTimestampFieldMetadatacommitTimestampIndex()Config4Implconfig()Config4ImplconfigImpl()Configurationconfigure()returns the Configuration context for this ObjectContainer.ObjectContainerBasecontainer()abstract intconverterVersion()protected voidcreateBlockConverter(int blockSize)booleancreateClassMetadata(ClassMetadata classMeta, ReflectClass clazz, ClassMetadata superClassMeta)ReferenceSystemcreateReferenceSystem()StatefulBuffercreateStatefulBuffer(Transaction trans, int address, int length)protected voidcreateStringIO(byte encoding)abstract longcurrentVersion()Db4oTypedb4oTypeStored(Transaction trans, java.lang.Object obj)allows special handling for all Db4oType objects.voiddeactivate(Transaction trans, java.lang.Object obj)voiddeactivate(Transaction trans, java.lang.Object obj, int depth)ByteArrayBufferdecryptedBufferByAddress(int address, int length)ActivationDepthdefaultActivationDepth(ClassMetadata classMetadata)protected abstract java.lang.StringdefaultToString()voiddelete(Transaction trans, java.lang.Object obj)voiddelete1(Transaction trans, java.lang.Object obj, boolean userCall)voiddelete2(Transaction trans, ObjectReference ref, java.lang.Object obj, int cascade, boolean userCall)abstract booleandelete4(Transaction ta, ObjectReference ref, java.lang.Object obj, int a_cascade, boolean userCall)voiddeleteByID(Transaction transaction, int id, int cascadeDeleteDepth)booleandetectSchemaChanges()booleandispatchsEvents()protected booleandoFinalize()protected Environmentenvironment()abstract QueryResultexecuteQuery(QQuery query)voidfatalShutdown(java.lang.Throwable origExc)protected abstract voidfatalStorageShutdown()protected voidfinalize()voidflagAsHandled(ObjectReference ref)longgenerateTimeStampId()longgenerateTransactionTimestamp(long forcedTimestamp)java.lang.ObjectgetActivatedObjectFromCache(Transaction ta, int id)java.lang.ObjectgetByID(Transaction ta, long id)java.lang.ObjectgetByID2(Transaction ta, int id)java.lang.ObjectgetByUUID(Transaction trans, Db4oUUID uuid)HardObjectReferencegetHardObjectReferenceById(Transaction trans, int id)HardObjectReferencegetHardReferenceBySignature(Transaction trans, long uuid, byte[] signature)intgetID(Transaction trans, java.lang.Object obj)abstract long[]getIDsForClass(Transaction trans, ClassMetadata clazz)NativeQueryHandlergetNativeQueryHandler()ObjectInfogetObjectInfo(Transaction trans, java.lang.Object obj)booleanhandledInCurrentTopLevelCall(ObjectReference ref)protected voidhandleExceptionOnClose(java.lang.Exception exc)HandlerRegistryhandlers()protected booleanhasShutDownHook()abstract intidForNewUserObject(Transaction trans)protected voidinitalizeWeakReferenceSupport()protected voidinitialize1(Configuration config)protected voidinitializeClassMetadataRepository()protected voidinitializePostOpenExcludingTransportObjectContainer()protected voidinitializeTransactions()booleanisCached(Transaction trans, long id)booleanisClient()overridden in ClientObjectContainer The method allows checking whether will make it easier to refactor than an "instanceof YapClient" check.booleanisClosed()tests if this ObjectContainer is closed.abstract booleanisDeleted(Transaction trans, int id)booleanisStored(Transaction trans, java.lang.Object obj)ReflectClass[]knownClasses()returns all class representations that are known to this ObjectContainer because they have been used or stored.java.lang.Objectlock()returns the main synchronization lock.voidlogMsg(int code, java.lang.String msg)booleanmaintainsIndices()booleanneedsLockFileThread()voidneedsUpdate(ClassMetadata classMetadata)abstract AbstractQueryResultnewQueryResult(Transaction trans, QueryEvaluationMode mode)TransactionnewSystemTransaction()abstract TransactionnewTransaction(Transaction parentTransaction, ReferenceSystem referenceSystem, boolean isSystemTransaction)TransactionnewUserTransaction()java.lang.ObjectnewWeakReference(ObjectReference referent, java.lang.Object obj)protected voidopen()protected abstract voidopenImpl()java.lang.ObjectpeekPersisted(Transaction trans, int id, ActivationDepth depth, boolean resetJustPeeked)java.lang.ObjectpeekPersisted(Transaction trans, java.lang.Object obj, ActivationDepth depth, boolean committed)ObjectReferencepeekReference(Transaction trans, int id, ActivationDepth depth, boolean resetJustPeeked)ClassMetadataproduceClassMetadata(ReflectClass claxx)voidpurge()unloads all clean indices from memory and frees unused objects.voidpurge(Transaction trans, java.lang.Object obj)Queryquery(Transaction ta)ObjectSetquery(Transaction trans, Predicate predicate)<T> ObjectSet<T>query(Transaction trans, Predicate<T> predicate, QueryComparator<T> comparator)<T> ObjectSet<T>query(Transaction trans, java.lang.Class<T> clazz)ObjectSetquery(Predicate predicate, java.util.Comparator comparator)Native Query Interface.abstract AbstractQueryResultqueryAllObjects(Transaction ta)ObjectSetqueryByExample(Transaction trans, java.lang.Object template)abstract voidraiseCommitTimestamp(long minimumTimestamp)ByteArrayBufferrawBufferByAddress(int address, int length)java.lang.ObjectreadActivatedObjectNotInCache(Transaction trans, int id)abstract ByteArrayBufferreadBufferById(Transaction trans, int id)abstract ByteArrayBufferreadBufferById(Transaction trans, int id, boolean lastCommitted)abstract voidreadBytes(byte[] a_bytes, int a_address, int a_length)abstract voidreadBytes(byte[] bytes, int address, int addressOffset, int length)abstract ByteArrayBuffer[]readSlotBuffers(Transaction trans, int[] ids)abstract StatefulBufferreadStatefulBufferById(Transaction trans, int id)abstract StatefulBufferreadStatefulBufferById(Transaction trans, int id, boolean lastCommitted)StatefulBufferreadWriterByAddress(Transaction a_trans, int address, int length)ReferenceSystemRegistryreferenceSystemRegistry()GenericReflectorreflector()Return the reflector currently being used by db4objects.voidrefresh(Transaction trans, java.lang.Object obj, int depth)protected voidrefreshInternal(Transaction trans, java.lang.Object obj, int depth)abstract voidreleaseSemaphore(Transaction trans, java.lang.String name)abstract voidreleaseSemaphore(java.lang.String name)releases a semaphore, if the calling transaction is the owner.abstract voidreleaseSemaphores(Transaction ta)voidreplaceClassMetadataRepository(ClassMetadataRepository repository)voidreplicationCallState(int state)abstract voidreserve(int byteCount)voidrollback(Transaction trans)abstract voidrollback1(Transaction trans)voidsend(java.lang.Object obj)abstract voidsetDirtyInSystemTransaction(PersistentBase a_object)abstract booleansetSemaphore(Transaction trans, java.lang.String name, int timeout)abstract booleansetSemaphore(java.lang.String name, int timeout)attempts to set a semaphore.voidshowInternalClasses(boolean show)Objects implementing the "Internal4" marker interface are not visible to queries, unless this flag is set to true.abstract voidshutdown()protected abstract voidshutdownDataStorage()voidshutdownObjectContainer()intstackDepth()voidstackDepth(int depth)voidstillToActivate(ActivationContext context)voidstillToDeactivate(Transaction trans, java.lang.Object a_object, ActivationDepth a_depth, boolean a_forceUnknownDeactivate)protected voidstopSession()voidstore(Transaction trans, java.lang.Object obj)intstore(Transaction trans, java.lang.Object obj, UpdateDepth depth)intstore2(Transaction trans, java.lang.Object obj, UpdateDepth updateDepth, boolean checkJustSet)intstoreAfterReplication(Transaction trans, java.lang.Object obj, UpdateDepth depth, boolean checkJust)voidstoreAll(Transaction transaction, Iterator4 objects)voidstoreAll(Transaction transaction, Iterator4 objects, UpdateDepth depth)voidstoreByNewReplication(Db4oReplicationReferenceProvider referenceProvider, java.lang.Object obj)StoredClassstoredClass(Transaction trans, java.lang.Object clazz)StoredClass[]storedClasses(Transaction trans)intstoreInternal(Transaction trans, java.lang.Object obj, boolean checkJustSet)intstoreInternal(Transaction trans, java.lang.Object obj, UpdateDepth depth, boolean checkJustSet)LatinStringIOstringIO()<R> RsyncExec(Closure4<R> block)abstract SystemInfosystemInfo()returns theSystemInfofor this ObjectContainer.TransactionsystemTransaction()ThreadPool4threadPool()inttopLevelCallId()voidtopLevelCallId(int id)java.lang.StringtoString()Transactiontransaction()java.lang.ObjecttryGetByID(Transaction ta, long id)TypeHandler4typeHandlerForClass(ReflectClass claxx)TypeHandler4typeHandlerForClassMetadataID(int id)UpdateDepthProviderupdateDepthProvider()voiduseDefaultTransactionTimestamp()UUIDFieldMetadatauUIDIndex()longversion()returns the current transaction serial number.VersionFieldMetadataversionIndex()voidwithEnvironment(java.lang.Runnable runnable)voidwithTransaction(Transaction transaction, java.lang.Runnable runnable)abstract voidwriteDirtyClassMetadata()abstract voidwriteNew(Transaction trans, Pointer4 pointer, ClassMetadata classMetadata, ByteArrayBuffer buffer)abstract voidwriteUpdate(Transaction trans, Pointer4 pointer, ClassMetadata classMetadata, ArrayType arrayType, ByteArrayBuffer buffer)-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.db4o.ext.ExtObjectContainer
activate, backup, backupSync, bind, deactivate, descend, getByID, getByUUID, getID, getObjectInfo, identity, isActive, isCached, isStored, openSession, peekPersisted, purge, refresh, store, storedClass, storedClasses
-
Methods inherited from interface com.db4o.internal.InternalObjectContainer
inCallback, instanceCount, newEventRegistry
-
Methods inherited from interface com.db4o.ObjectContainer
activate, commit, deactivate, delete, ext, query, query, query, query, queryByExample, rollback, store
-
-
-
-
Field Detail
-
_classCollection
protected ClassMetadataRepository _classCollection
-
_config
protected Config4Impl _config
-
_lock
protected java.lang.Object _lock
-
_transaction
protected Transaction _transaction
-
_handlers
public HandlerRegistry _handlers
-
_timeStampIdGenerator
protected final TimeStampIdGenerator _timeStampIdGenerator
-
_blockConverter
protected BlockConverter _blockConverter
-
-
Constructor Detail
-
ObjectContainerBase
protected ObjectContainerBase(Configuration config)
-
-
Method Detail
-
environment
protected Environment environment()
-
open
protected final void open() throws OldFormatException- Throws:
OldFormatException
-
withEnvironment
public void withEnvironment(java.lang.Runnable runnable)
-
openImpl
protected abstract void openImpl() throws Db4oIOException- Throws:
Db4oIOException
-
defaultActivationDepth
public ActivationDepth defaultActivationDepth(ClassMetadata classMetadata)
-
activationDepthProvider
public ActivationDepthProvider activationDepthProvider()
-
activate
public final void activate(Transaction trans, java.lang.Object obj)
-
deactivate
public final void deactivate(Transaction trans, java.lang.Object obj)
-
activate
public final void activate(Transaction trans, java.lang.Object obj, ActivationDepth depth)
-
backup
public void backup(java.lang.String path) throws DatabaseClosedException, Db4oIOExceptionDescription 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.
TheStorageused for backup is the one configured for this container.- Specified by:
backupin interfaceExtObjectContainer- Parameters:
path- a fully qualified path- Throws:
DatabaseClosedException- db4o database file was closed or failed to open.Db4oIOException- I/O operation failed or was unexpectedly interrupted.
-
backupSync
public void backupSync(java.lang.String path) throws DatabaseClosedException, Db4oIOExceptionDescription 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.
TheStorageused for backup is the one configured for this container.- Specified by:
backupSyncin interfaceExtObjectContainer- Parameters:
path- a fully qualified path- Throws:
DatabaseClosedException- db4o database file was closed or failed to open.Db4oIOException- I/O operation failed or was unexpectedly interrupted.
-
activationContextFor
public ActivationContext4 activationContextFor(Transaction ta, java.lang.Object obj, ActivationDepth depth)
-
bind
public final void bind(Transaction trans, java.lang.Object obj, long id) throws ArgumentNullException, java.lang.IllegalArgumentException
- Throws:
ArgumentNullExceptionjava.lang.IllegalArgumentException
-
bind2
public final ObjectReference bind2(Transaction trans, ObjectReference oldRef, java.lang.Object obj)
-
classMetadataForObject
public ClassMetadata classMetadataForObject(java.lang.Object obj)
-
blockSize
public abstract byte blockSize()
-
checkClosed
public final void checkClosed() throws DatabaseClosedException- Throws:
DatabaseClosedException
-
checkReadOnly
protected void checkReadOnly() throws DatabaseReadOnlyException- Throws:
DatabaseReadOnlyException
-
checkTransaction
public final Transaction checkTransaction()
-
checkTransaction
public final Transaction checkTransaction(Transaction ta)
-
close
public final boolean close()
Description copied from interface:ObjectContainer- Specified by:
closein interfaceObjectContainer- Returns:
- success - true denotes that the object container was closed, false if it was already closed
-
handleExceptionOnClose
protected void handleExceptionOnClose(java.lang.Exception exc)
-
close2
protected abstract void close2()
-
shutdownObjectContainer
public final void shutdownObjectContainer()
-
closeIdSystem
protected abstract void closeIdSystem()
-
closeUserTransaction
protected final void closeUserTransaction()
-
closeSystemTransaction
protected final void closeSystemTransaction()
-
closeTransaction
public abstract void closeTransaction(Transaction transaction, boolean isSystemTransaction, boolean rollbackOnClose)
-
shutdownDataStorage
protected abstract void shutdownDataStorage()
-
commit
public final void commit(Transaction trans) throws DatabaseReadOnlyException, DatabaseClosedException
-
asTopLevelCall
protected <R> R asTopLevelCall(Function4<Transaction,R> block, Transaction trans)
-
fatalShutdown
public void fatalShutdown(java.lang.Throwable origExc)
-
fatalStorageShutdown
protected abstract void fatalStorageShutdown()
-
commit1
public abstract void commit1(Transaction trans)
-
configure
public Configuration configure()
Description copied from interface:ExtObjectContainerreturns the Configuration context for this ObjectContainer.- Specified by:
configurein interfaceExtObjectContainer- Returns:
Configurationthe Configuration context for this ObjectContainer
-
config
public Config4Impl config()
-
converterVersion
public abstract int converterVersion()
-
newQueryResult
public abstract AbstractQueryResult newQueryResult(Transaction trans, QueryEvaluationMode mode)
-
createStringIO
protected final void createStringIO(byte encoding)
-
initializeTransactions
protected final void initializeTransactions()
-
newTransaction
public abstract Transaction newTransaction(Transaction parentTransaction, ReferenceSystem referenceSystem, boolean isSystemTransaction)
-
newUserTransaction
public Transaction newUserTransaction()
-
newSystemTransaction
public Transaction newSystemTransaction()
-
currentVersion
public abstract long currentVersion()
-
createClassMetadata
public boolean createClassMetadata(ClassMetadata classMeta, ReflectClass clazz, ClassMetadata superClassMeta)
-
db4oTypeStored
public Db4oType db4oTypeStored(Transaction trans, java.lang.Object obj)
allows special handling for all Db4oType objects. Redirected here from #set() so only instanceof check is necessary in the #set() method.- Returns:
- object if handled here and #set() should not continue processing
-
deactivate
public final void deactivate(Transaction trans, java.lang.Object obj, int depth) throws DatabaseClosedException
- Throws:
DatabaseClosedException
-
delete
public final void delete(Transaction trans, java.lang.Object obj) throws DatabaseReadOnlyException, DatabaseClosedException
-
delete1
public final void delete1(Transaction trans, java.lang.Object obj, boolean userCall)
-
delete2
public final void delete2(Transaction trans, ObjectReference ref, java.lang.Object obj, int cascade, boolean userCall)
-
delete4
public abstract boolean delete4(Transaction ta, ObjectReference ref, java.lang.Object obj, int a_cascade, boolean userCall)
-
detectSchemaChanges
public boolean detectSchemaChanges()
-
dispatchsEvents
public boolean dispatchsEvents()
-
doFinalize
protected boolean doFinalize()
-
finalize
protected void finalize()
- Overrides:
finalizein classjava.lang.Object
-
queryByExample
public final ObjectSet queryByExample(Transaction trans, java.lang.Object template)
-
queryAllObjects
public abstract AbstractQueryResult queryAllObjects(Transaction ta)
-
tryGetByID
public final java.lang.Object tryGetByID(Transaction ta, long id) throws DatabaseClosedException
- Throws:
DatabaseClosedException
-
getByID
public final java.lang.Object getByID(Transaction ta, long id) throws DatabaseClosedException, InvalidIDException
-
getByID2
public java.lang.Object getByID2(Transaction ta, int id)
-
getActivatedObjectFromCache
public final java.lang.Object getActivatedObjectFromCache(Transaction ta, int id)
-
readActivatedObjectNotInCache
public final java.lang.Object readActivatedObjectNotInCache(Transaction trans, int id)
-
getByUUID
public final java.lang.Object getByUUID(Transaction trans, Db4oUUID uuid)
-
getHardReferenceBySignature
public HardObjectReference getHardReferenceBySignature(Transaction trans, long uuid, byte[] signature)
-
getID
public final int getID(Transaction trans, java.lang.Object obj)
-
getObjectInfo
public final ObjectInfo getObjectInfo(Transaction trans, java.lang.Object obj)
-
getHardObjectReferenceById
public final HardObjectReference getHardObjectReferenceById(Transaction trans, int id)
-
createStatefulBuffer
public final StatefulBuffer createStatefulBuffer(Transaction trans, int address, int length)
-
systemTransaction
public final Transaction systemTransaction()
-
transaction
public final Transaction transaction()
- Specified by:
transactionin interfaceInternalObjectContainer
-
classMetadataForReflectClass
public ClassMetadata classMetadataForReflectClass(ReflectClass claxx)
- Specified by:
classMetadataForReflectClassin interfaceInternalObjectContainer
-
produceClassMetadata
public ClassMetadata produceClassMetadata(ReflectClass claxx)
-
classMetadataIdForName
public int classMetadataIdForName(java.lang.String name)
-
classMetadataForName
public ClassMetadata classMetadataForName(java.lang.String name)
- Specified by:
classMetadataForNamein interfaceInternalObjectContainer
-
classMetadataForID
public ClassMetadata classMetadataForID(int id)
- Specified by:
classMetadataForIDin interfaceInternalObjectContainer
-
handlers
public HandlerRegistry handlers()
- Specified by:
handlersin interfaceInternalObjectContainer
-
needsLockFileThread
public boolean needsLockFileThread()
-
hasShutDownHook
protected boolean hasShutDownHook()
-
initialize1
protected void initialize1(Configuration config)
-
createReferenceSystem
public ReferenceSystem createReferenceSystem()
-
initalizeWeakReferenceSupport
protected void initalizeWeakReferenceSupport()
-
initializeClassMetadataRepository
protected void initializeClassMetadataRepository()
-
initializePostOpenExcludingTransportObjectContainer
protected void initializePostOpenExcludingTransportObjectContainer()
-
isCached
public boolean isCached(Transaction trans, long id)
-
isClient
public boolean isClient()
overridden in ClientObjectContainer The method allows checking whether will make it easier to refactor than an "instanceof YapClient" check.- Specified by:
isClientin interfaceInternalObjectContainer
-
isClosed
public final boolean isClosed()
Description copied from interface:ExtObjectContainertests if this ObjectContainer is closed.- Specified by:
isClosedin interfaceExtObjectContainer- Returns:
- true if this ObjectContainer is closed.
-
isStored
public final boolean isStored(Transaction trans, java.lang.Object obj)
-
knownClasses
public ReflectClass[] knownClasses()
Description copied from interface:ExtObjectContainerreturns all class representations that are known to this ObjectContainer because they have been used or stored.- Specified by:
knownClassesin interfaceExtObjectContainer- Returns:
- all class representations that are known to this ObjectContainer because they have been used or stored.
-
typeHandlerForClass
public TypeHandler4 typeHandlerForClass(ReflectClass claxx)
-
typeHandlerForClassMetadataID
public TypeHandler4 typeHandlerForClassMetadataID(int id)
-
lock
public java.lang.Object lock()
Description copied from interface:ExtObjectContainerreturns the main synchronization lock.
Synchronize over this object to ensure exclusive access to the ObjectContainer.
Handle the use of this functionality with extreme care, since deadlocks can be produced with just two lines of code.- Specified by:
lockin interfaceExtObjectContainer- Returns:
- Object the ObjectContainer lock object
-
logMsg
public final void logMsg(int code, java.lang.String msg)
-
maintainsIndices
public boolean maintainsIndices()
-
needsUpdate
public final void needsUpdate(ClassMetadata classMetadata)
-
generateTimeStampId
public long generateTimeStampId()
-
idForNewUserObject
public abstract int idForNewUserObject(Transaction trans)
-
peekPersisted
public java.lang.Object peekPersisted(Transaction trans, java.lang.Object obj, ActivationDepth depth, boolean committed) throws DatabaseClosedException
- Throws:
DatabaseClosedException
-
peekPersisted
public final java.lang.Object peekPersisted(Transaction trans, int id, ActivationDepth depth, boolean resetJustPeeked)
-
peekReference
public ObjectReference peekReference(Transaction trans, int id, ActivationDepth depth, boolean resetJustPeeked)
-
purge
public void purge()
Description copied from interface:ExtObjectContainerunloads all clean indices from memory and frees unused objects.
This method can have a negative impact on performance since indices will have to be reread before further inserts, updates or queries can take place.- Specified by:
purgein interfaceExtObjectContainer
-
purge
public final void purge(Transaction trans, java.lang.Object obj)
-
getNativeQueryHandler
public final NativeQueryHandler getNativeQueryHandler()
- Specified by:
getNativeQueryHandlerin interfaceInternalObjectContainer
-
query
public final ObjectSet query(Transaction trans, Predicate predicate)
-
query
public final <T> ObjectSet<T> query(Transaction trans, Predicate<T> predicate, QueryComparator<T> comparator)
-
query
public final <T> ObjectSet<T> query(Transaction trans, java.lang.Class<T> clazz)
-
query
public final Query query(Transaction ta)
-
raiseCommitTimestamp
public abstract void raiseCommitTimestamp(long minimumTimestamp)
-
readBytes
public abstract void readBytes(byte[] a_bytes, int a_address, int a_length) throws Db4oIOException- Throws:
Db4oIOException
-
readBytes
public abstract void readBytes(byte[] bytes, int address, int addressOffset, int length) throws Db4oIOException- Throws:
Db4oIOException
-
decryptedBufferByAddress
public final ByteArrayBuffer decryptedBufferByAddress(int address, int length) throws Db4oIOException
- Throws:
Db4oIOException
-
rawBufferByAddress
public ByteArrayBuffer rawBufferByAddress(int address, int length)
-
readWriterByAddress
public final StatefulBuffer readWriterByAddress(Transaction a_trans, int address, int length) throws Db4oIOException
- Throws:
Db4oIOException
-
readStatefulBufferById
public abstract StatefulBuffer readStatefulBufferById(Transaction trans, int id)
-
readStatefulBufferById
public abstract StatefulBuffer readStatefulBufferById(Transaction trans, int id, boolean lastCommitted)
-
readBufferById
public abstract ByteArrayBuffer readBufferById(Transaction trans, int id)
-
readBufferById
public abstract ByteArrayBuffer readBufferById(Transaction trans, int id, boolean lastCommitted)
-
readSlotBuffers
public abstract ByteArrayBuffer[] readSlotBuffers(Transaction trans, int[] ids)
-
reflector
public GenericReflector reflector()
Description copied from interface:ExtObjectContainerReturn the reflector currently being used by db4objects.- Specified by:
reflectorin interfaceExtObjectContainer- Returns:
- the current Reflector.
-
refresh
public final void refresh(Transaction trans, java.lang.Object obj, int depth)
-
refreshInternal
protected void refreshInternal(Transaction trans, java.lang.Object obj, int depth)
-
releaseSemaphore
public abstract void releaseSemaphore(java.lang.String name)
Description copied from interface:ExtObjectContainerreleases a semaphore, if the calling transaction is the owner.- Specified by:
releaseSemaphorein interfaceExtObjectContainer- Parameters:
name- the name of the semaphore to be released.
-
flagAsHandled
public void flagAsHandled(ObjectReference ref)
-
releaseSemaphores
public abstract void releaseSemaphores(Transaction ta)
-
applyRenames
protected boolean applyRenames(Config4Impl config)
-
handledInCurrentTopLevelCall
public final boolean handledInCurrentTopLevelCall(ObjectReference ref)
-
reserve
public abstract void reserve(int byteCount)
-
rollback
public final void rollback(Transaction trans)
-
rollback1
public abstract void rollback1(Transaction trans)
-
send
public void send(java.lang.Object obj)
- Parameters:
obj-
-
store
public final void store(Transaction trans, java.lang.Object obj) throws DatabaseClosedException, DatabaseReadOnlyException
-
store
public final int store(Transaction trans, java.lang.Object obj, UpdateDepth depth) throws DatabaseClosedException, DatabaseReadOnlyException
-
storeInternal
public final int storeInternal(Transaction trans, java.lang.Object obj, boolean checkJustSet) throws DatabaseClosedException, DatabaseReadOnlyException
-
storeInternal
public int storeInternal(Transaction trans, java.lang.Object obj, UpdateDepth depth, boolean checkJustSet) throws DatabaseClosedException, DatabaseReadOnlyException
-
storeAfterReplication
public final int storeAfterReplication(Transaction trans, java.lang.Object obj, UpdateDepth depth, boolean checkJust)
-
storeByNewReplication
public final void storeByNewReplication(Db4oReplicationReferenceProvider referenceProvider, java.lang.Object obj)
-
checkStillToSet
public void checkStillToSet()
-
store2
public final int store2(Transaction trans, java.lang.Object obj, UpdateDepth updateDepth, boolean checkJustSet)
-
setDirtyInSystemTransaction
public abstract void setDirtyInSystemTransaction(PersistentBase a_object)
-
setSemaphore
public abstract boolean setSemaphore(java.lang.String name, int timeout)Description copied from interface:ExtObjectContainerattempts to set a semaphore.
Semaphores are transient multi-purpose named flags forObjectContainers.
A transaction that successfully sets a semaphore becomes the owner of the semaphore. Semaphores can only be owned by a single transaction at one point in time.
This method returns true, if the transaction already owned the semaphore before the method call or if it successfully acquires ownership of the semaphore.
The waitForAvailability parameter allows to specify a time in milliseconds to wait for other transactions to release the semaphore, in case the semaphore is already owned by another transaction.
Semaphores are released by the first occurrence of one of the following:
- the transaction releases the semaphore withExtObjectContainer.releaseSemaphore(java.lang.String)
- the transaction is closed withObjectContainer.close()
- C/S only: the correspondingObjectServeris closed.
- C/S only: the clientObjectContainerlooses the connection and is timed out.
Semaphores are set immediately. They are independant of callingObjectContainer.commit()orObjectContainer.rollback().
Possible use cases for semaphores:
- prevent other clients from inserting a singleton at the same time. A suggested name for the semaphore: "SINGLETON_" + Object#getClass().getName().
- lock objects. A suggested name: "LOCK_" +getID(Object)
- generate a unique client ID. A suggested name: "CLIENT_" + System.currentTimeMillis().- Specified by:
setSemaphorein interfaceExtObjectContainer- Parameters:
name- the name of the semaphore to be settimeout- the time in milliseconds to wait for other transactions to release the semaphore. The parameter may be zero, if the method is to return immediately.- Returns:
- boolean flag
true, if the semaphore could be set or if the calling transaction already owned the semaphore.
false, if the semaphore is owned by another transaction.
-
setSemaphore
public abstract boolean setSemaphore(Transaction trans, java.lang.String name, int timeout)
-
releaseSemaphore
public abstract void releaseSemaphore(Transaction trans, java.lang.String name)
-
showInternalClasses
public void showInternalClasses(boolean show)
Objects implementing the "Internal4" marker interface are not visible to queries, unless this flag is set to true. The caller should reset the flag after the call.
-
stillToActivate
public final void stillToActivate(ActivationContext context)
-
stillToDeactivate
public final void stillToDeactivate(Transaction trans, java.lang.Object a_object, ActivationDepth a_depth, boolean a_forceUnknownDeactivate)
-
stopSession
protected final void stopSession()
-
storedClass
public final StoredClass storedClass(Transaction trans, java.lang.Object clazz)
-
storedClasses
public StoredClass[] storedClasses(Transaction trans)
-
stringIO
public LatinStringIO stringIO()
-
systemInfo
public abstract SystemInfo systemInfo()
Description copied from interface:ExtObjectContainerreturns theSystemInfofor this ObjectContainer.
TheSystemInfosupplies methods that provide information about system state and system settings of this ObjectContainer.- Specified by:
systemInfoin interfaceExtObjectContainer- Returns:
- the
SystemInfofor this ObjectContainer.
-
stackDepth
public int stackDepth()
-
stackDepth
public void stackDepth(int depth)
-
topLevelCallId
public int topLevelCallId()
-
topLevelCallId
public void topLevelCallId(int id)
-
version
public long version()
Description copied from interface:ExtObjectContainerreturns the current transaction serial number.
This serial number can be used to query for modified objects and for replication purposes.- Specified by:
versionin interfaceExtObjectContainer- Returns:
- the current transaction serial number.
-
shutdown
public abstract void shutdown()
-
writeDirtyClassMetadata
public abstract void writeDirtyClassMetadata()
-
writeNew
public abstract void writeNew(Transaction trans, Pointer4 pointer, ClassMetadata classMetadata, ByteArrayBuffer buffer)
-
writeUpdate
public abstract void writeUpdate(Transaction trans, Pointer4 pointer, ClassMetadata classMetadata, ArrayType arrayType, ByteArrayBuffer buffer)
-
callbacks
public Callbacks callbacks()
- Specified by:
callbacksin interfaceInternalObjectContainer
-
callbacks
public void callbacks(Callbacks cb)
- Specified by:
callbacksin interfaceInternalObjectContainer
-
configImpl
public Config4Impl configImpl()
- Specified by:
configImplin interfaceInternalObjectContainer
-
uUIDIndex
public UUIDFieldMetadata uUIDIndex()
-
versionIndex
public VersionFieldMetadata versionIndex()
-
commitTimestampIndex
public CommitTimestampFieldMetadata commitTimestampIndex()
-
classCollection
public ClassMetadataRepository classCollection()
-
getIDsForClass
public abstract long[] getIDsForClass(Transaction trans, ClassMetadata clazz)
-
classOnlyQuery
public abstract QueryResult classOnlyQuery(QQueryBase queryBase, ClassMetadata clazz)
-
executeQuery
public abstract QueryResult executeQuery(QQuery query)
-
replicationCallState
public void replicationCallState(int state)
-
referenceSystemRegistry
public ReferenceSystemRegistry referenceSystemRegistry()
-
container
public ObjectContainerBase container()
- Specified by:
containerin interfaceInternalObjectContainer
-
deleteByID
public void deleteByID(Transaction transaction, int id, int cascadeDeleteDepth)
-
syncExec
public <R> R syncExec(Closure4<R> block)
- Specified by:
syncExecin interfaceInternalObjectContainer
-
query
public ObjectSet query(Predicate predicate, java.util.Comparator comparator)
Description copied from interface:ObjectContainerNative Query Interface. Queries as withObjectContainer.query(com.db4o.query.Predicate), but will sort the resultingObjectSetaccording to the givenComparator.- Specified by:
queryin interfaceObjectContainer- Parameters:
predicate- thePredicatecontaining the native query expression.comparator- the java.util.Comparator specifying the sort order of the result- Returns:
- the
ObjectSetreturned by the query.
-
storeAll
public void storeAll(Transaction transaction, Iterator4 objects)
- Specified by:
storeAllin interfaceInternalObjectContainer
-
storeAll
public void storeAll(Transaction transaction, Iterator4 objects, UpdateDepth depth)
-
withTransaction
public void withTransaction(Transaction transaction, java.lang.Runnable runnable)
-
threadPool
public ThreadPool4 threadPool()
-
newWeakReference
public java.lang.Object newWeakReference(ObjectReference referent, java.lang.Object obj)
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
defaultToString
protected abstract java.lang.String defaultToString()
-
isDeleted
public abstract boolean isDeleted(Transaction trans, int id)
-
blockSize
public abstract void blockSize(int size)
-
blockConverter
public BlockConverter blockConverter()
-
createBlockConverter
protected void createBlockConverter(int blockSize)
-
updateDepthProvider
public UpdateDepthProvider updateDepthProvider()
- Specified by:
updateDepthProviderin interfaceInternalObjectContainer
-
replaceClassMetadataRepository
public void replaceClassMetadataRepository(ClassMetadataRepository repository)
-
generateTransactionTimestamp
public final long generateTransactionTimestamp(long forcedTimestamp)
-
useDefaultTransactionTimestamp
public final void useDefaultTransactionTimestamp()
-
-