[Minor] only show rest trace summary on stage and prod
This commit is contained in:
parent
4c637ea144
commit
bdaceb46f7
|
@ -65,7 +65,7 @@ public class DefaultStrolchSessionHandler extends StrolchComponent implements St
|
||||||
this.privilegeHandler = getContainer().getComponent(PrivilegeHandler.class);
|
this.privilegeHandler = getContainer().getComponent(PrivilegeHandler.class);
|
||||||
this.certificateMap = new HashMap<>();
|
this.certificateMap = new HashMap<>();
|
||||||
|
|
||||||
this.sessionTimeoutTimer = new Timer("SessionTimeoutTimer");
|
this.sessionTimeoutTimer = new Timer("SessionTimeoutTimer"); //$NON-NLS-1$
|
||||||
long checkInterval = TimeUnit.MINUTES.toMillis(1);
|
long checkInterval = TimeUnit.MINUTES.toMillis(1);
|
||||||
this.sessionTimeoutTimer.schedule(new SessionTimeoutTask(), checkInterval, checkInterval);
|
this.sessionTimeoutTimer.schedule(new SessionTimeoutTask(), checkInterval, checkInterval);
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ public class DefaultStrolchSessionHandler extends StrolchComponent implements St
|
||||||
certificate.setLastAccess(System.currentTimeMillis());
|
certificate.setLastAccess(System.currentTimeMillis());
|
||||||
this.certificateMap.put(certificate.getAuthToken(), certificate);
|
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;
|
return certificate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,11 +174,11 @@ public class DefaultStrolchSessionHandler extends StrolchComponent implements St
|
||||||
certificateMap = new HashMap<>(map);
|
certificateMap = new HashMap<>(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
long reqLastAccessTime = System.currentTimeMillis() - sessionTtl;
|
long reqLastAccessTime = System.currentTimeMillis() - DefaultStrolchSessionHandler.this.sessionTtl;
|
||||||
|
|
||||||
for (Certificate certificate : certificateMap.values()) {
|
for (Certificate certificate : certificateMap.values()) {
|
||||||
if (certificate.getLastAccess() < reqLastAccessTime) {
|
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()));
|
logger.info(MessageFormat.format(msg, certificate.getAuthToken(), certificate.getUsername()));
|
||||||
invalidateSession(certificate);
|
invalidateSession(certificate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package li.strolch.rest;
|
package li.strolch.rest;
|
||||||
|
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
|
||||||
import li.strolch.agent.api.ComponentContainer;
|
import li.strolch.agent.api.ComponentContainer;
|
||||||
import li.strolch.agent.api.StrolchComponent;
|
import li.strolch.agent.api.StrolchComponent;
|
||||||
import li.strolch.rest.filters.AccessControlResponseFilter;
|
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.restTracing = configuration.getString(PARAM_REST_TRACING, "OFF"); //$NON-NLS-1$
|
||||||
this.restTracingThreshold = configuration.getString(PARAM_REST_TRACING_THRESHOLD, "SUMMARY"); //$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);
|
super.initialize(configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue