Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code cleanup #11555

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public void run(ExecutionContext<RowT> ctx, ExecutionPlan plan, FieldsMetadata m
}

if (wrpEx != null)
log.warning("An exception occures during the query cancel", wrpEx);
log.warning("An exception occurs during the query cancel", wrpEx);
}
finally {
super.tryClose(failure == null && root != null ? root.failure() : failure);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ private static class FixDependentModifyNodeShuttle extends IgniteRelShuttle {
/**
* Process a scan node and raise a {@link #spoolNeeded flag} if needed.
*
* @param scan TableScan to analize.
* @param scan TableScan to analyze.
* @return The input rel.
*/
private IgniteRel processScan(TableScan scan) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ public void testParseAndValidateWalActions() {
}

/**
* Tets checks a parser of shutdown policy command.
* Tests checks a parser of shutdown policy command.
*/
@Test
public void testParseShutdownPolicyParameters() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.cluster.ClusterStartNodeResult;
import org.apache.ignite.cluster.ClusterState;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteComponentType;
import org.apache.ignite.internal.IgniteInternalFuture;
Expand Down Expand Up @@ -90,13 +89,10 @@
/**
*
*/
public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClusterEx, Externalizable {
public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClusterEx {
/** */
private static final long serialVersionUID = 0L;

/** */
private IgniteConfiguration cfg;

/** Node local store. */
@GridToStringExclude
private ConcurrentMap nodeLoc;
Expand Down Expand Up @@ -141,8 +137,6 @@ public IgniteClusterImpl() {
public IgniteClusterImpl(GridKernalContext ctx) {
super(ctx, (IgnitePredicate<ClusterNode>)null);

cfg = ctx.config();

nodeLoc = new ClusterNodeLocalMapImpl(ctx);

log = ctx.log(getClass());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import org.apache.ignite.resources.LoggerResource;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import static java.util.Collections.emptyMap;
import static org.apache.ignite.internal.pagemem.PageIdAllocator.FLAG_DATA;
import static org.apache.ignite.internal.processors.cache.verify.IdleVerifyUtility.GRID_NOT_IDLE_MSG;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2775,7 +2775,7 @@ public int getOutboundMessagesQueueSize() {
* @param rctx Receiver context to use.
* @param ex Exception to close receiver with.
*/
private void interruptReceiver(ReceiverContext rctx, Exception ex) {
private void interruptReceiver(@Nullable ReceiverContext rctx, Exception ex) {
if (rctx == null)
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2591,7 +2591,8 @@ public StandaloneGridKernalContext createStandaloneKernalContext(
* @return Iterator over partition.
* @throws IgniteCheckedException If and error occurs.
*/
public GridCloseableIterator<CacheDataRow> partitionRowIterator(GridKernalContext ctx,
public GridCloseableIterator<CacheDataRow> partitionRowIterator(
GridKernalContext ctx,
String grpName,
int partId,
FilePageStore pageStore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,24 @@ public SnapshotFilesRequestMessage() {
}

/**
* @param reqId Unique message id.
* @param requestId Snapshot operation request ID.
* @param msgId Unique message id.
* @param reqId Snapshot operation request ID.
* @param snpName Snapshot name to request.
* @param snpPath Snapshot directory path.
* @param parts Map of cache group ids and corresponding set of its partition ids to be snapshot.
*/
public SnapshotFilesRequestMessage(
String reqId,
UUID requestId,
String msgId,
UUID reqId,
String snpName,
@Nullable String snpPath,
Map<Integer, Set<Integer>> parts
) {
super(reqId);
super(msgId);

assert parts != null && !parts.isEmpty();

this.reqId = requestId;
this.reqId = reqId;
this.snpName = snpName;
this.snpPath = snpPath;
this.parts = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public List<String> nodesDirectories() {
}

/** @return List of snapshot metadata saved in {@link #dumpDir}. */
public List<SnapshotMetadata> metadata() throws IOException, IgniteCheckedException {
public List<SnapshotMetadata> metadata() {
return Collections.unmodifiableList(metadata);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,10 @@ private void startQuery(GridCacheContext cctx) throws IgniteCheckedException {

/** {@inheritDoc} */
@Override public void onActivate(GridKernalContext ctx) {
if (log.isDebugEnabled())
if (log.isDebugEnabled()) {
log.debug("Activating data structure processor [nodeId=" + ctx.localNodeId() +
" topVer=" + ctx.discovery().topologyVersionEx() + " ]");
}

initFailed = false;

Expand Down Expand Up @@ -466,9 +467,10 @@ public void restoreStructuresState(GridKernalContext ctx) {

/** {@inheritDoc} */
@Override public void onDeActivate(GridKernalContext ctx) {
if (log.isDebugEnabled())
if (log.isDebugEnabled()) {
log.debug("DeActivate data structure processor [nodeId=" + ctx.localNodeId() +
", topVer=" + ctx.discovery().topologyVersionEx() + "]");
}

ctx.event().removeLocalEventListener(lsnr, EVT_NODE_LEFT, EVT_NODE_FAILED);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public class IgniteStatisticsConfigurationManager {
distrMetaStorage.listen(
(metaKey) -> metaKey.startsWith(STAT_OBJ_PREFIX),
(k, oldV, newV) -> {
// Skip invoke on start node (see 'ReadableDistributedMetaStorage#listen' the second case)
// Skip invocation at node start (see 'ReadableDistributedMetaStorage#listen' the second case)
// The update statistics on start node is handled by 'scanAndCheckLocalStatistic' method
// called on exchange done.
if (topVer == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@ public static ObjectStatisticsImpl aggregateLocalStatistics(

/**
* Calculate effective row count. If there are some overrides in statistics configuration - maximum value will be
* choosen. If not - will return actualRowCount.
* choosen. If not - will return {@code actualRowCnt}.
*
* @param cfg Statistics configuration to dig overrides row count from.
* @param actualRowCount Actual row count.
* @param actualRowCnt Actual row count.
* @return Effective row count.
*/
public static long calculateRowCount(StatisticsObjectConfiguration cfg, long actualRowCount) {
public static long calculateRowCount(StatisticsObjectConfiguration cfg, long actualRowCnt) {
long overridedRowCnt = -1;

for (StatisticsColumnConfiguration ccfg : cfg.columns().values()) {
Expand All @@ -237,7 +237,7 @@ public static long calculateRowCount(StatisticsObjectConfiguration cfg, long act
}
}

return (overridedRowCnt == -1) ? actualRowCount : overridedRowCnt;
return (overridedRowCnt == -1) ? actualRowCnt : overridedRowCnt;
}

/**
Expand All @@ -247,7 +247,7 @@ public static long calculateRowCount(StatisticsObjectConfiguration cfg, long act
* @return StatisticsObjectConfiguration array.
*/
public static StatisticsObjectConfiguration[] buildDefaultConfigurations(StatisticsTarget... targets) {
StatisticsObjectConfiguration[] res = Arrays.stream(targets)
return Arrays.stream(targets)
.map(t -> {
List<StatisticsColumnConfiguration> colCfgs;
if (t.columns() == null)
Expand All @@ -259,8 +259,6 @@ public static StatisticsObjectConfiguration[] buildDefaultConfigurations(Statist
return new StatisticsObjectConfiguration(t.key(), colCfgs,
StatisticsObjectConfiguration.DEFAULT_OBSOLESCENCE_MAX_PERCENT);
}).toArray(StatisticsObjectConfiguration[]::new);

return res;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public ObjectStatisticsImpl getLocalStatistics(StatisticsKey key, AffinityTopolo
}

/** {@inheritDoc} */
@Override public void refreshStatistics(StatisticsTarget... targets) throws IgniteCheckedException {
@Override public void refreshStatistics(StatisticsTarget... targets) {
ensureActive("refresh statistics");

if (usageState() == OFF)
Expand All @@ -383,7 +383,7 @@ public ObjectStatisticsImpl getLocalStatistics(StatisticsKey key, AffinityTopolo
}

/** {@inheritDoc} */
@Override public void dropAll() throws IgniteCheckedException {
@Override public void dropAll() {
ensureActive("drop all statistics");

statCfgMgr.dropAll();
Expand Down Expand Up @@ -421,7 +421,7 @@ public IgniteStatisticsConfigurationManager statisticConfiguration() {
}

/** {@inheritDoc} */
@Override public void usageState(StatisticsUsageState state) throws IgniteCheckedException {
@Override public void usageState(StatisticsUsageState state) {
ensureActive("change usage state of statistics");

try {
Expand Down Expand Up @@ -486,8 +486,8 @@ public synchronized void processObsolescence() {
try {
cfg = statCfgMgr.config(key);
}
catch (IgniteCheckedException e) {
// No-op/
catch (IgniteCheckedException ignored) {
// No-op.
}

Set<Integer> tasksParts = calculateObsolescencedPartitions(cfg, statsRepos.getObsolescence(key));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public enum StatisticsUsageState {
NO_UPDATE(1),

/**
* Statistics used and updated after each changes.
* Statistics used and updated after each change.
*/
ON(2);

Expand All @@ -42,7 +42,7 @@ public enum StatisticsUsageState {
private static final StatisticsUsageState[] VALS;

static {
StatisticsUsageState[] statisticsUsageStates = StatisticsUsageState.values();
StatisticsUsageState[] statisticsUsageStates = values();

int maxIdx = 0;
for (StatisticsUsageState recordType : statisticsUsageStates)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ public LocalStatisticsGatheringContext context() {
private ObjectPartitionStatisticsImpl processPartition(
GridCacheContext<?, ?> cctx
) {
ObjectPartitionStatisticsImpl partStat = statRepo.getLocalPartitionStatistics(
gathCtx.configuration().key(), partId);
ObjectPartitionStatisticsImpl partStat = statRepo.getLocalPartitionStatistics(gathCtx.configuration().key(), partId);

Map<String, StatisticsColumnConfiguration> colsToCollect = getColumnsToCollect(partStat);
Set<String> colsToRemove = getColumnsToRemove(partStat);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ public GridTaskProcessor(GridKernalContext ctx) {
if (!active)
return;

tasksMetaCache = ctx.security().enabled() ?
ctx.cache().<GridTaskNameHashKey, String>utilityCache() : null;
tasksMetaCache = ctx.security().enabled() ? ctx.cache().utilityCache() : null;

startLatch.countDown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class InitMessage<I extends Serializable> implements DiscoveryCustomMessa
private final IgniteUuid id = IgniteUuid.randomUuid();

/** Process id. */
private final UUID processId;
private final UUID procId;

/** Process type. */
private final int type;
Expand All @@ -56,12 +56,12 @@ public class InitMessage<I extends Serializable> implements DiscoveryCustomMessa
private final boolean waitClnRes;

/**
* @param processId Process id.
* @param procId Process id.
* @param type Process type.
* @param req Request.
*/
public InitMessage(UUID processId, DistributedProcessType type, I req, boolean waitClnRes) {
this.processId = processId;
public InitMessage(UUID procId, DistributedProcessType type, I req, boolean waitClnRes) {
this.procId = procId;
this.type = type.ordinal();
this.req = req;
this.waitClnRes = waitClnRes;
Expand Down Expand Up @@ -90,7 +90,7 @@ public InitMessage(UUID processId, DistributedProcessType type, I req, boolean w

/** @return Process id. */
public UUID processId() {
return processId;
return procId;
}

/** @return Process type. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public long nextTimeoutChunk(long dfltTimeout) throws IgniteSpiOperationTimeoutE
* @param e Exception to check.
* @return {@code True} if given exception is a timeout. {@code False} otherwise.
*/
public boolean checkFailureTimeoutReached(Exception e) {
public static boolean checkFailureTimeoutReached(Exception e) {
return X.hasCause(e, IgniteSpiOperationTimeoutException.class, SocketTimeoutException.class, SocketException.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class ClientImpl extends TcpDiscoveryImpl {
private final CountDownLatch leaveLatch = new CountDownLatch(1);

/** */
private final ScheduledExecutorService executorService;
private final ScheduledExecutorService executorSrvc;

/** */
private MessageWorker msgWorker;
Expand All @@ -221,7 +221,7 @@ class ClientImpl extends TcpDiscoveryImpl {
String instanceName = adapter.ignite() == null || adapter.ignite().name() == null
? "client-node" : adapter.ignite().name();

executorService = Executors.newSingleThreadScheduledExecutor(
executorSrvc = Executors.newSingleThreadScheduledExecutor(
new IgniteThreadFactory(instanceName, "tcp-discovery-exec"));
}

Expand Down Expand Up @@ -318,7 +318,7 @@ class ClientImpl extends TcpDiscoveryImpl {
}
}.start();

executorService.scheduleAtFixedRate(new MetricsSender(), spi.metricsUpdateFreq, spi.metricsUpdateFreq, MILLISECONDS);
executorSrvc.scheduleAtFixedRate(new MetricsSender(), spi.metricsUpdateFreq, spi.metricsUpdateFreq, MILLISECONDS);

try {
joinLatch.await();
Expand Down Expand Up @@ -369,7 +369,7 @@ class ClientImpl extends TcpDiscoveryImpl {
while (!U.join(sockReader, log, 200))
U.interrupt(sockReader);

executorService.shutdownNow();
executorSrvc.shutdownNow();

spi.printStopInfo();
}
Expand Down Expand Up @@ -435,7 +435,7 @@ else if (state == DISCONNECTED) {
else {
final GridFutureAdapter<Boolean> finalFut = fut;

executorService.schedule(() -> {
executorSrvc.schedule(() -> {
if (pingFuts.remove(nodeId, finalFut)) {
if (ClientImpl.this.state == DISCONNECTED)
finalFut.onDone(new IgniteClientDisconnectedCheckedException(null,
Expand Down Expand Up @@ -2144,7 +2144,7 @@ private void tryJoin() throws InterruptedException {
if (spi.joinTimeout > 0) {
final int joinCnt0 = joinCnt;

executorService.schedule(() -> {
executorSrvc.schedule(() -> {
queue.add(new JoinTimeout(joinCnt0));
}, spi.joinTimeout, MILLISECONDS);
}
Expand Down Expand Up @@ -2746,7 +2746,7 @@ int queueSize() {
*/
private static class JoinTimeout {
/** */
private int joinCnt;
private final int joinCnt;

/**
* @param joinCnt Join count to compare.
Expand Down
Loading