[Minor] only show rest trace summary on stage and prod

This commit is contained in:
Robert von Burg 2014-11-14 16:13:54 +01:00
parent 4c637ea144
commit bdaceb46f7
2 changed files with 9 additions and 4 deletions

View File

@ -65,7 +65,7 @@ public class DefaultStrolchSessionHandler extends StrolchComponent implements St
this.privilegeHandler = getContainer().getComponent(PrivilegeHandler.class);
this.certificateMap = new HashMap<>();
this.sessionTimeoutTimer = new Timer("SessionTimeoutTimer");
this.sessionTimeoutTimer = new Timer("SessionTimeoutTimer"); //$NON-NLS-1$
long checkInterval = TimeUnit.MINUTES.toMillis(1);
this.sessionTimeoutTimer.schedule(new SessionTimeoutTask(), checkInterval, checkInterval);
@ -109,7 +109,7 @@ public class DefaultStrolchSessionHandler extends StrolchComponent implements St
certificate.setLastAccess(System.currentTimeMillis());
this.certificateMap.put(certificate.getAuthToken(), certificate);
logger.info(this.certificateMap.size() + " sessions currently active.");
logger.info(MessageFormat.format("{0} sessions currently active.", this.certificateMap.size())); //$NON-NLS-1$
return certificate;
}
}
@ -174,11 +174,11 @@ public class DefaultStrolchSessionHandler extends StrolchComponent implements St
certificateMap = new HashMap<>(map);
}
long reqLastAccessTime = System.currentTimeMillis() - sessionTtl;
long reqLastAccessTime = System.currentTimeMillis() - DefaultStrolchSessionHandler.this.sessionTtl;
for (Certificate certificate : certificateMap.values()) {
if (certificate.getLastAccess() < reqLastAccessTime) {
String msg = "Session {0} for user {1} has expired, invalidating session...";
String msg = "Session {0} for user {1} has expired, invalidating session..."; //$NON-NLS-1$
logger.info(MessageFormat.format(msg, certificate.getAuthToken(), certificate.getUsername()));
invalidateSession(certificate);
}

View File

@ -15,6 +15,8 @@
*/
package li.strolch.rest;
import java.text.MessageFormat;
import li.strolch.agent.api.ComponentContainer;
import li.strolch.agent.api.StrolchComponent;
import li.strolch.rest.filters.AccessControlResponseFilter;
@ -114,6 +116,9 @@ public class RestfulStrolchComponent extends StrolchComponent {
this.restTracing = configuration.getString(PARAM_REST_TRACING, "OFF"); //$NON-NLS-1$
this.restTracingThreshold = configuration.getString(PARAM_REST_TRACING_THRESHOLD, "SUMMARY"); //$NON-NLS-1$
String msg = "Set restTracing={0} with threshold={1}"; //$NON-NLS-1$
logger.info(MessageFormat.format(msg, this.restTracing, this.restTracingThreshold));
super.initialize(configuration);
}