Source:
<code>public void operationComplete(Future<java.lang.Void> future) throws Exception { if (!future.isSuccess()) { Throwable error = future.cause(); if (error instanceof EncoderException && error.getCause() instanceof FrameTooLongException) { <START> trackNodeError(node, error.getCause(), -1); <END> setFinalError(error.getCause(), node, execution); } else { LOG.trace( "[{}] Failed to send request on {}, trying next node (cause: {})", logPrefix, channel, error); recordError(node, error); trackNodeError(node, error, -1); ((DefaultNode) node) .getMetricUpdater() .incrementCounter(DefaultNodeMetric.UNSENT_REQUESTS, executionProfile.getName()); sendRequest(null, execution, retryCount, scheduleNextExecution); } } else { LOG.trace("[{}] Request sent on {}", logPrefix, channel); if (result.isDone()) { cancel(); } else { inFlightCallbacks.add(this); if (scheduleNextExecution && isIdempotent) { int nextExecution = execution + 1; long nextDelay = speculativeExecutionPolicy.nextExecution(node, keyspace, statement, nextExecution); if (nextDelay >= 0) { LOG.trace( "[{}] Scheduling speculative execution in ms", logPrefix, nextExecution, nextDelay); scheduledExecutions.add( scheduler.schedule( () -> { if (!result.isDone()) { LOG.trace( "[{}] Starting speculative execution {}", CqlRequestHandlerBase.this.logPrefix, nextExecution); activeExecutionsCount.incrementAndGet(); startedSpeculativeExecutionsCount.incrementAndGet(); ((DefaultNode) node) .getMetricUpdater() .incrementCounter( DefaultNodeMetric.SPECULATIVE_EXECUTIONS, executionProfile.getName()); sendRequest(null, nextExecution, 0, true); } }, nextDelay, TimeUnit.MILLISECONDS)); } else { LOG.trace( "[{}] Speculative execution policy returned {}, no next execution", logPrefix, nextDelay); } } } } }</code><technical_language>I create some static variable, i.e: private static final NO_MEASURMENT = -1; instead of a magic number -1 refer</technical_language>

Target:
public void operationComplete(Future<java.lang.Void> future) throws Exception { if (!future.isSuccess()) { Throwable error = future.cause(); if (error instanceof EncoderException && error.getCause() instanceof FrameTooLongException) { trackNodeError(node, error.getCause(), NANOTIME_NOT_MEASURED_YET); setFinalError(error.getCause(), node, execution); } else { LOG.trace( "[{}] Failed to send request on {}, trying next node (cause: {})", logPrefix, channel, error); recordError(node, error); trackNodeError(node, error, NANOTIME_NOT_MEASURED_YET); ((DefaultNode) node) .getMetricUpdater() .incrementCounter(DefaultNodeMetric.UNSENT_REQUESTS, executionProfile.getName()); sendRequest(null, execution, retryCount, scheduleNextExecution); } } else { LOG.trace("[{}] Request sent on {}", logPrefix, channel); if (result.isDone()) { cancel(); } else { inFlightCallbacks.add(this); if (scheduleNextExecution && isIdempotent) { int nextExecution = execution + 1; long nextDelay = speculativeExecutionPolicy.nextExecution(node, keyspace, statement, nextExecution); if (nextDelay >= 0) { LOG.trace( "[{}] Scheduling speculative execution in ms", logPrefix, nextExecution, nextDelay); scheduledExecutions.add( scheduler.schedule( () -> { if (!result.isDone()) { LOG.trace( "[{}] Starting speculative execution {}", CqlRequestHandlerBase.this.logPrefix, nextExecution); activeExecutionsCount.incrementAndGet(); startedSpeculativeExecutionsCount.incrementAndGet(); ((DefaultNode) node) .getMetricUpdater() .incrementCounter( DefaultNodeMetric.SPECULATIVE_EXECUTIONS, executionProfile.getName()); sendRequest(null, nextExecution, 0, true); } }, nextDelay, TimeUnit.MILLISECONDS)); } else { LOG.trace( "[{}] Speculative execution policy returned {}, no next execution", logPrefix, nextDelay); } } } } }