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
_blockConverter
protected ClassMetadataRepository
_classCollection
protected Config4Impl
_config
HandlerRegistry
_handlers
protected java.lang.Object
_lock
protected TimeStampIdGenerator
_timeStampIdGenerator
protected Transaction
_transaction
-
Constructor Summary
Constructors Modifier Constructor Description protected
ObjectContainerBase(Configuration config)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
activate(Transaction trans, java.lang.Object obj)
void
activate(Transaction trans, java.lang.Object obj, ActivationDepth depth)
ActivationContext4
activationContextFor(Transaction ta, java.lang.Object obj, ActivationDepth depth)
ActivationDepthProvider
activationDepthProvider()
protected boolean
applyRenames(Config4Impl config)
protected <R> R
asTopLevelCall(Function4<Transaction,R> block, Transaction trans)
void
backup(java.lang.String path)
backs up a database file of an open ObjectContainer.void
backupSync(java.lang.String path)
backs up a database file of an open ObjectContainer.void
bind(Transaction trans, java.lang.Object obj, long id)
ObjectReference
bind2(Transaction trans, ObjectReference oldRef, java.lang.Object obj)
BlockConverter
blockConverter()
abstract byte
blockSize()
abstract void
blockSize(int size)
Callbacks
callbacks()
void
callbacks(Callbacks cb)
void
checkClosed()
protected void
checkReadOnly()
void
checkStillToSet()
Transaction
checkTransaction()
Transaction
checkTransaction(Transaction ta)
ClassMetadataRepository
classCollection()
ClassMetadata
classMetadataForID(int id)
ClassMetadata
classMetadataForName(java.lang.String name)
ClassMetadata
classMetadataForObject(java.lang.Object obj)
ClassMetadata
classMetadataForReflectClass(ReflectClass claxx)
int
classMetadataIdForName(java.lang.String name)
abstract QueryResult
classOnlyQuery(QQueryBase queryBase, ClassMetadata clazz)
boolean
close()
Closes the ObjectContainer.protected abstract void
close2()
protected abstract void
closeIdSystem()
protected void
closeSystemTransaction()
abstract void
closeTransaction(Transaction transaction, boolean isSystemTransaction, boolean rollbackOnClose)
protected void
closeUserTransaction()
void
commit(Transaction trans)
abstract void
commit1(Transaction trans)
CommitTimestampFieldMetadata
commitTimestampIndex()
Config4Impl
config()
Config4Impl
configImpl()
Configuration
configure()
returns the Configuration context for this ObjectContainer.ObjectContainerBase
container()
abstract int
converterVersion()
protected void
createBlockConverter(int blockSize)
boolean
createClassMetadata(ClassMetadata classMeta, ReflectClass clazz, ClassMetadata superClassMeta)
ReferenceSystem
createReferenceSystem()
StatefulBuffer
createStatefulBuffer(Transaction trans, int address, int length)
protected void
createStringIO(byte encoding)
abstract long
currentVersion()
Db4oType
db4oTypeStored(Transaction trans, java.lang.Object obj)
allows special handling for all Db4oType objects.void
deactivate(Transaction trans, java.lang.Object obj)
void
deactivate(Transaction trans, java.lang.Object obj, int depth)
ByteArrayBuffer
decryptedBufferByAddress(int address, int length)
ActivationDepth
defaultActivationDepth(ClassMetadata classMetadata)
protected abstract java.lang.String
defaultToString()
void
delete(Transaction trans, java.lang.Object obj)
void
delete1(Transaction trans, java.lang.Object obj, boolean userCall)
void
delete2(Transaction trans, ObjectReference ref, java.lang.Object obj, int cascade, boolean userCall)
abstract boolean
delete4(Transaction ta, ObjectReference ref, java.lang.Object obj, int a_cascade, boolean userCall)
void
deleteByID(Transaction transaction, int id, int cascadeDeleteDepth)
boolean
detectSchemaChanges()
boolean
dispatchsEvents()
protected boolean
doFinalize()
protected Environment
environment()
abstract QueryResult
executeQuery(QQuery query)
void
fatalShutdown(java.lang.Throwable origExc)
protected abstract void
fatalStorageShutdown()
protected void
finalize()
void
flagAsHandled(ObjectReference ref)
long
generateTimeStampId()
long
generateTransactionTimestamp(long forcedTimestamp)
java.lang.Object
getActivatedObjectFromCache(Transaction ta, int id)
java.lang.Object
getByID(Transaction ta, long id)
java.lang.Object
getByID2(Transaction ta, int id)
java.lang.Object
getByUUID(Transaction trans, Db4oUUID uuid)
HardObjectReference
getHardObjectReferenceById(Transaction trans, int id)
HardObjectReference
getHardReferenceBySignature(Transaction trans, long uuid, byte[] signature)
int
getID(Transaction trans, java.lang.Object obj)
abstract long[]
getIDsForClass(Transaction trans, ClassMetadata clazz)
NativeQueryHandler
getNativeQueryHandler()
ObjectInfo
getObjectInfo(Transaction trans, java.lang.Object obj)
boolean
handledInCurrentTopLevelCall(ObjectReference ref)
protected void
handleExceptionOnClose(java.lang.Exception exc)
HandlerRegistry
handlers()
protected boolean
hasShutDownHook()
abstract int
idForNewUserObject(Transaction trans)
protected void
initalizeWeakReferenceSupport()
protected void
initialize1(Configuration config)
protected void
initializeClassMetadataRepository()
protected void
initializePostOpenExcludingTransportObjectContainer()
protected void
initializeTransactions()
boolean
isCached(Transaction trans, long id)
boolean
isClient()
overridden in ClientObjectContainer The method allows checking whether will make it easier to refactor than an "instanceof YapClient" check.boolean
isClosed()
tests if this ObjectContainer is closed.abstract boolean
isDeleted(Transaction trans, int id)
boolean
isStored(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.Object
lock()
returns the main synchronization lock.void
logMsg(int code, java.lang.String msg)
boolean
maintainsIndices()
boolean
needsLockFileThread()
void
needsUpdate(ClassMetadata classMetadata)
abstract AbstractQueryResult
newQueryResult(Transaction trans, QueryEvaluationMode mode)
Transaction
newSystemTransaction()
abstract Transaction
newTransaction(Transaction parentTransaction, ReferenceSystem referenceSystem, boolean isSystemTransaction)
Transaction
newUserTransaction()
java.lang.Object
newWeakReference(ObjectReference referent, java.lang.Object obj)
protected void
open()
protected abstract void
openImpl()
java.lang.Object
peekPersisted(Transaction trans, int id, ActivationDepth depth, boolean resetJustPeeked)
java.lang.Object
peekPersisted(Transaction trans, java.lang.Object obj, ActivationDepth depth, boolean committed)
ObjectReference
peekReference(Transaction trans, int id, ActivationDepth depth, boolean resetJustPeeked)
ClassMetadata
produceClassMetadata(ReflectClass claxx)
void
purge()
unloads all clean indices from memory and frees unused objects.void
purge(Transaction trans, java.lang.Object obj)
Query
query(Transaction ta)
ObjectSet
query(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)
ObjectSet
query(Predicate predicate, java.util.Comparator comparator)
Native Query Interface.abstract AbstractQueryResult
queryAllObjects(Transaction ta)
ObjectSet
queryByExample(Transaction trans, java.lang.Object template)
abstract void
raiseCommitTimestamp(long minimumTimestamp)
ByteArrayBuffer
rawBufferByAddress(int address, int length)
java.lang.Object
readActivatedObjectNotInCache(Transaction trans, int id)
abstract ByteArrayBuffer
readBufferById(Transaction trans, int id)
abstract ByteArrayBuffer
readBufferById(Transaction trans, int id, boolean lastCommitted)
abstract void
readBytes(byte[] a_bytes, int a_address, int a_length)
abstract void
readBytes(byte[] bytes, int address, int addressOffset, int length)
abstract ByteArrayBuffer[]
readSlotBuffers(Transaction trans, int[] ids)
abstract StatefulBuffer
readStatefulBufferById(Transaction trans, int id)
abstract StatefulBuffer
readStatefulBufferById(Transaction trans, int id, boolean lastCommitted)
StatefulBuffer
readWriterByAddress(Transaction a_trans, int address, int length)
ReferenceSystemRegistry
referenceSystemRegistry()
GenericReflector
reflector()
Return the reflector currently being used by db4objects.void
refresh(Transaction trans, java.lang.Object obj, int depth)
protected void
refreshInternal(Transaction trans, java.lang.Object obj, int depth)
abstract void
releaseSemaphore(Transaction trans, java.lang.String name)
abstract void
releaseSemaphore(java.lang.String name)
releases a semaphore, if the calling transaction is the owner.abstract void
releaseSemaphores(Transaction ta)
void
replaceClassMetadataRepository(ClassMetadataRepository repository)
void
replicationCallState(int state)
abstract void
reserve(int byteCount)
void
rollback(Transaction trans)
abstract void
rollback1(Transaction trans)
void
send(java.lang.Object obj)
abstract void
setDirtyInSystemTransaction(PersistentBase a_object)
abstract boolean
setSemaphore(Transaction trans, java.lang.String name, int timeout)
abstract boolean
setSemaphore(java.lang.String name, int timeout)
attempts to set a semaphore.void
showInternalClasses(boolean show)
Objects implementing the "Internal4" marker interface are not visible to queries, unless this flag is set to true.abstract void
shutdown()
protected abstract void
shutdownDataStorage()
void
shutdownObjectContainer()
int
stackDepth()
void
stackDepth(int depth)
void
stillToActivate(ActivationContext context)
void
stillToDeactivate(Transaction trans, java.lang.Object a_object, ActivationDepth a_depth, boolean a_forceUnknownDeactivate)
protected void
stopSession()
void
store(Transaction trans, java.lang.Object obj)
int
store(Transaction trans, java.lang.Object obj, UpdateDepth depth)
int
store2(Transaction trans, java.lang.Object obj, UpdateDepth updateDepth, boolean checkJustSet)
int
storeAfterReplication(Transaction trans, java.lang.Object obj, UpdateDepth depth, boolean checkJust)
void
storeAll(Transaction transaction, Iterator4 objects)
void
storeAll(Transaction transaction, Iterator4 objects, UpdateDepth depth)
void
storeByNewReplication(Db4oReplicationReferenceProvider referenceProvider, java.lang.Object obj)
StoredClass
storedClass(Transaction trans, java.lang.Object clazz)
StoredClass[]
storedClasses(Transaction trans)
int
storeInternal(Transaction trans, java.lang.Object obj, boolean checkJustSet)
int
storeInternal(Transaction trans, java.lang.Object obj, UpdateDepth depth, boolean checkJustSet)
LatinStringIO
stringIO()
<R> R
syncExec(Closure4<R> block)
abstract SystemInfo
systemInfo()
returns theSystemInfo
for this ObjectContainer.Transaction
systemTransaction()
ThreadPool4
threadPool()
int
topLevelCallId()
void
topLevelCallId(int id)
java.lang.String
toString()
Transaction
transaction()
java.lang.Object
tryGetByID(Transaction ta, long id)
TypeHandler4
typeHandlerForClass(ReflectClass claxx)
TypeHandler4
typeHandlerForClassMetadataID(int id)
UpdateDepthProvider
updateDepthProvider()
void
useDefaultTransactionTimestamp()
UUIDFieldMetadata
uUIDIndex()
long
version()
returns the current transaction serial number.VersionFieldMetadata
versionIndex()
void
withEnvironment(java.lang.Runnable runnable)
void
withTransaction(Transaction transaction, java.lang.Runnable runnable)
abstract void
writeDirtyClassMetadata()
abstract void
writeNew(Transaction trans, Pointer4 pointer, ClassMetadata classMetadata, ByteArrayBuffer buffer)
abstract void
writeUpdate(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, Db4oIOException
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.
TheStorage
used for backup is the one configured for this container.- Specified by:
backup
in 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, Db4oIOException
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.
TheStorage
used for backup is the one configured for this container.- Specified by:
backupSync
in 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:
ArgumentNullException
java.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:
close
in 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:ExtObjectContainer
returns the Configuration context for this ObjectContainer.- Specified by:
configure
in interfaceExtObjectContainer
- Returns:
Configuration
the 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:
finalize
in 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:
transaction
in interfaceInternalObjectContainer
-
classMetadataForReflectClass
public ClassMetadata classMetadataForReflectClass(ReflectClass claxx)
- Specified by:
classMetadataForReflectClass
in 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:
classMetadataForName
in interfaceInternalObjectContainer
-
classMetadataForID
public ClassMetadata classMetadataForID(int id)
- Specified by:
classMetadataForID
in interfaceInternalObjectContainer
-
handlers
public HandlerRegistry handlers()
- Specified by:
handlers
in 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:
isClient
in interfaceInternalObjectContainer
-
isClosed
public final boolean isClosed()
Description copied from interface:ExtObjectContainer
tests if this ObjectContainer is closed.- Specified by:
isClosed
in 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:ExtObjectContainer
returns all class representations that are known to this ObjectContainer because they have been used or stored.- Specified by:
knownClasses
in 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:ExtObjectContainer
returns 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:
lock
in 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:ExtObjectContainer
unloads 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:
purge
in interfaceExtObjectContainer
-
purge
public final void purge(Transaction trans, java.lang.Object obj)
-
getNativeQueryHandler
public final NativeQueryHandler getNativeQueryHandler()
- Specified by:
getNativeQueryHandler
in 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:ExtObjectContainer
Return the reflector currently being used by db4objects.- Specified by:
reflector
in 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:ExtObjectContainer
releases a semaphore, if the calling transaction is the owner.- Specified by:
releaseSemaphore
in 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:ExtObjectContainer
attempts 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 correspondingObjectServer
is closed.
- C/S only: the clientObjectContainer
looses 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:
setSemaphore
in 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:ExtObjectContainer
returns theSystemInfo
for this ObjectContainer.
TheSystemInfo
supplies methods that provide information about system state and system settings of this ObjectContainer.- Specified by:
systemInfo
in interfaceExtObjectContainer
- Returns:
- the
SystemInfo
for 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:ExtObjectContainer
returns the current transaction serial number.
This serial number can be used to query for modified objects and for replication purposes.- Specified by:
version
in 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:
callbacks
in interfaceInternalObjectContainer
-
callbacks
public void callbacks(Callbacks cb)
- Specified by:
callbacks
in interfaceInternalObjectContainer
-
configImpl
public Config4Impl configImpl()
- Specified by:
configImpl
in 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:
container
in interfaceInternalObjectContainer
-
deleteByID
public void deleteByID(Transaction transaction, int id, int cascadeDeleteDepth)
-
syncExec
public <R> R syncExec(Closure4<R> block)
- Specified by:
syncExec
in interfaceInternalObjectContainer
-
query
public ObjectSet query(Predicate predicate, java.util.Comparator comparator)
Description copied from interface:ObjectContainer
Native Query Interface. Queries as withObjectContainer.query(com.db4o.query.Predicate)
, but will sort the resultingObjectSet
according to the givenComparator
.- Specified by:
query
in interfaceObjectContainer
- Parameters:
predicate
- thePredicate
containing the native query expression.comparator
- the java.util.Comparator specifying the sort order of the result- Returns:
- the
ObjectSet
returned by the query.
-
storeAll
public void storeAll(Transaction transaction, Iterator4 objects)
- Specified by:
storeAll
in 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:
toString
in 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:
updateDepthProvider
in interfaceInternalObjectContainer
-
replaceClassMetadataRepository
public void replaceClassMetadataRepository(ClassMetadataRepository repository)
-
generateTransactionTimestamp
public final long generateTransactionTimestamp(long forcedTimestamp)
-
useDefaultTransactionTimestamp
public final void useDefaultTransactionTimestamp()
-
-