abdullah alamoudi has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/2839

Change subject: [NO ISSUE][STO] Notify completiong of IO request in finally
......................................................................

[NO ISSUE][STO] Notify completiong of IO request in finally

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Notify completion of a request in a finally clause to ensure
  waiting thread is always notified.

Change-Id: I8b3003b47b6b181856faf82aca6e828ee014527c
---
M 
hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IoRequest.java
1 file changed, 6 insertions(+), 4 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/39/2839/1

diff --git 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IoRequest.java
 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IoRequest.java
index 8c81d41..93e38f5 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IoRequest.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IoRequest.java
@@ -44,7 +44,7 @@
     private long offset;
     private ByteBuffer data;
     private ByteBuffer[] dataArray;
-    private HyracksDataException failure;
+    private Throwable failure;
     private int read;
     private int write;
     private long writes;
@@ -133,15 +133,17 @@
             state = State.OPERATION_SUCCEEDED;
         } catch (Throwable th) { // NOSONAR: This method must never throw 
anything
             state = State.OPERATION_FAILED;
-            failure = HyracksDataException.create(th);
+            failure = th;
+        } finally {
+            notifyAll();
         }
-        notifyAll();
     }
 
     public State getState() {
         return state;
     }
 
+    @SuppressWarnings("squid:S899") // Offer failing means we're over capacity 
and this should be garbage collected
     void recycle() {
         reset();
         freeRequests.offer(this);
@@ -165,6 +167,6 @@
     }
 
     public HyracksDataException getFailure() {
-        return failure;
+        return HyracksDataException.create(failure);
     }
 }

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2839
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8b3003b47b6b181856faf82aca6e828ee014527c
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi <[email protected]>

Reply via email to