Return-Path: X-Original-To: apmail-qpid-commits-archive@www.apache.org Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 433A418FC2 for ; Sun, 5 Jul 2015 23:45:04 +0000 (UTC) Received: (qmail 45229 invoked by uid 500); 5 Jul 2015 23:45:03 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 45190 invoked by uid 500); 5 Jul 2015 23:45:03 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 44617 invoked by uid 99); 5 Jul 2015 23:45:03 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Jul 2015 23:45:03 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DD4A4E3638; Sun, 5 Jul 2015 23:45:02 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: rhs@apache.org To: commits@qpid.apache.org Date: Sun, 05 Jul 2015 23:45:26 -0000 Message-Id: <1331b1b63c284a42bb064a24a510e722@git.apache.org> In-Reply-To: <232a9358b57044748b5da9fc6483eafb@git.apache.org> References: <232a9358b57044748b5da9fc6483eafb@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [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 Authored: Tue May 12 18:19:23 2015 -0400 Committer: Rafael Schloming 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