You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2015/07/06 01:45:26 UTC

[25/38] qpid-proton git commit: added launcher script for examples; added null check to IOHandler.java

added launcher script for examples; added null check to IOHandler.java


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

Branch: refs/heads/master
Commit: 1cbba24d6caadf5431429196e8430ae1041dc5da
Parents: 76cb49a
Author: Rafael Schloming <rh...@alum.mit.edu>
Authored: Tue May 12 18:19:23 2015 -0400
Committer: Rafael Schloming <rh...@alum.mit.edu>
Committed: Tue May 12 18:19:23 2015 -0400

----------------------------------------------------------------------
 examples/java/reactor/run                              |  4 ++++
 .../org/apache/qpid/proton/reactor/impl/IOHandler.java | 13 ++++++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1cbba24d/examples/java/reactor/run
----------------------------------------------------------------------
diff --git a/examples/java/reactor/run b/examples/java/reactor/run
new file mode 100755
index 0000000..b6e5e4a
--- /dev/null
+++ b/examples/java/reactor/run
@@ -0,0 +1,4 @@
+#!/bin/bash
+CLASS=$1
+shift
+mvn -q -e exec:java -Dexec.mainClass=org.apache.qpid.proton.example.reactor.${CLASS} -Dexec.args="$*"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1cbba24d/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/IOHandler.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/IOHandler.java b/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/IOHandler.java
index 872b6ff..ed14628 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/IOHandler.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/IOHandler.java
@@ -24,6 +24,7 @@ package org.apache.qpid.proton.reactor.impl;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.Socket;
+import java.nio.channels.Channel;
 import java.nio.channels.SocketChannel;
 import java.util.Iterator;
 
@@ -254,11 +255,13 @@ public class IOHandler extends BaseHandler {
     private static class ConnectionFree implements Callback {
         @Override
         public void run(Selectable selectable) {
-            try {
-                selectable.getChannel().close();
-            } catch(IOException ioException) {
-                ioException.printStackTrace();
-                // TODO: what now?
+            Channel channel = selectable.getChannel();
+            if (channel != null) {
+                try {
+                    channel.close();
+                } catch(IOException ioException) {
+                    throw new RuntimeException(ioException);
+                }
             }
         }
     }


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