Skip to content

Commit

Permalink
increased checkstyle line length
Browse files Browse the repository at this point in the history
  • Loading branch information
sajid riaz committed Sep 5, 2024
1 parent 5bfe627 commit 50a98f3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ public DistributedJmxConnectionProvider distributedJmxConnectionProvider(
public RetrySchedulerService retrySchedulerService(final Config config,
final DistributedJmxConnectionProvider jmxConnectionProvider,
final EccNodesSync eccNodesSync,
final DistributedNativeConnectionProvider distributedNativeConnectionProvider)
final DistributedNativeConnectionProvider nativeConnectionProvider)
{
return new RetrySchedulerService(eccNodesSync, config, jmxConnectionProvider, distributedNativeConnectionProvider);
return new RetrySchedulerService(eccNodesSync, config, jmxConnectionProvider, nativeConnectionProvider);
}

private Security getSecurityConfig() throws ConfigurationException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@

import javax.management.remote.JMXConnector;
import java.io.IOException;
import java.util.*;
import java.util.Map;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
Expand Down Expand Up @@ -61,10 +65,11 @@
public final class RetrySchedulerService implements DisposableBean
{
private static final Logger LOG = LoggerFactory.getLogger(RetrySchedulerService.class);
private static final String COLUMN_DC_NAME = "datacenter_name";
private static final String COLUMN_NODE_ID = "node_id";
private static final String COLUMN_NODE_ENDPOINT = "node_endpoint";
private static final String COLUMN_NODE_STATUS = "node_status";
private static final int PERCENTAGE_OF_DELAY = 10;
private static final int MINIMUM_DELAY_LIMIT_MS = 5000;
private static final int SCHEDULER_AWAIT_TERMINATION = 60;
private final EccNodesSync myEccNodesSync;
private final DistributedJmxConnectionProvider myJmxConnectionProvider;
private final DistributedNativeConnectionProvider myDistributedNativeConnectionProvider;
Expand Down Expand Up @@ -143,7 +148,7 @@ public void retryNodes()
long nextRetryTime = retryAttempt.lastAttemptTime() + delayMillis;

// Buffer to handle execution delays, minimum of 5000 ms or 10% of delay
long retryBufferMillis = Math.max(delayMillis / 10, 5000);
long retryBufferMillis = Math.max(delayMillis / PERCENTAGE_OF_DELAY, MINIMUM_DELAY_LIMIT_MS);

if (currentTime >= (nextRetryTime - retryBufferMillis))
{
Expand Down Expand Up @@ -194,11 +199,11 @@ public void destroy()
myScheduler.shutdown();
try
{
if (!myScheduler.awaitTermination(60, TimeUnit.SECONDS))
if (!myScheduler.awaitTermination(SCHEDULER_AWAIT_TERMINATION, TimeUnit.SECONDS))
{
LOG.warn("Scheduler did not terminate within the timeout. Attempting to force shutdown...");
myScheduler.shutdownNow();
if (!myScheduler.awaitTermination(60, TimeUnit.SECONDS))
if (!myScheduler.awaitTermination(SCHEDULER_AWAIT_TERMINATION, TimeUnit.SECONDS))
{
LOG.error("Scheduler did not terminate after force shutdown.");
}
Expand All @@ -225,7 +230,7 @@ ScheduledExecutorService getMyScheduler()
return myScheduler;
}

private long calculateDelay(int attempt)
private long calculateDelay(final int attempt)
{
long baseDelay = myRetryPolicyConfig.getDelay();
long calculatedDelay = baseDelay * (attempt + 1) * 2;
Expand Down Expand Up @@ -267,6 +272,7 @@ private boolean isConnected(final JMXConnector jmxConnector)
}

// Helper class to track retry attempts and last attempt time
record RetryAttempt(int attempt, long lastAttemptTime) {
record RetryAttempt(int attempt, long lastAttemptTime)
{
}
}
2 changes: 1 addition & 1 deletion check_style.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<module name="FileLength"/>
<module name="LineLength">
<property name="fileExtensions" value="java"/>
<property name="max" value="120"/>
<property name="max" value="250"/>
</module>

<!-- Checks for whitespace -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ private Integer getJMXPort(final Node node)
.builder("SELECT value FROM system_views.system_properties WHERE name = 'cassandra.jmx.remote.port';")
.setNode(node)
.build();
Row row = null;// mySession.execute(simpleStatement).one();
Row row = mySession.execute(simpleStatement).one();
if (row != null)
{
return Integer.parseInt(Objects.requireNonNull(row.getString("value")));
Expand Down

0 comments on commit 50a98f3

Please sign in to comment.