org.apache.ojb.odmg.locking
Class RemoteLockMapImpl

java.lang.Object
  extended byorg.apache.ojb.odmg.locking.RemoteLockMapImpl
All Implemented Interfaces:
Configurable, LockMap

public class RemoteLockMapImpl
extends java.lang.Object
implements LockMap, Configurable

Servlet based lock mechanism for usage in distributed environment.

Version:
$Id: RemoteLockMapImpl.java,v 1.1 2004/01/17 16:57:34 thma Exp $
Author:
Thomas Mahler

Constructor Summary
RemoteLockMapImpl()
           
 
Method Summary
 boolean addReader(TransactionImpl tx, java.lang.Object obj)
          Add a reader lock entry for transaction tx on object obj to the persistent storage.
 void configure(Configuration pConfig)
          configure an object using the Configuration pConfig
 java.util.Collection getReaders(java.lang.Object obj)
          returns a collection of Reader LockEntries for object obj.
 LockEntry getWriter(java.lang.Object obj)
          returns the LockEntry for the Writer of object obj.
 boolean hasReadLock(TransactionImpl tx, java.lang.Object obj)
          check if there is a reader lock entry for transaction tx on object obj in the persistent storage.
 void removeReader(TransactionImpl tx, java.lang.Object obj)
          remove a reader lock entry for transaction tx on object obj from the persistent storage.
 void removeWriter(LockEntry writer)
          remove a writer lock entry for transaction tx on object obj from the persistent storage.
 byte[] serialize(java.lang.Object obj)
           
 boolean setWriter(TransactionImpl tx, java.lang.Object obj)
          generate a writer lock entry for transaction tx on object obj and write it to the persistent storage.
 boolean upgradeLock(LockEntry reader)
          upgrade a reader lock entry for transaction tx on object obj and write it to the persistent storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteLockMapImpl

public RemoteLockMapImpl()
Method Detail

getWriter

public LockEntry getWriter(java.lang.Object obj)
returns the LockEntry for the Writer of object obj. If now writer exists, null is returned.

Specified by:
getWriter in interface LockMap

getReaders

public java.util.Collection getReaders(java.lang.Object obj)
returns a collection of Reader LockEntries for object obj. If now LockEntries could be found an empty Vector is returned.

Specified by:
getReaders in interface LockMap

addReader

public boolean addReader(TransactionImpl tx,
                         java.lang.Object obj)
Add a reader lock entry for transaction tx on object obj to the persistent storage.

Specified by:
addReader in interface LockMap

serialize

public byte[] serialize(java.lang.Object obj)
                 throws java.io.IOException
Throws:
java.io.IOException

removeReader

public void removeReader(TransactionImpl tx,
                         java.lang.Object obj)
remove a reader lock entry for transaction tx on object obj from the persistent storage.

Specified by:
removeReader in interface LockMap

removeWriter

public void removeWriter(LockEntry writer)
remove a writer lock entry for transaction tx on object obj from the persistent storage.

Specified by:
removeWriter in interface LockMap

upgradeLock

public boolean upgradeLock(LockEntry reader)
upgrade a reader lock entry for transaction tx on object obj and write it to the persistent storage.

Specified by:
upgradeLock in interface LockMap

setWriter

public boolean setWriter(TransactionImpl tx,
                         java.lang.Object obj)
generate a writer lock entry for transaction tx on object obj and write it to the persistent storage.

Specified by:
setWriter in interface LockMap

hasReadLock

public boolean hasReadLock(TransactionImpl tx,
                           java.lang.Object obj)
check if there is a reader lock entry for transaction tx on object obj in the persistent storage.

Specified by:
hasReadLock in interface LockMap

configure

public void configure(Configuration pConfig)
               throws ConfigurationException
Description copied from interface: Configurable
configure an object using the Configuration pConfig

Specified by:
configure in interface Configurable
Parameters:
pConfig - the Configuration object used to configure current instance
Throws:
ConfigurationException
See Also:
Configurable.configure(org.apache.ojb.broker.util.configuration.Configuration)


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14