| java.lang.Object org.ozoneDB.AbstractDatabase org.ozoneDB.ExternalDatabase org.ozoneDB.ClientCacheDatabase
ClientCacheDatabase | public class ClientCacheDatabase extends ExternalDatabase (Code) | | This is an
ExternalDatabase that implements a client side cache on
top of another
ExternalDatabase .
In contrast to
LocalDatabase and
RemoteDatabase which
produce the exactly same results for the same code, this implementation of
ExternalDatabase is not guaranteed to do so.
Note: The method parameters of type
OzoneRemote are supposed to by
proxy objects (of type
OzoneProxy ). However, it's possible to pass
a database objects (of type
OzoneCompatible ). In this case the
parameter should be substituted. Currently this is done by the invoke()
method only.
Impl. Note: All interface methods are synchronized because they have to be
executed as an atomar operation.
author: SMB version: $Revision: 1.2 $Date: 2002/06/08 00:49:38 $ See Also: OzoneInterface |
Constructor Summary | |
public | ClientCacheDatabase(ExternalDatabase _delegate) Constructs a new ClientCacheDatabase with the given delegate as
back-end.
Note: The size of the client side cache can be adjusted via the heap
size of the VM (parameter -Xmx). | public | ClientCacheDatabase(ExternalDatabase _delegate, boolean _debug) Constructs a new ClientCacheDatabase with the given delegate as
back-end and the given debug option.
Note: The size of the client side cache can be adjusted via the heap
size of the VM (parameter -Xmx). |
Method Summary | |
protected synchronized void | abortCache() Throws away all modified containers. | public void | beginTX(AbstractTransaction tx) | protected void | calcMemory() Initialize the internal memory counter so that freeMemory() returns
correct results. | public void | checkpointTX(AbstractTransaction tx) | public void | close() | public synchronized void | commitTX(AbstractTransaction tx, boolean onePhase) | public synchronized OzoneProxy | copyObject(OzoneRemote obj) | public synchronized OzoneProxy | createObject(String className, int access, String name, String sig, Object[] args) | public ExternalDatabase | delegate() | public synchronized void | deleteObject(OzoneRemote obj) | protected synchronized void | ensureSpace(long neededSpace) Try to free the specified amount of cache space. | public OzoneCompatible | fetch(OzoneProxy proxy, int lockLevel) | protected CacheObjectContainer | fetch0(ObjectID id, int lockLevel) Fetch the object with the specified ObjectID from the server.
Parameters: proxy - The proxy that specifies the object to fetch. | protected synchronized CacheObjectContainer | fetchChunk(ObjectID rootID, int size) | protected void | finalize() | public long | freeMemory() Return the amount of *total* free memory in the system. | public Object | invoke(OzoneProxy proxy, String methodName, String sig, Object[] args, int lockLevel) | public Object | invoke(OzoneProxy proxy, int methodIndex, Object[] args, int lockLevel) | public boolean | isOpen() | public void | joinTX(AbstractTransaction tx) | public boolean | leaveTX(AbstractTransaction tx) | public synchronized void | nameObject(OzoneRemote obj, String name) | protected DbClient | newConnection() | public ExternalTransaction | newTransaction() | protected synchronized ObjectID | nextID() | public synchronized OzoneProxy | objectForName(String name) | public OzoneProxy[] | objectsOfClass(String name) | protected void | open(Hashtable _props) | public synchronized void | prepareTX(AbstractTransaction tx) | public void | reloadClasses() Force the database server to reload all classes which extend
OzoneObject. | public synchronized void | rollbackTX(AbstractTransaction tx) | protected Object | sendCommand(DbCommand command, boolean waitForResult, DbClient connection) | protected synchronized void | syncCache() Synchronize all changed objects with the server. | protected synchronized void | updateModTimes() Update the modification times of all currently modified containers. |
ClientCacheDatabase | public ClientCacheDatabase(ExternalDatabase _delegate)(Code) | | Constructs a new ClientCacheDatabase with the given delegate as
back-end.
Note: The size of the client side cache can be adjusted via the heap
size of the VM (parameter -Xmx). The cache uses all available heap in
its VM.
Parameters: _delegate - The back-end database. |
ClientCacheDatabase | public ClientCacheDatabase(ExternalDatabase _delegate, boolean _debug)(Code) | | Constructs a new ClientCacheDatabase with the given delegate as
back-end and the given debug option.
Note: The size of the client side cache can be adjusted via the heap
size of the VM (parameter -Xmx). The cache uses all available heap in
its VM.
Parameters: _delegate - The back-end database. Parameters: _debug - |
abortCache | protected synchronized void abortCache()(Code) | | Throws away all modified containers. Clears idTable and nameTable.
|
calcMemory | protected void calcMemory()(Code) | | Initialize the internal memory counter so that freeMemory() returns
correct results.
|
ensureSpace | protected synchronized void ensureSpace(long neededSpace)(Code) | | Try to free the specified amount of cache space. This will remove
containers from the cache that are currently not used by a transaction
|
fetch0 | protected CacheObjectContainer fetch0(ObjectID id, int lockLevel) throws Exception(Code) | | Fetch the object with the specified ObjectID from the server.
Parameters: proxy - The proxy that specifies the object to fetch. The transaction for the current thread. |
freeMemory | public long freeMemory()(Code) | | Return the amount of *total* free memory in the system. The results
returned by Runtime.freeMemory() may change overtime and so its
useless for ozone.
Note: this will not work properly if some kind of weal references are
used in this VM. In case of empty space we need to force teh GC to also
free weak references.
|
reloadClasses | public void reloadClasses() throws Exception(Code) | | Force the database server to reload all classes which extend
OzoneObject. This is useful while testing new classes.
|
syncCache | protected synchronized void syncCache() throws Exception(Code) | | Synchronize all changed objects with the server. This does not commits
the transaction but only transfers all changed objects back to the
server.
|
updateModTimes | protected synchronized void updateModTimes()(Code) | | Update the modification times of all currently modified containers. This
method should be called after prepareTX only.
|
Methods inherited from org.ozoneDB.ExternalDatabase | final protected DbClient acquirePooledConnection() throws Exception(Code)(Java Doc) public Admin admin() throws Exception(Code)(Java Doc) public void beginTX(AbstractTransaction tx) throws TransactionExc, IOException(Code)(Java Doc) public void checkpointTX(AbstractTransaction tx) throws TransactionExc, IOException(Code)(Java Doc) public synchronized void close() throws Exception(Code)(Java Doc) final protected Object commandTX(AbstractTransaction tx, DbTransaction command) throws TransactionExc, IOException(Code)(Java Doc) public void commitTX(AbstractTransaction tx, boolean onePhase) throws TransactionExc, IOException(Code)(Java Doc) public OzoneProxy copyObject(OzoneRemote obj) throws Exception(Code)(Java Doc) public OzoneProxy createObject(String className, int access, String name, String sig, Object[] args) throws RuntimeException, ExceptionInOzoneObjectException(Code)(Java Doc) protected static Hashtable createProps(String _url) throws MalformedURLException(Code)(Java Doc) public ExternalTransaction currentExternalTransaction()(Code)(Java Doc) public AbstractTransaction currentTransaction()(Code)(Java Doc) public void deleteObject(OzoneRemote obj) throws RuntimeException, ExceptionInOzoneObjectException(Code)(Java Doc) public OzoneCompatible fetch(OzoneProxy rObj, int lockLevel) throws Exception(Code)(Java Doc) protected void finalize() throws Throwable(Code)(Java Doc) public static ExternalDatabase forThread(Thread _thread)(Code)(Java Doc) final public int getStatusTX(AbstractTransaction tx) throws TransactionExc, IOException(Code)(Java Doc) final public XAResource getXAResource()(Code)(Java Doc) public Object invoke(OzoneProxy rObj, String methodName, String sig, Object[] args, int lockLevel) throws Exception(Code)(Java Doc) public Object invoke(OzoneProxy rObj, int methodIndex, Object[] args, int lockLevel) throws Exception(Code)(Java Doc) public boolean isOpen() throws Exception(Code)(Java Doc) public void joinTX(AbstractTransaction tx) throws TransactionExc(Code)(Java Doc) public boolean leaveTX(AbstractTransaction tx)(Code)(Java Doc) protected ExternalDatabase linkForProxy(OzoneProxy proxy)(Code)(Java Doc) public void nameObject(OzoneRemote obj, String name) throws Exception(Code)(Java Doc) abstract protected DbClient newConnection() throws Exception(Code)(Java Doc) public ExternalTransaction newTransaction()(Code)(Java Doc) public void notifyProxyDeath(OzoneProxy proxy)(Code)(Java Doc) public OzoneProxy objectForHandle(String handle) throws Exception(Code)(Java Doc) public OzoneProxy objectForName(String name) throws Exception(Code)(Java Doc) public OzoneProxy[] objectsOfClass(String name) throws Exception(Code)(Java Doc) protected void open(Hashtable _props) throws Exception(Code)(Java Doc) public static ExternalDatabase openDatabase(String _url, String _username, String _passwd) throws Exception(Code)(Java Doc) public static ExternalDatabase openDatabase(String _url) throws Exception(Code)(Java Doc) public void prepareTX(AbstractTransaction tx) throws TransactionExc, IOException(Code)(Java Doc) final protected void releasePooledConnection(DbClient connection)(Code)(Java Doc) public void reloadClasses() throws Exception(Code)(Java Doc) public void rollbackTX(AbstractTransaction tx) throws TransactionExc, IOException(Code)(Java Doc) final protected Object sendCommand(DbCommand command, boolean waitForResult) throws Exception(Code)(Java Doc) protected Object sendCommand(DbCommand command, boolean waitForResult, DbClient connection) throws Exception, ExceptionInOzoneObjectException(Code)(Java Doc) protected synchronized void setWrapper(ExternalDatabase _wrapper)(Code)(Java Doc) final protected AbstractTransaction txForThread(Thread thread)(Code)(Java Doc) public Node xmlForObject(OzoneRemote rObj, Document domFactory) throws Exception(Code)(Java Doc) public void xmlForObject(OzoneRemote rObj, ContentHandler ch) throws Exception(Code)(Java Doc)
|
Fields inherited from org.ozoneDB.AbstractDatabase | final public static int DefaultAccessRight(Code)(Java Doc)
|
Methods inherited from org.ozoneDB.AbstractDatabase | public OzoneProxy createObject(String className) throws RuntimeException(Code)(Java Doc) public OzoneProxy createObject(String className, int access) throws RuntimeException(Code)(Java Doc) public OzoneProxy createObject(String className, int access, String objName) throws RuntimeException(Code)(Java Doc) public OzoneProxy createObject(String className, String sig, Object[] args) throws RuntimeException(Code)(Java Doc) public OzoneProxy createObject(Class type) throws RuntimeException(Code)(Java Doc) public OzoneProxy createObject(Class type, int access) throws RuntimeException(Code)(Java Doc) public OzoneProxy createObject(Class type, int access, String objName) throws RuntimeException(Code)(Java Doc) public OzoneProxy createObject(Class type, int access, String objName, String sig, Object[] args) throws RuntimeException(Code)(Java Doc) public OzoneProxy createObject(Class type, String sig, Object[] args) throws RuntimeException(Code)(Java Doc)
|
|
|