qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject [11/38] qpid-proton git commit: PROTON-881: Tidy up Selectable to remove bits of a c style record implementation
Date Sun, 05 Jul 2015 23:45:12 GMT
PROTON-881: Tidy up Selectable to remove bits of a c style record implementation


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/51529f67
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/51529f67
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/51529f67

Branch: refs/heads/master
Commit: 51529f675a11f49089e4a50a6bbced3955c26d63
Parents: 1eb41f6
Author: Adrian Preston <prestona@uk.ibm.com>
Authored: Fri May 1 15:55:07 2015 +0100
Committer: Adrian Preston <prestona@uk.ibm.com>
Committed: Wed May 6 23:24:35 2015 +0100

----------------------------------------------------------------------
 .../apache/qpid/proton/reactor/Selectable.java  | 12 ----------
 .../qpid/proton/reactor/impl/ReactorImpl.java   |  9 ++++----
 .../proton/reactor/impl/SelectableImpl.java     | 24 ++++++++------------
 3 files changed, 14 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/51529f67/proton-j/src/main/java/org/apache/qpid/proton/reactor/Selectable.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/reactor/Selectable.java b/proton-j/src/main/java/org/apache/qpid/proton/reactor/Selectable.java
index 7bb64c7..390685f 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/reactor/Selectable.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/reactor/Selectable.java
@@ -87,20 +87,8 @@ public interface Selectable extends ReactorChild {
     public Reactor getReactor() ;
     public void terminate() ;
 
-    public enum RecordKeyType {
-        PNI_TERMINATED
-    }
-
-    public enum RecordValueType {
-        PN_VOID
-    }
-
-    public boolean hasRecord(RecordKeyType type);
-
-    public void setRecord(RecordKeyType key, RecordValueType value) ;
     public boolean isTerminal();
 
-
     public Transport getTransport() ;
 
     public void setTransport(Transport transport) ;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/51529f67/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/ReactorImpl.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/ReactorImpl.java b/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/ReactorImpl.java
index 9c4f817..684d8f8 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/ReactorImpl.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/ReactorImpl.java
@@ -42,8 +42,6 @@ import org.apache.qpid.proton.reactor.Reactor;
 import org.apache.qpid.proton.reactor.ReactorChild;
 import org.apache.qpid.proton.reactor.Selectable;
 import org.apache.qpid.proton.reactor.Selectable.Callback;
-import org.apache.qpid.proton.reactor.Selectable.RecordKeyType;
-import org.apache.qpid.proton.reactor.Selectable.RecordValueType;
 import org.apache.qpid.proton.reactor.Selector;
 import org.apache.qpid.proton.reactor.Task;
 
@@ -224,9 +222,10 @@ public class ReactorImpl implements Reactor {
 
     @Override
     public void update(Selectable selectable) {
-        if (!selectable.hasRecord(RecordKeyType.PNI_TERMINATED)) {
-            if (selectable.isTerminal()) {
-                selectable.setRecord(RecordKeyType.PNI_TERMINATED, RecordValueType.PN_VOID);
+        SelectableImpl selectableImpl = (SelectableImpl)selectable;
+        if (!selectableImpl.isTerminated()) {
+            if (selectableImpl.isTerminal()) {
+                selectableImpl.terminated();
                 collector.put(Type.SELECTABLE_FINAL, selectable);
             } else {
                 collector.put(Type.SELECTABLE_UPDATED, selectable);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/51529f67/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/SelectableImpl.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/SelectableImpl.java
b/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/SelectableImpl.java
index 7d911a5..2ddb372 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/SelectableImpl.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/SelectableImpl.java
@@ -22,7 +22,6 @@
 package org.apache.qpid.proton.reactor.impl;
 
 import java.nio.channels.SelectableChannel;
-import java.util.HashMap;
 
 import org.apache.qpid.proton.engine.BaseHandler;
 import org.apache.qpid.proton.engine.Collector;
@@ -51,6 +50,7 @@ public class SelectableImpl implements Selectable {
     private Reactor reactor;
     private Transport transport;
     private boolean terminal;
+    private boolean terminated;
 
     @Override
     public boolean isReading() {
@@ -225,24 +225,11 @@ public class SelectableImpl implements Selectable {
         terminal = true;
     }
 
-    private final HashMap<RecordKeyType, RecordValueType> records = new HashMap<RecordKeyType,
RecordValueType>();
-
-    @Override
-    public boolean hasRecord(RecordKeyType type) {
-        return records.containsKey(type);
-    }
-
-    @Override
-    public void setRecord(RecordKeyType key, RecordValueType value) {
-        records.put(key, value);
-    }
-
     @Override
     public boolean isTerminal() {
         return terminal;
     }
 
-
     @Override
     public Transport getTransport() {
         return transport;
@@ -272,4 +259,13 @@ public class SelectableImpl implements Selectable {
     public Handler getHandler() {
         return _handler;
     }
+
+
+    public boolean isTerminated() {
+        return terminated;
+    }
+
+    public void terminated() {
+        terminated = true;
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message