db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/odmg/locking LockManagerDefaultImpl.java
Date Thu, 11 Dec 2003 20:28:10 GMT
arminw      2003/12/11 12:28:10

  Modified:    src/java/org/apache/ojb/odmg/locking
                        LockManagerDefaultImpl.java
  Log:
  synchronize all methods to make locking "threadsafe"
  
  Revision  Changes    Path
  1.5       +7 -13     db-ojb/src/java/org/apache/ojb/odmg/locking/LockManagerDefaultImpl.java
  
  Index: LockManagerDefaultImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/locking/LockManagerDefaultImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LockManagerDefaultImpl.java	6 Feb 2003 21:34:10 -0000	1.4
  +++ LockManagerDefaultImpl.java	11 Dec 2003 20:28:10 -0000	1.5
  @@ -86,15 +86,9 @@
    */
   public class LockManagerDefaultImpl implements LockManager
   {
  -
       private Logger log = LoggerFactory.getLogger(LockManagerDefaultImpl.class);
   
  -    /**
  -     *
  -     * LockManagerDefaultImpl constructor comment.
  -     *
  -     */
  -    LockManagerDefaultImpl()
  +    public LockManagerDefaultImpl()
       {
           super();
       }
  @@ -103,7 +97,7 @@
        * aquires a readlock for transaction tx on object obj.
        * Returns true if successful, else false.
        */
  -    public boolean readLock(TransactionImpl tx, Object obj)
  +    public synchronized boolean readLock(TransactionImpl tx, Object obj)
       {
           if (log.isDebugEnabled()) log.debug("LM.readLock(tx-" + tx.getGUID() + ", " + new
Identity(obj, tx.getBroker()).toString() + ")");
           LockStrategy lockStrategy = LockStrategyFactory.getStrategyFor(obj);
  @@ -114,7 +108,7 @@
        * aquires a writelock for transaction tx on object obj.
        * Returns true if successful, else false.
        */
  -    public boolean writeLock(TransactionImpl tx, Object obj)
  +    public synchronized boolean writeLock(TransactionImpl tx, Object obj)
       {
           if (log.isDebugEnabled()) log.debug("LM.writeLock(tx-" + tx.getGUID() + ", " +
new Identity(obj, tx.getBroker()).toString() + ")");
           LockStrategy lockStrategy = LockStrategyFactory.getStrategyFor(obj);
  @@ -126,7 +120,7 @@
        * If no readlock existed a writelock is acquired anyway.
        * Returns true if successful, else false.
        */
  -    public boolean upgradeLock(TransactionImpl tx, Object obj)
  +    public synchronized boolean upgradeLock(TransactionImpl tx, Object obj)
       {
           if (log.isDebugEnabled()) log.debug("LM.upgradeLock(tx-" + tx.getGUID() + ", "
+ new Identity(obj, tx.getBroker()).toString() + ")");
           LockStrategy lockStrategy = LockStrategyFactory.getStrategyFor(obj);
  @@ -137,7 +131,7 @@
        * releases a lock for transaction tx on object obj.
        * Returns true if successful, else false.
        */
  -    public boolean releaseLock(TransactionImpl tx, Object obj)
  +    public synchronized boolean releaseLock(TransactionImpl tx, Object obj)
       {
           if (log.isDebugEnabled()) log.debug("LM.releaseLock(tx-" + tx.getGUID() + ", "
+ new Identity(obj, tx.getBroker()).toString() + ")");
           LockStrategy lockStrategy = LockStrategyFactory.getStrategyFor(obj);
  @@ -148,7 +142,7 @@
        * checks if there is a readlock for transaction tx on object obj.
        * Returns true if so, else false.
        */
  -    public boolean checkRead(TransactionImpl tx, Object obj)
  +    public synchronized boolean checkRead(TransactionImpl tx, Object obj)
       {
           if (log.isDebugEnabled()) log.debug("LM.checkRead(tx-" + tx.getGUID() + ", " +
new Identity(obj, tx.getBroker()).toString() + ")");
           LockStrategy lockStrategy = LockStrategyFactory.getStrategyFor(obj);
  @@ -159,7 +153,7 @@
        * checks if there is a writelock for transaction tx on object obj.
        * Returns true if so, else false.
        */
  -    public boolean checkWrite(TransactionImpl tx, Object obj)
  +    public synchronized boolean checkWrite(TransactionImpl tx, Object obj)
       {
           if (log.isDebugEnabled()) log.debug("LM.checkWrite(tx-" + tx.getGUID() + ", " +
new Identity(obj, tx.getBroker()).toString() + ")");
           LockStrategy lockStrategy = LockStrategyFactory.getStrategyFor(obj);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message