mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
defer construction of optional log messages
This commit is contained in:
parent
cca3ac9a14
commit
14bd72136b
@ -223,7 +223,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
|
|||||||
executorService.shutdown();
|
executorService.shutdown();
|
||||||
boolean wasStopped = false;
|
boolean wasStopped = false;
|
||||||
try {
|
try {
|
||||||
logger.trace("awaiting termination with timeout of " + secondsToWait + " seconds");
|
logger.trace(() -> "awaiting termination with timeout of " + secondsToWait + " seconds");
|
||||||
wasStopped = executorService.awaitTermination(secondsToWait, TimeUnit.SECONDS);
|
wasStopped = executorService.awaitTermination(secondsToWait, TimeUnit.SECONDS);
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
logger.trace("interrupted while awaiting termination");
|
logger.trace("interrupted while awaiting termination");
|
||||||
@ -231,7 +231,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
|
|||||||
logger.warn("while waiting termination of activity " + activity.getAlias() + ", " + ie.getMessage());
|
logger.warn("while waiting termination of activity " + activity.getAlias() + ", " + ie.getMessage());
|
||||||
activitylogger.debug("REQUEST STOP/exception alias=(" + activity.getAlias() + ") wasstopped=" + wasStopped);
|
activitylogger.debug("REQUEST STOP/exception alias=(" + activity.getAlias() + ") wasstopped=" + wasStopped);
|
||||||
} finally {
|
} finally {
|
||||||
logger.trace("finally shutting down activity " + this.getActivity().getAlias());
|
logger.trace(() -> "finally shutting down activity " + this.getActivity().getAlias());
|
||||||
activity.shutdownActivity();
|
activity.shutdownActivity();
|
||||||
logger.trace("closing auto-closeables");
|
logger.trace("closing auto-closeables");
|
||||||
activity.closeAutoCloseables();
|
activity.closeAutoCloseables();
|
||||||
@ -240,7 +240,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stoppingException != null) {
|
if (stoppingException != null) {
|
||||||
logger.trace("an exception caused the activity to stop:" + stoppingException.getMessage());
|
logger.trace(() -> "an exception caused the activity to stop:" + stoppingException.getMessage());
|
||||||
throw stoppingException;
|
throw stoppingException;
|
||||||
}
|
}
|
||||||
activitylogger.debug("REQUEST STOP/after alias=(" + activity.getAlias() + ") wasstopped=" + wasStopped);
|
activitylogger.debug("REQUEST STOP/after alias=(" + activity.getAlias() + ") wasstopped=" + wasStopped);
|
||||||
@ -330,12 +330,12 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
|
|||||||
* @param activityDef the activityDef for this activity instance
|
* @param activityDef the activityDef for this activity instance
|
||||||
*/
|
*/
|
||||||
private synchronized void adjustToActivityDef(ActivityDef activityDef) {
|
private synchronized void adjustToActivityDef(ActivityDef activityDef) {
|
||||||
logger.trace(">-pre-adjust->" + getSlotStatus());
|
logger.trace(() -> ">-pre-adjust->" + getSlotStatus());
|
||||||
|
|
||||||
// Stop and remove extra motor slots
|
// Stop and remove extra motor slots
|
||||||
while (motors.size() > activityDef.getThreads()) {
|
while (motors.size() > activityDef.getThreads()) {
|
||||||
Motor motor = motors.get(motors.size() - 1);
|
Motor motor = motors.get(motors.size() - 1);
|
||||||
logger.trace("Stopping cycle motor thread:" + motor);
|
logger.trace(() -> "Stopping cycle motor thread:" + motor);
|
||||||
motor.requestStop();
|
motor.requestStop();
|
||||||
motors.remove(motors.size() - 1);
|
motors.remove(motors.size() - 1);
|
||||||
}
|
}
|
||||||
@ -344,20 +344,20 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
|
|||||||
while (motors.size() < activityDef.getThreads()) {
|
while (motors.size() < activityDef.getThreads()) {
|
||||||
|
|
||||||
Motor motor = activity.getMotorDispenserDelegate().getMotor(activityDef, motors.size());
|
Motor motor = activity.getMotorDispenserDelegate().getMotor(activityDef, motors.size());
|
||||||
logger.trace("Starting cycle motor thread:" + motor);
|
logger.trace(() -> "Starting cycle motor thread:" + motor);
|
||||||
motors.add(motor);
|
motors.add(motor);
|
||||||
}
|
}
|
||||||
|
|
||||||
applyIntendedStateToDivergentMotors();
|
applyIntendedStateToDivergentMotors();
|
||||||
awaitActivityAndMotorStateAlignment();
|
awaitActivityAndMotorStateAlignment();
|
||||||
|
|
||||||
logger.trace(">post-adjust->" + getSlotStatus());
|
logger.trace(() -> ">post-adjust->" + getSlotStatus());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyIntendedStateToDivergentMotors() {
|
private void applyIntendedStateToDivergentMotors() {
|
||||||
RunState intended = activity.getRunState();
|
RunState intended = activity.getRunState();
|
||||||
logger.trace("ADJUSTING to INTENDED " + intended);
|
logger.trace(() -> "ADJUSTING to INTENDED " + intended);
|
||||||
switch (intended) {
|
switch (intended) {
|
||||||
case Uninitialized:
|
case Uninitialized:
|
||||||
break;
|
break;
|
||||||
@ -429,7 +429,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
|
|||||||
for (RunState desiredRunState : desiredRunStates) {
|
for (RunState desiredRunState : desiredRunStates) {
|
||||||
actualStates.remove(desiredRunState);
|
actualStates.remove(desiredRunState);
|
||||||
}
|
}
|
||||||
logger.trace("state of remaining slots:" + actualStates);
|
logger.trace(() -> "state of remaining slots:" + actualStates);
|
||||||
if (actualStates.size() == 0) {
|
if (actualStates.size() == 0) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -440,7 +440,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.trace(activityDef.getAlias() + "/Motor[" + m.getSlotId() + "] is now in state " + m.getSlotStateTracker().getSlotState());
|
logger.trace(() -> activityDef.getAlias() + "/Motor[" + m.getSlotId() + "] is now in state " + m.getSlotStateTracker().getSlotState());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,7 +453,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
|
|||||||
for (Motor motor : motors) {
|
for (Motor motor : motors) {
|
||||||
awaited = awaitMotorState(motor, waitTime, pollTime, awaitingState);
|
awaited = awaitMotorState(motor, waitTime, pollTime, awaitingState);
|
||||||
if (!awaited) {
|
if (!awaited) {
|
||||||
logger.trace("failed awaiting motor " + motor.getSlotId() + " for state in " +
|
logger.trace(() -> "failed awaiting motor " + motor.getSlotId() + " for state in " +
|
||||||
Arrays.asList(awaitingState));
|
Arrays.asList(awaitingState));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -469,7 +469,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
|
|||||||
for (Motor motor : motors) {
|
for (Motor motor : motors) {
|
||||||
for (RunState state : awaitingState) {
|
for (RunState state : awaitingState) {
|
||||||
if (motor.getSlotStateTracker().getSlotState() == state) {
|
if (motor.getSlotStateTracker().getSlotState() == state) {
|
||||||
logger.trace("at least one 'any' of " + activityDef.getAlias() + "/Motor[" + motor.getSlotId() + "] is now in state " + motor.getSlotStateTracker().getSlotState());
|
logger.trace(() -> "at least one 'any' of " + activityDef.getAlias() + "/Motor[" + motor.getSlotId() + "] is now in state " + motor.getSlotStateTracker().getSlotState());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -479,7 +479,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
|
|||||||
} catch (InterruptedException ignored) {
|
} catch (InterruptedException ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.trace("none of " + activityDef.getAlias() + "/Motor [" + motors.size() + "] is in states in " + Arrays.asList(awaitingState));
|
logger.trace(() -> "none of " + activityDef.getAlias() + "/Motor [" + motors.size() + "] is in states in " + Arrays.asList(awaitingState));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,7 +504,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
|
|||||||
logger.error(error);
|
logger.error(error);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
logger.trace("motor " + m + " entered awaited state: " + Arrays.asList(awaitingState));
|
logger.trace(() -> "motor " + m + " entered awaited state: " + Arrays.asList(awaitingState));
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void requestStopMotors() {
|
private synchronized void requestStopMotors() {
|
||||||
|
Loading…
Reference in New Issue
Block a user