commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ozeigerm...@apache.org
Subject cvs commit: jakarta-commons/transaction/src/java/org/apache/commons/transaction/file ResourceManager.java FileResourceManager.java
Date Thu, 16 Dec 2004 17:33:53 GMT
ozeigermann    2004/12/16 09:33:53

  Modified:    transaction RELEASE-NOTES.txt
               transaction/src/java/org/apache/commons/transaction/file
                        ResourceManager.java FileResourceManager.java
  Log:
  Removed 1.0 API incompatibility
  
  Revision  Changes    Path
  1.5       +0 -2      jakarta-commons/transaction/RELEASE-NOTES.txt
  
  Index: RELEASE-NOTES.txt
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/transaction/RELEASE-NOTES.txt,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RELEASE-NOTES.txt	14 Dec 2004 12:13:35 -0000	1.4
  +++ RELEASE-NOTES.txt	16 Dec 2004 17:33:52 -0000	1.5
  @@ -40,8 +40,6 @@
   -----------------------------------------
   
   - LockException has been moved from memory to locking package
  -- defunct ResourceManager interface no longer claims to return a boolean
  -  on lockResource
   
   BUGFIXES FROM 1.0
   -----------------
  
  
  
  1.3       +4 -3      jakarta-commons/transaction/src/java/org/apache/commons/transaction/file/ResourceManager.java
  
  Index: ResourceManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/transaction/src/java/org/apache/commons/transaction/file/ResourceManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ResourceManager.java	14 Dec 2004 12:12:46 -0000	1.2
  +++ ResourceManager.java	16 Dec 2004 17:33:53 -0000	1.3
  @@ -315,9 +315,10 @@
        * @param wait <code>true</code> if the method shall block when lock can
not be acquired now
        * @param timeoutMSecs timeout in milliseconds
        * @param reentrant <code>true</code> if the lock should be acquired even
when the <em>requesting transaction and no other</em> holds an incompatible lock
  +     * @return <code>true</code> when the lock has been acquired
        * @throws ResourceManagerException if an error occured
        */
  -    public void lockResource(
  +    public boolean lockResource(
           Object resourceId,
           Object txId,
           boolean shared,
  @@ -336,7 +337,7 @@
        * @throws ResourceManagerException if an error occured
        * @see #lockResource(Object, Object, boolean, boolean, long, boolean)
        */
  -    public void lockResource(Object resourceId, Object txId, boolean shared) throws ResourceManagerException;
  +    public boolean lockResource(Object resourceId, Object txId, boolean shared) throws
ResourceManagerException;
   
       /**
        * Explicitly locks a resource exclusively, i.e. for writing, in reentrant style. This
method blocks until the lock
  @@ -348,7 +349,7 @@
        * @see #lockResource(Object, Object, boolean)
        * @see #lockResource(Object, Object, boolean, boolean, long, boolean)
        */
  -    public void lockResource(Object resourceId, Object txId) throws ResourceManagerException;
  +    public boolean lockResource(Object resourceId, Object txId) throws ResourceManagerException;
   
       /**
        * Checks if a resource exists. 
  
  
  
  1.4       +16 -7     jakarta-commons/transaction/src/java/org/apache/commons/transaction/file/FileResourceManager.java
  
  Index: FileResourceManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/transaction/src/java/org/apache/commons/transaction/file/FileResourceManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FileResourceManager.java	14 Dec 2004 12:12:46 -0000	1.3
  +++ FileResourceManager.java	16 Dec 2004 17:33:53 -0000	1.4
  @@ -275,15 +275,19 @@
        *  
        */
   
  -    public void lockResource(Object resourceId, Object txId) throws ResourceManagerException
{
  +    public boolean lockResource(Object resourceId, Object txId) throws ResourceManagerException
{
           lockResource(resourceId, txId, false);
  +        // XXX will never return false as it will either throw or return true
  +        return true;
       }
   
  -    public void lockResource(Object resourceId, Object txId, boolean shared) throws ResourceManagerException
{
  +    public boolean lockResource(Object resourceId, Object txId, boolean shared) throws
ResourceManagerException {
           lockResource(resourceId, txId, shared, true, Long.MAX_VALUE, true);
  +        // XXX will never return false as it will either throw or return true
  +        return true;
       }
   
  -    public void lockResource(
  +    public boolean lockResource(
           Object resourceId,
           Object txId,
           boolean shared,
  @@ -301,6 +305,8 @@
           try {
               lockManager.lock(txId, resourceId, level, reentrant, Math.min(timeoutMSecs,
                       context.timeoutMSecs));
  +            // XXX will never return false as it will either throw or return true
  +            return true;
           } catch (LockException e) {
               switch (e.getCode()) {
               case LockException.CODE_INTERRUPTED:
  @@ -311,6 +317,9 @@
                           + "'", ERR_NO_LOCK, txId);
               case LockException.CODE_DEADLOCK_VICTIM:
                   throw new ResourceManagerException("Deadlock victim resource at '" + resourceId
  +                        + "'", ERR_DEAD_LOCK, txId);
  +            default :
  +                throw new ResourceManagerException("Locking exception for resource at '"
+ resourceId
                           + "'", ERR_DEAD_LOCK, txId);
               }
           }
  
  
  

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


Mime
View raw message