Skip to content

Commit

Permalink
[Minor] Reduce logging statements by using more debug
Browse files Browse the repository at this point in the history
  • Loading branch information
eitch committed Oct 19, 2024
1 parent 3a97a86 commit bea39e2
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 168 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public Controller(String realm, ExecutionHandler executionHandler, Activity acti
this.activityId = activity.getId();
this.activity = activity;
this.inExecution = synchronizedMap(new HashMap<>());
this.lockRetries = executionHandler.getConfiguration().getInt(PROP_LOCK_RETRIES, 2);
this.lockRetries = executionHandler.getLockRetriesCount();
}

public String getRealm() {
Expand Down Expand Up @@ -160,7 +160,7 @@ public boolean execute() throws Exception {

// then we trigger execution for the same activity if the controller says it is needed
if (trigger) {
logger.info("Triggering additional execution of controller {} after execution.", this);
logger.debug("Triggering additional execution of controller {} after execution.", this);
triggerExecute(tx);
}

Expand Down Expand Up @@ -203,7 +203,7 @@ public void execute(StrolchTransaction tx) {
protected boolean internalExecute(StrolchTransaction tx) {
if (this.activity.getState().isExecuted()) {
this.executionHandler.removeFromExecution(this);
logger.info("Archiving executed activity {} with state {}", this.locator, this.activity.getState());
logger.debug("Archiving executed activity {} with state {}", this.locator, this.activity.getState());
this.executionHandler.archiveActivity(this.realm, this.activity.getLocator());
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
*/
public class EventBasedExecutionHandler extends ExecutionHandler {

public static final String ADDED_MSG = "Added {} @ {}";
protected final MapOfMaps<String, Locator, Controller> controllers;
protected Map<String, ExecutionHandlerState> statesByRealm;
protected DelayedExecutionTimer delayedExecutionTimer;
Expand Down Expand Up @@ -211,6 +212,7 @@ public void toExecution(String realm, Activity activity) {
Controller controller = this.controllers.getElement(realm, locator);
if (controller == null) {
controller = newController(realm, activity);
logger.info("Added {} @ {}", locator, realm);
this.controllers.addElement(realm, locator, controller);
notifyObserverAdd(controller);
}
Expand Down Expand Up @@ -312,6 +314,7 @@ public void reloadActivitiesInExecution(PrivilegeContext ctx, String realmName)

// register for execution
Controller controller = newController(realmName, activity);
logger.info(ADDED_MSG, locator, realmName);
this.controllers.addElement(realmName, locator, controller);
});

Expand Down Expand Up @@ -341,7 +344,7 @@ public void triggerExecution(String realm) {
return;
}

logger.info("Triggering execution for all controllers on realm {}...", realm);
logger.debug("Triggering execution for all controllers on realm {}...", realm);
getExecutor().execute(() -> {
synchronized (this.controllers) {
controllerStream(realm).forEach(this::toExecution);
Expand All @@ -358,15 +361,15 @@ protected void toExecution(Controller controller) {
return;
}

logger.info("Added toExecution task for {} @ {}", controller.getLocator(), realm);
logger.debug("Added toExecution task for {} @ {}", controller.getLocator(), realm);
getExecutor().execute(() -> {
try {

// execute the controller
boolean trigger = controller.execute();

if (trigger) {
logger.info("Triggering of controllers for realm {} after executing {}", realm, controller);
logger.debug("Triggering of controllers for realm {} after executing {}", realm, controller);
triggerExecution(realm);
}

Expand All @@ -390,7 +393,7 @@ public void toExecuted(Locator actionLoc) {

@Override
public void toExecuted(String realm, Locator locator) {
logger.info("Added toExecuted task for {} @ {}", locator, realm);
logger.debug("Added toExecuted task for {} @ {}", locator, realm);
getExecutor().execute(() -> {
try {

Expand Down Expand Up @@ -420,7 +423,7 @@ public void toStopped(Locator actionLoc) {

@Override
public void toStopped(String realm, Locator locator) {
logger.warn("Added toStopped task for {} @ {}", locator, realm);
logger.debug("Added toStopped task for {} @ {}", locator, realm);
getExecutor().execute(() -> {
try {

Expand Down Expand Up @@ -448,7 +451,7 @@ public void toError(Locator actionLoc) {

@Override
public void toError(String realm, Locator locator) {
logger.error("Added toError task for {} @ {}", locator, realm);
logger.debug("Added toError task for {} @ {}", locator, realm);
getExecutor().execute(() -> {
try {

Expand Down Expand Up @@ -476,7 +479,7 @@ public void toWarning(Locator actionLoc) {

@Override
public void toWarning(String realm, Locator locator) {
logger.warn("Added toWarning task for {} @ {}", locator, realm);
logger.debug("Added toWarning task for {} @ {}", locator, realm);
getExecutor().execute(() -> {
try {

Expand Down Expand Up @@ -504,7 +507,7 @@ public void archiveActivity(Locator activityLoc) {

@Override
public void archiveActivity(String realm, Locator activityLoc) {
logger.info("Added archiveActivity task for {} @ {}", activityLoc, realm);
logger.debug("Added archiveActivity task for {} @ {}", activityLoc, realm);
Locator trimmedLocator = trimLocator(activityLoc);
getExecutor().execute(() -> {
try {
Expand Down
Loading

0 comments on commit bea39e2

Please sign in to comment.