ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [1/5] ignite git commit: ignite-1.5 Fixed warnings.
Date Thu, 17 Dec 2015 02:36:04 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843-rc2 4d9f44313 -> 685d52c20


ignite-1.5 Fixed warnings.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/58e6412e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/58e6412e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/58e6412e

Branch: refs/heads/ignite-843-rc2
Commit: 58e6412e67f16780731c13948e91eed8aaf8daf8
Parents: 6fedd27
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Dec 16 15:11:08 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed Dec 16 15:11:08 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  2 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  4 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 42 +++++++++++++++-----
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java | 16 ++++++--
 4 files changed, 47 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/58e6412e/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index a4619c6..8f6c8a9 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -1054,7 +1054,7 @@ class ClientImpl extends TcpDiscoveryImpl {
                     }
                 }
 
-                for (IgniteInClosure<TcpDiscoveryAbstractMessage> msgLsnr : spi.sendMsgLsnrs)
+                for (IgniteInClosure<TcpDiscoveryAbstractMessage> msgLsnr : spi.sndMsgLsnrs)
                     msgLsnr.apply(msg);
 
                 boolean ack = clientAck && !(msg instanceof TcpDiscoveryPingResponse);

http://git-wip-us.apache.org/repos/asf/ignite/blob/58e6412e/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index d801109..471c36b 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -2352,7 +2352,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
             assert ring.hasRemoteNodes();
 
-            for (IgniteInClosure<TcpDiscoveryAbstractMessage> msgLsnr : spi.sendMsgLsnrs)
+            for (IgniteInClosure<TcpDiscoveryAbstractMessage> msgLsnr : spi.sndMsgLsnrs)
                 msgLsnr.apply(msg);
 
             sendMessageToClients(msg);
