Skip to main content

[xadisk~svn:535] Changes for JIRA issue #133.

  • From: nitin_verma@...
  • To: commits@...
  • Subject: [xadisk~svn:535] Changes for JIRA issue #133.
  • Date: Wed, 14 Aug 2013 18:35:23 +0000

Project:    xadisk
Repository: svn
Revision:   535
Author:     nitin_verma
Date:       2013-08-14 18:35:21 UTC
Link:       

Log Message:
------------
Changes for JIRA issue #133.


Revisions:
----------
535


Modified Paths:
---------------
trunk/src/org/xadisk/filesystem/virtual/NativeXAFileInputStream.java
trunk/src/org/xadisk/filesystem/NativeSession.java
trunk/src/org/xadisk/filesystem/virtual/NativeXAFileOutputStream.java


Diffs:
------
Index: trunk/src/org/xadisk/filesystem/NativeSession.java
===================================================================
--- trunk/src/org/xadisk/filesystem/NativeSession.java  (revision 534)
+++ trunk/src/org/xadisk/filesystem/NativeSession.java  (revision 535)
@@ -55,6 +55,7 @@
     private Throwable rollbackCause = null;
     private volatile boolean systemHasFailed = false;
     private volatile boolean systemGotShutdown = false;
+    private volatile boolean operationsCanContinue = true;
     private volatile Throwable systemFailureCause = null;
     private final TransactionVirtualView view;
     private long fileLockWaitTimeout = 0;
@@ -121,6 +122,7 @@
         try {
             rollback();
             this.rolledbackPrematurely = true;
+            this.operationsCanContinue = false;
             this.rollbackCause = rollbackCause;
         } catch (TransactionRolledbackException trbe) {
         } catch (NoTransactionAssociatedException note) {
@@ -129,11 +131,13 @@
 
     void notifySystemFailure(Throwable systemFailureCause) {
         this.systemHasFailed = true;
+        this.operationsCanContinue = false;
         this.systemFailureCause = systemFailureCause;
     }
 
     void notifySystemShutdown() {
         this.systemGotShutdown = true;
+        this.operationsCanContinue = false;
     }
 
     public NativeXAFileInputStream createXAFileInputStream(File f)
@@ -999,6 +1003,7 @@
 
     private void cleanup() throws IOException {
         this.sessionIsUseless = true;
+        this.operationsCanContinue = false;
         if (createdForRecovery) {
             xaFileSystem.getRecoveryWorker().cleanupTransactionInfo(xid);
         } else {
@@ -1142,18 +1147,22 @@
     }
 
     public void checkIfCanContinue() throws NoTransactionAssociatedException 
{
-        if (rolledbackPrematurely) {
-            throw new TransactionRolledbackException(rollbackCause);
+        if(operationsCanContinue) {
+            return;
+        } else {
+            if (rolledbackPrematurely) {
+                throw new TransactionRolledbackException(rollbackCause);
+            }
+            if (sessionIsUseless) {
+                throw new NoTransactionAssociatedException();
+            }
+            if (systemHasFailed) {
+                throw new 
XASystemNoMoreAvailableException(systemFailureCause);
+            }
+            if(systemGotShutdown) {
+                throw new XASystemNoMoreAvailableException();
+            }
         }
-        if (sessionIsUseless) {
-            throw new NoTransactionAssociatedException();
-        }
-        if (systemHasFailed) {
-            throw new XASystemNoMoreAvailableException(systemFailureCause);
-        }
-        if(systemGotShutdown) {
-            throw new XASystemNoMoreAvailableException();
-        }
     }
 
     public void declareTransactionUsingUndoLogs() throws IOException {
Index: trunk/src/org/xadisk/filesystem/virtual/NativeXAFileInputStream.java
===================================================================
--- trunk/src/org/xadisk/filesystem/virtual/NativeXAFileInputStream.java      
  (revision 534)
+++ trunk/src/org/xadisk/filesystem/virtual/NativeXAFileInputStream.java      
  (revision 535)
@@ -315,9 +315,6 @@
     }
 
     private void checkIfCanContinue() throws 
NoTransactionAssociatedException, ClosedStreamException {
-        if (closed) {
-            throw new ClosedStreamException();
-        }
         owningSession.checkIfCanContinue();
     }
 
Index: trunk/src/org/xadisk/filesystem/virtual/NativeXAFileOutputStream.java
===================================================================
--- trunk/src/org/xadisk/filesystem/virtual/NativeXAFileOutputStream.java     
  (revision 534)
+++ trunk/src/org/xadisk/filesystem/virtual/NativeXAFileOutputStream.java     
  (revision 535)
@@ -167,9 +167,6 @@
     }
 
     private void checkIfCanContinue() throws 
NoTransactionAssociatedException, ClosedStreamException {
-        if (closed) {
-            throw new ClosedStreamException();
-        }
         owningSession.checkIfCanContinue();
     }
 





[xadisk~svn:535] Changes for JIRA issue #133.

nitin_verma 08/14/2013
 
 
Close
loading
Please Confirm
Close