You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/05/15 16:02:42 UTC
[40/47] incubator-ignite git commit: IGNITE-709 Merge try / catch
blocks,
IGNITE-709 Merge try / catch blocks,
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ccc854af
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ccc854af
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ccc854af
Branch: refs/heads/ignite-709_3
Commit: ccc854af4bd073f39796a32dd597c795f45bc47d
Parents: 4fd4c24
Author: sevdokimov <se...@gridgain.com>
Authored: Fri May 15 14:35:58 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Fri May 15 14:35:58 2015 +0300
----------------------------------------------------------------------
.../discovery/tcp/TcpClientDiscoverySpi.java | 76 ++++++++++----------
1 file changed, 37 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ccc854af/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
index f4e1430..ad9f947 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
@@ -758,60 +758,58 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
}
try {
- try {
- InputStream in = new BufferedInputStream(sock.getInputStream());
+ InputStream in = new BufferedInputStream(sock.getInputStream());
- sock.setKeepAlive(true);
- sock.setTcpNoDelay(true);
+ sock.setKeepAlive(true);
+ sock.setTcpNoDelay(true);
- while (!isInterrupted()) {
- TcpDiscoveryAbstractMessage msg;
+ while (!isInterrupted()) {
+ TcpDiscoveryAbstractMessage msg;
- try {
- msg = marsh.unmarshal(in, U.gridClassLoader());
- }
- catch (IgniteCheckedException e) {
- if (log.isDebugEnabled())
- U.error(log, "Failed to read message [sock=" + sock + ", " +
- "locNodeId=" + getLocalNodeId() + ", rmtNodeId=" + rmtNodeId + ']', e);
+ try {
+ msg = marsh.unmarshal(in, U.gridClassLoader());
+ }
+ catch (IgniteCheckedException e) {
+ if (log.isDebugEnabled())
+ U.error(log, "Failed to read message [sock=" + sock + ", " +
+ "locNodeId=" + getLocalNodeId() + ", rmtNodeId=" + rmtNodeId + ']', e);
- IOException ioEx = X.cause(e, IOException.class);
+ IOException ioEx = X.cause(e, IOException.class);
- if (ioEx != null)
- throw ioEx;
+ if (ioEx != null)
+ throw ioEx;
- ClassNotFoundException clsNotFoundEx = X.cause(e, ClassNotFoundException.class);
+ ClassNotFoundException clsNotFoundEx = X.cause(e, ClassNotFoundException.class);
- if (clsNotFoundEx != null)
- LT.warn(log, null, "Failed to read message due to ClassNotFoundException " +
- "(make sure same versions of all classes are available on all nodes) " +
- "[rmtNodeId=" + rmtNodeId + ", err=" + clsNotFoundEx.getMessage() + ']');
- else
- LT.error(log, e, "Failed to read message [sock=" + sock + ", locNodeId=" +
- getLocalNodeId() + ", rmtNodeId=" + rmtNodeId + ']');
+ if (clsNotFoundEx != null)
+ LT.warn(log, null, "Failed to read message due to ClassNotFoundException " +
+ "(make sure same versions of all classes are available on all nodes) " +
+ "[rmtNodeId=" + rmtNodeId + ", err=" + clsNotFoundEx.getMessage() + ']');
+ else
+ LT.error(log, e, "Failed to read message [sock=" + sock + ", locNodeId=" +
+ getLocalNodeId() + ", rmtNodeId=" + rmtNodeId + ']');
- continue;
- }
+ continue;
+ }
- msg.senderNodeId(rmtNodeId);
+ msg.senderNodeId(rmtNodeId);
- if (log.isDebugEnabled())
- log.debug("Message has been received: " + msg);
+ if (log.isDebugEnabled())
+ log.debug("Message has been received: " + msg);
- stats.onMessageReceived(msg);
+ stats.onMessageReceived(msg);
- if (ensured(msg))
- lastMsgId = msg.id();
+ if (ensured(msg))
+ lastMsgId = msg.id();
- msgWorker.addMessage(msg);
- }
+ msgWorker.addMessage(msg);
}
- catch (IOException e) {
- msgWorker.addMessage(new SocketClosedMessage(sock));
+ }
+ catch (IOException e) {
+ msgWorker.addMessage(new SocketClosedMessage(sock));
- if (log.isDebugEnabled())
- U.error(log, "Connection failed [sock=" + sock + ", locNodeId=" + getLocalNodeId() + ']', e);
- }
+ if (log.isDebugEnabled())
+ U.error(log, "Connection failed [sock=" + sock + ", locNodeId=" + getLocalNodeId() + ']', e);
}
finally {
U.closeQuiet(sock);