Repository: ignite Updated Branches: refs/heads/master 24e4d5d31 -> 301943361
ignite-5805 Fixed some lgtm.com analysis alerts Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/30194336 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/30194336 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/30194336 Branch: refs/heads/master Commit: 301943361bd29c9c33b7ba15e9567a0e05bf27e2 Parents: 24e4d5d Author: sboikov <sboi...@gridgain.com> Authored: Mon Jul 24 23:46:57 2017 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Mon Jul 24 23:46:57 2017 +0300 ---------------------------------------------------------------------- .../configuration/CacheConfiguration.java | 5 -- .../ignite/internal/MarshallerContextImpl.java | 4 +- .../affinity/GridAffinityProcessor.java | 2 +- .../cache/CacheAffinitySharedManager.java | 8 +-- .../binary/CacheObjectBinaryProcessorImpl.java | 5 -- .../dht/GridClientPartitionTopology.java | 11 ++-- .../cache/distributed/dht/GridDhtGetFuture.java | 14 ++--- .../dht/atomic/GridDhtAtomicCache.java | 2 +- .../cache/local/GridLocalLockFuture.java | 5 -- .../freelist/io/PagesListMetaIO.java | 2 +- .../cache/transactions/IgniteTxHandler.java | 66 ++++++++++---------- .../cache/transactions/IgniteTxManager.java | 2 +- .../processors/igfs/IgfsDataManager.java | 2 +- .../string/GridRedisIncrDecrCommandHandler.java | 2 +- .../ignite/internal/util/IgniteUtils.java | 16 ++--- .../ignite/internal/util/nio/GridNioServer.java | 14 +++-- .../cache/VisorCacheMetricsCollectorTask.java | 2 +- .../communication/tcp/TcpCommunicationSpi.java | 25 ++++++-- .../ignite/spi/discovery/tcp/ServerImpl.java | 2 +- .../spi/failover/always/AlwaysFailoverSpi.java | 2 +- .../apache/ignite/mesos/ClusterProperties.java | 4 +- .../cache/websession/WebSessionFilter.java | 2 +- 22 files changed, 100 insertions(+), 97 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java index 670046f..708913a 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java @@ -2075,11 +2075,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { txtIdx.setName(idxEntry.getKey()); } else { - Collection<String> grp = new ArrayList<>(); - - for (String fieldName : idx.fields()) - grp.add(idx.descending(fieldName) ? fieldName + " desc" : fieldName); - QueryIndex sortedIdx = new QueryIndex(); sortedIdx.setIndexType(idx.type()); http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java index 6f15507..bb93354 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java @@ -197,9 +197,7 @@ public class MarshallerContextImpl implements MarshallerContext { * @throws IOException In case of error. */ private void processResource(URL url) throws IOException { - try (InputStream in = url.openStream()) { - BufferedReader rdr = new BufferedReader(new InputStreamReader(in)); - + try (BufferedReader rdr = new BufferedReader(new InputStreamReader(url.openStream()))) { String line; while ((line = rdr.readLine()) != null) { http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java index b2989d3..4ee0502 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java @@ -471,7 +471,7 @@ public class GridAffinityProcessor extends GridProcessorAdapter { continue; } - affMap.remove(cacheName, fut0); + affMap.remove(key, fut0); fut0.onDone(new IgniteCheckedException("Failed to get affinity mapping from node: " + n, e)); http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java index f519b4e..0f46a90 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java @@ -762,7 +762,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap Set<Integer> gprs = new HashSet<>(); for (ExchangeActions.CacheActionData action : exchActions.cacheStartRequests()) { - Integer grpId = action.descriptor().groupId(); + int grpId = action.descriptor().groupId(); if (gprs.add(grpId)) { if (crd) @@ -1109,7 +1109,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap if (grpDesc.config().getCacheMode() == LOCAL) return; - Integer grpId = grpDesc.groupId(); + int grpId = grpDesc.groupId(); CacheGroupHolder grpHolder = grpHolders.get(grpId); @@ -1360,7 +1360,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap for (int i = 0; i < fetchFuts.size(); i++) { GridDhtAssignmentFetchFuture fetchFut = fetchFuts.get(i); - Integer grpId = fetchFut.groupId(); + int grpId = fetchFut.groupId(); fetchAffinity(fut.topologyVersion(), fut.discoveryEvent(), @@ -1472,7 +1472,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap return; // Need initialize holders and affinity if this node became coordinator during this exchange. - final Integer grpId = desc.groupId(); + int grpId = desc.groupId(); CacheGroupContext grp = cctx.cache().cacheGroup(grpId); http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java index c0f3515..6a1b6dc 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java @@ -541,11 +541,6 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm @Override public Map<Integer, BinaryType> metadata(Collection<Integer> typeIds) throws BinaryObjectException { try { - Collection<BinaryMetadataKey> keys = new ArrayList<>(typeIds.size()); - - for (Integer typeId : typeIds) - keys.add(new BinaryMetadataKey(typeId)); - Map<Integer, BinaryType> res = U.newHashMap(metadataLocCache.size()); for (Map.Entry<Integer, BinaryMetadataHolder> e : metadataLocCache.entrySet()) http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java index 232ce38..b5b193b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java @@ -70,9 +70,6 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology { /** Flag to control amount of output for full map. */ private static final boolean FULL_MAP_DEBUG = false; - /** */ - private static final Long ZERO = 0L; - /** Cache shared context. */ private GridCacheSharedContext cctx; @@ -1041,8 +1038,12 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology { Map<Integer, T2<Long, Long>> res = U.newHashMap(cntrMap.size()); for (Map.Entry<Integer, T2<Long, Long>> e : cntrMap.entrySet()) { - if (!e.getValue().equals(ZERO)) - res.put(e.getKey(), e.getValue()); + T2<Long, Long> val = e.getValue(); + + if (val.get1() == 0L && val.get2() == 0L) + continue; + + res.put(e.getKey(), e.getValue()); } return res; http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java index 0ea48e3..8430f84 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java @@ -181,13 +181,13 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col } fut.listen(new CI1<IgniteInternalFuture<Object>>() { - @Override public void apply(IgniteInternalFuture<Object> fut) { - try { - fut.get(); - } - catch (IgniteCheckedException e) { - if (log.isDebugEnabled()) - log.debug("Failed to request keys from preloader [keys=" + keys + ", err=" + e + ']'); + @Override public void apply(IgniteInternalFuture<Object> fut) { + try { + fut.get(); + } + catch (IgniteCheckedException e) { + if (log.isDebugEnabled()) + log.debug("Failed to request keys from preloader [keys=" + keys + ", err=" + e + ']'); onDone(e); http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java index e67dabf..712babd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java @@ -3493,7 +3493,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> { assert futIds != null && futIds.size() > 0 : futIds; for (int i = 0; i < futIds.size(); i++) { - Long id = futIds.get(i); + long id = futIds.get(i); GridDhtAtomicAbstractUpdateFuture updateFut = (GridDhtAtomicAbstractUpdateFuture)ctx.mvcc().atomicFuture(id); http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalLockFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalLockFuture.java index e2311b8..0197acf 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalLockFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalLockFuture.java @@ -448,11 +448,6 @@ public final class GridLocalLockFuture<K, V> extends GridCacheFutureAdapter<Bool } /** {@inheritDoc} */ - @Override public int hashCode() { - return futId.hashCode(); - } - - /** {@inheritDoc} */ @Override public String toString() { return S.toString(GridLocalLockFuture.class, this); } http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/io/PagesListMetaIO.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/io/PagesListMetaIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/io/PagesListMetaIO.java index 41e1bb5..1490a5c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/io/PagesListMetaIO.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/io/PagesListMetaIO.java @@ -151,7 +151,7 @@ public class PagesListMetaIO extends PageIO { int off = offset(0); for (int i = 0; i < cnt; i++) { - Integer bucket = (int)PageUtils.getShort(pageAddr, off); + int bucket = (int)PageUtils.getShort(pageAddr, off); assert bucket >= 0 && bucket <= Short.MAX_VALUE : bucket; long tailId = PageUtils.getLong(pageAddr, off + 2); http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java index c473bfe..34a9fc1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java @@ -1502,39 +1502,39 @@ public class IgniteTxHandler { entry.op() == TRANSFORM && entry.oldValueOnPrimary() && !entry.hasValue()) { - while (true) { - try { - GridCacheEntryEx cached = entry.cached(); - - if (cached == null) { - cached = cacheCtx.cache().entryEx(entry.key(), req.topologyVersion()); - - entry.cached(cached); - } - - CacheObject val = cached.innerGet( - /*ver*/null, - tx, - /*readThrough*/false, - /*updateMetrics*/false, - /*evt*/false, - tx.subjectId(), - /*transformClo*/null, - tx.resolveTaskName(), - /*expiryPlc*/null, - /*keepBinary*/true); - - if (val == null) - val = cacheCtx.toCacheObject(cacheCtx.store().load(null, entry.key())); - - if (val != null) - entry.readValue(val); - - break; - } - catch (GridCacheEntryRemovedException ignored) { - if (log.isDebugEnabled()) - log.debug("Got entry removed exception, will retry: " + entry.txKey()); + while (true) { + try { + GridCacheEntryEx cached = entry.cached(); + + if (cached == null) { + cached = cacheCtx.cache().entryEx(entry.key(), req.topologyVersion()); + + entry.cached(cached); + } + + CacheObject val = cached.innerGet( + /*ver*/null, + tx, + /*readThrough*/false, + /*updateMetrics*/false, + /*evt*/false, + tx.subjectId(), + /*transformClo*/null, + tx.resolveTaskName(), + /*expiryPlc*/null, + /*keepBinary*/true); + + if (val == null) + val = cacheCtx.toCacheObject(cacheCtx.store().load(null, entry.key())); + + if (val != null) + entry.readValue(val); + + break; + } + catch (GridCacheEntryRemovedException ignored) { + if (log.isDebugEnabled()) + log.debug("Got entry removed exception, will retry: " + entry.txKey()); entry.cached(cacheCtx.cache().entryEx(entry.key(), req.topologyVersion())); } http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java index 26a4a91..e4e0061 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java @@ -2159,7 +2159,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter { } } // Special case for optimal sequence of nodes processing. - else if (nearTxLoc && requestedKeys != null && requestedKeys.contains(txKey.key())) { + else if (nearTxLoc && requestedKeys != null && requestedKeys.contains(txKey)) { TxLock txLock = new TxLock( tx.nearXidVersion(), tx.nodeId(), http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java index 4243074..e73fa6c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java @@ -202,7 +202,7 @@ public class IgfsDataManager extends IgfsManager { grpSize = mapper instanceof IgfsGroupDataBlocksKeyMapper ? ((IgfsGroupDataBlocksKeyMapper)mapper).getGroupSize() : 1; - grpBlockSize = igfsCtx.configuration().getBlockSize() * grpSize; + grpBlockSize = igfsCtx.configuration().getBlockSize() * (long)grpSize; assert grpBlockSize != 0; http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisIncrDecrCommandHandler.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisIncrDecrCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisIncrDecrCommandHandler.java index a57b82e..99453aa 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisIncrDecrCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisIncrDecrCommandHandler.java @@ -93,7 +93,7 @@ public class GridRedisIncrDecrCommandHandler extends GridRedisRestCommandHandler restReq.initial(0L); else { if (getResp.getResponse() instanceof String) { - Long init; + long init; try { init = Long.parseLong((String)getResp.getResponse()); http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java index 54ffe41..acfd914 100755 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java @@ -3380,18 +3380,18 @@ public abstract class IgniteUtils { * @throws IOException If error occurred. */ public static String readFileToString(String fileName, String charset) throws IOException { - Reader input = new InputStreamReader(new FileInputStream(fileName), charset); + try (Reader input = new InputStreamReader(new FileInputStream(fileName), charset)) { + StringWriter output = new StringWriter(); - StringWriter output = new StringWriter(); + char[] buf = new char[4096]; - char[] buf = new char[4096]; + int n; - int n; + while ((n = input.read(buf)) != -1) + output.write(buf, 0, n); - while ((n = input.read(buf)) != -1) - output.write(buf, 0, n); - - return output.toString(); + return output.toString(); + } } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java index ce7e7f3..3b8b22c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java @@ -2129,14 +2129,16 @@ public class GridNioServer<T> { int cnt = 0; - for (SessionWriteRequest req : ses.writeQueue()) { - Object msg = req.message(); + for (SessionWriteRequest req : ses.writeQueue()) { + Object msg = req.message(); if (shortInfo && msg instanceof GridIoMessage) - msg = ((GridIoMessage)msg).message().getClass().getSimpleName();if (cnt == 0) - sb.append(",\n opQueue=[").append(msg); - else - sb.append(',').append(msg); + msg = ((GridIoMessage)msg).message().getClass().getSimpleName(); + + if (cnt == 0) + sb.append(",\n opQueue=[").append(msg); + else + sb.append(',').append(msg); if (++cnt == 5) { sb.append(']'); http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java index 5cc8154..8ce3c8c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java @@ -94,7 +94,7 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<VisorCach @Override protected Collection<VisorCacheMetrics> run(final VisorCacheMetricsCollectorTaskArg arg) { assert arg != null; - Boolean showSysCaches = arg.isShowSystemCaches(); + boolean showSysCaches = arg.isShowSystemCaches(); Collection<String> cacheNames = arg.getCacheNames(); http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java index 5b952e8..1b00b5d 100755 --- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java @@ -3260,14 +3260,17 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati "operating system firewall is disabled on local and remote hosts) " + "[addrs=" + addrs + ']'); - if (enableForcibleNodeKill) {if (getSpiContext().node(node.id()) != null && (CU.clientNode(node) || !CU.clientNode(getLocalNode())) && - X.hasCause(errs, ConnectException.class,HandshakeException.class, SocketTimeoutException.class, HandshakeTimeoutException.class, - IgniteSpiOperationTimeoutException.class)) {String msg = "TcpCommunicationSpi failed to establish connection to node, node will be dropped from " + + if (enableForcibleNodeKill) { + if (getSpiContext().node(node.id()) != null + && (CU.clientNode(node) || !CU.clientNode(getLocalNode())) && + connectionError(errs)) { + String msg = "TcpCommunicationSpi failed to establish connection to node, node will be dropped from " + "cluster [" + "rmtNode=" + node + ']'; - if(enableTroubleshootingLog)U.error(log, msg, errs); + if (enableTroubleshootingLog) + U.error(log, msg, errs); else - U.warn(log, msg); + U.warn(log, msg); getSpiContext().failNode(node.id(), "TcpCommunicationSpi failed to establish connection to node [" + "rmtNode=" + node + @@ -3284,6 +3287,18 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati } /** + * @param errs Error. + * @return {@code True} if error was caused by some connection IO error. + */ + private static boolean connectionError(IgniteCheckedException errs) { + return X.hasCause(errs, ConnectException.class, + HandshakeException.class, + SocketTimeoutException.class, + HandshakeTimeoutException.class, + IgniteSpiOperationTimeoutException.class); + } + + /** * Performs handshake in timeout-safe way. * * @param client Client. http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/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 d621fb3..e098787 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 @@ -6249,7 +6249,7 @@ class ServerImpl extends TcpDiscoveryImpl { else { spi.stats.onMessageProcessingStarted(msg); - Integer res; + int res; SocketAddress rmtAddr = sock.getRemoteSocketAddress(); http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpi.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpi.java index 468a627..f074119 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpi.java @@ -237,7 +237,7 @@ public class AlwaysFailoverSpi extends IgniteSpiAdapter implements FailoverSpi { if (failedNodes == null) failedNodes = U.newHashSet(1); - Integer failoverCnt = failedNodes.size(); + int failoverCnt = failedNodes.size(); if (failoverCnt >= maxFailoverAttempts) { U.warn(log, "Job failover failed because number of maximum failover attempts is exceeded [failedJob=" + http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java ---------------------------------------------------------------------- diff --git a/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java b/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java index 3c8f396..3e66cc6 100644 --- a/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java +++ b/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java @@ -478,7 +478,9 @@ public class ClusterProperties { if (cfg != null) { props = new Properties(); - props.load(new FileInputStream(cfg)); + try (FileInputStream in = new FileInputStream(cfg)) { + props.load(in); + } } ClusterProperties prop = new ClusterProperties(); http://git-wip-us.apache.org/repos/asf/ignite/blob/30194336/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionFilter.java ---------------------------------------------------------------------- diff --git a/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionFilter.java b/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionFilter.java index 0644c0f..6cbf575 100644 --- a/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionFilter.java +++ b/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionFilter.java @@ -740,7 +740,7 @@ public class WebSessionFilter implements Filter { private <T> IgniteCache<String, T> cacheWithExpiryPolicy(final int maxInactiveInteval, final IgniteCache<String, T> cache) { if (maxInactiveInteval > 0) { - long ttl = maxInactiveInteval * 1000; + long ttl = maxInactiveInteval * 1000L; ExpiryPolicy plc = new ModifiedExpiryPolicy(new Duration(MILLISECONDS, ttl));