@@ -4849,7 +4849,7 @@ class ServerImpl extends TcpDiscoveryImpl {
             for (port = spi.locPort; port < spi.locPort + spi.locPortRange; port++) {
                 try {
                     if (spi.isSslEnabled())
-                        srvrSock = spi.sslSrvSocketFactory.createServerSocket(port, 0, spi.locHost);
+                        srvrSock = spi.sslSrvSockFactory.createServerSocket(port, 0, spi.locHost);
                     else
                         srvrSock = new ServerSocket(port, 0, spi.locHost);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/58e6412e/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 854ce95..f9273c3 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -377,17 +377,17 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
     protected DiscoverySpiNodeAuthenticator nodeAuth;
 
     /** SSL server socket factory. */
-    protected SSLServerSocketFactory sslSrvSocketFactory;
+    protected SSLServerSocketFactory sslSrvSockFactory;
 
     /** SSL socket factory. */
-    protected SSLSocketFactory sslSocketFactory;
+    protected SSLSocketFactory sslSockFactory;
 
     /** Context initialization latch. */
     @GridToStringExclude
     private final CountDownLatch ctxInitLatch = new CountDownLatch(1);
 
     /** */
-    protected final CopyOnWriteArrayList<IgniteInClosure<TcpDiscoveryAbstractMessage>>
sendMsgLsnrs =
+    protected final CopyOnWriteArrayList<IgniteInClosure<TcpDiscoveryAbstractMessage>>
sndMsgLsnrs =
         new CopyOnWriteArrayList<>();
 
     /** */
@@ -543,6 +543,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      * then {@link InetAddress#getLocalHost()} will be used.
      *
      * @param locAddr IP address.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
     public TcpDiscoverySpi setLocalAddress(String locAddr) {
@@ -600,6 +601,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      *
      * @param reconCnt Number of retries during message sending.
      * @see #setAckTimeout(long)
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
     public TcpDiscoverySpi setReconnectCount(int reconCnt) {
@@ -630,6 +632,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      * When this property is explicitly set {@link IgniteConfiguration#getFailureDetectionTimeout()}
is ignored.
      *
      * @param maxAckTimeout Maximum acknowledgement timeout.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
     public TcpDiscoverySpi setMaxAckTimeout(long maxAckTimeout) {
@@ -655,6 +658,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      * Affected server nodes only.
      *
      * @param locPort Local port to bind.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
     public TcpDiscoverySpi setLocalPort(int locPort) {
@@ -676,9 +680,9 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      * If not specified, default is {@link #DFLT_PORT_RANGE}.
      * <p>
      * Affected server nodes only.
-
      *
      * @param locPortRange Local port range to bind.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
     public TcpDiscoverySpi setLocalPortRange(int locPortRange) {
@@ -700,6 +704,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      * Affected server nodes only.
      *
      * @param maxMissedHbs Max missed heartbeats.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
     public TcpDiscoverySpi setMaxMissedHeartbeats(int maxMissedHbs) {
@@ -719,6 +724,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      * If not provided, default value is {@link #DFLT_MAX_MISSED_CLIENT_HEARTBEATS}.
      *
      * @param maxMissedClientHbs Max missed client heartbeats.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
     public TcpDiscoverySpi setMaxMissedClientHeartbeats(int maxMissedClientHbs) {
@@ -742,6 +748,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      * This may be very helpful for tracing topology problems.
      *
      * @param statsPrintFreq Statistics print frequency in milliseconds.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
     public TcpDiscoverySpi setStatisticsPrintFrequency(long statsPrintFreq) {
@@ -763,6 +770,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      * Affected server nodes only.
      *
      * @param ipFinderCleanFreq IP finder clean frequency.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
     public TcpDiscoverySpi setIpFinderCleanFrequency(long ipFinderCleanFreq) {
@@ -787,6 +795,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      * be used by default.
      *
      * @param ipFinder IP finder.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
     public TcpDiscoverySpi setIpFinder(TcpDiscoveryIpFinder ipFinder) {
@@ -807,6 +816,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      * When this property is explicitly set {@link IgniteConfiguration#getFailureDetectionTimeout()}
is ignored.
      *
      * @param sockTimeout Socket connection timeout.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
     public TcpDiscoverySpi setSocketTimeout(long sockTimeout) {
@@ -828,6 +838,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      * When this property is explicitly set {@link IgniteConfiguration#getFailureDetectionTimeout()}
is ignored.
      *
      * @param ackTimeout Acknowledgement timeout.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
     public TcpDiscoverySpi setAckTimeout(long ackTimeout) {
@@ -844,6 +855,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      * If not specified, default is {@link #DFLT_NETWORK_TIMEOUT}.
      *
      * @param netTimeout Network timeout.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
     public TcpDiscoverySpi setNetworkTimeout(long netTimeout) {
@@ -870,6 +882,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      * @param joinTimeout Join timeout ({@code 0} means wait forever).
      *
      * @see TcpDiscoveryIpFinder#isShared()
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
     public TcpDiscoverySpi setJoinTimeout(long joinTimeout) {
@@ -884,6 +897,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      * If not provided, default value is {@link #DFLT_THREAD_PRI}
      *
      * @param threadPri Thread priority.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
     public TcpDiscoverySpi setThreadPriority(int threadPri) {
@@ -899,6 +913,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      * If not provided, default value is {@link #DFLT_HEARTBEAT_FREQ}.
      *
      * @param hbFreq Heartbeat frequency in milliseconds.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
     public TcpDiscoverySpi setHeartbeatFrequency(long hbFreq) {
@@ -919,6 +934,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      * {@link #DFLT_TOP_HISTORY_SIZE}.
      *
      * @param topHistSize Size of topology snapshots history.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
     public TcpDiscoverySpi setTopHistorySize(int topHistSize) {
@@ -951,6 +967,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
 
     /**
      * @param srvPort Server port.
+     * @param addExtAddrAttr If {@code true} adds {@link #ATTR_EXT_ADDRS} attribute.
      */
     protected void initLocalNode(int srvPort, boolean addExtAddrAttr) {
         // Init local node.
@@ -1263,7 +1280,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
         Socket sock;
 
         if (isSslEnabled())
-            sock = sslSocketFactory.createSocket();
+            sock = sslSockFactory.createSocket();
         else
             sock = new Socket();
 
@@ -1338,11 +1355,14 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      * @param sock Socket.
      * @param msg Message.
      * @param bout Byte array output stream.
+     * @param timeout Timeout.
      * @throws IOException If IO failed or write timed out.
      * @throws IgniteCheckedException If marshalling failed.
      */
     @SuppressWarnings("ThrowFromFinallyBlock")
-    protected void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg, GridByteArrayOutputStream
bout,
+    protected void writeToSocket(Socket sock,
+        TcpDiscoveryAbstractMessage msg,
+        GridByteArrayOutputStream bout,
         long timeout) throws IOException, IgniteCheckedException {
         assert sock != null;
         assert msg != null;
@@ -1755,8 +1775,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
             try {
                 SSLContext sslCtx = ignite().configuration().getSslContextFactory().create();
 
-                sslSocketFactory = sslCtx.getSocketFactory();
-                sslSrvSocketFactory = sslCtx.getServerSocketFactory();
+                sslSockFactory = sslCtx.getSocketFactory();
+                sslSrvSockFactory = sslCtx.getServerSocketFactory();
             }
             catch (IgniteException e) {
                 throw new IgniteSpiException("Failed to create SSL context. SSL factory:
"
@@ -1853,7 +1873,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
     }
 
     /**
-     *
+     * @return Ignite instance.
      */
     Ignite ignite() {
         return ignite;
@@ -1916,14 +1936,14 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
      * <strong>FOR TEST ONLY!!!</strong>
      */
     public void addSendMessageListener(IgniteInClosure<TcpDiscoveryAbstractMessage>
lsnr) {
-        sendMsgLsnrs.add(lsnr);
+        sndMsgLsnrs.add(lsnr);
     }
 
     /**
      * <strong>FOR TEST ONLY!!!</strong>
      */
     public void removeSendMessageListener(IgniteInClosure<TcpDiscoveryAbstractMessage>
lsnr) {
-        sendMsgLsnrs.remove(lsnr);
+        sndMsgLsnrs.remove(lsnr);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/58e6412e/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
index dff37a9..5475f25 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
@@ -902,9 +902,15 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
 
             Ignite g1 = startGrid(1);
 
-            long timeout = (long)(discoMap.get(g1.name()).getIpFinderCleanFrequency() * 1.5);
+            long failureDetectTimeout = g1.configuration().getFailureDetectionTimeout();
 
-            Thread.sleep(timeout);
+            long timeout = (long)(discoMap.get(g1.name()).getIpFinderCleanFrequency() * 1.5)
+ failureDetectTimeout;
+
+            GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                @Override public boolean apply() {
+                    return ipFinder.getRegisteredAddresses().size() == 1;
+                }
+            }, timeout);
 
             assert ipFinder.getRegisteredAddresses().size() == 1 : "ipFinder=" + ipFinder.getRegisteredAddresses();
 
@@ -914,7 +920,11 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
             ipFinder.registerAddresses(Arrays.asList(new InetSocketAddress("host1", 1024),
                 new InetSocketAddress("host2", 1024)));
 
-            Thread.sleep(timeout);
+            GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                @Override public boolean apply() {
+                    return ipFinder.getRegisteredAddresses().size() == 1;
+                }
+            }, timeout);
 
             assert ipFinder.getRegisteredAddresses().size() == 1 : "ipFinder=" + ipFinder.getRegisteredAddresses();
         }


Mime
View raw message