Mercurial > hg > Database > Alice
changeset 284:7188fe3f7c95
Fix error handling
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Oct 2013 02:55:37 +0900 |
parents | b90d03c6cb00 |
children | cb87da39cf85 |
files | src/alice/daemon/IncomingTcpConnection.java |
diffstat | 1 files changed, 14 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alice/daemon/IncomingTcpConnection.java Fri Oct 18 02:43:21 2013 +0900 +++ b/src/alice/daemon/IncomingTcpConnection.java Fri Oct 18 02:55:37 2013 +0900 @@ -33,11 +33,9 @@ * pipeline thread for receiving */ public void run() { - Unpacker unpacker = null; - try { - unpacker = SingletonMessage.getInstance().createUnpacker(connection.socket.getInputStream()); - } catch (IOException e2) { - e2.printStackTrace(); + Unpacker unpacker = this.getUnpacker(); + if (unpacker == null) { + return; } while (true) { try { @@ -79,6 +77,17 @@ } } } + + private Unpacker getUnpacker() { + Unpacker unpacker = null; + try { + unpacker = SingletonMessage.getInstance().createUnpacker(connection.socket.getInputStream()); + } catch (IOException e2) { + e2.printStackTrace(); + } + return unpacker; + } + private DataSegmentKey getDataSegmentKey(CommandMessage msg) { return lmanager.getDataSegmentKey(msg.key); }