[
https://issues.apache.org/jira/browse/WICKET-6128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15208017#comment-15208017
]
Tobias Soloschenko commented on WICKET-6128:
--------------------------------------------
Hi,
yesterday I tried out the following setup:
Session counter:
{code}
private static final AtomicLong count = new AtomicLong(0);
{code}
Session is created and measured with:
{code}
@Around("execution(* org.apache.wicket.session.ISessionStore.bind(..))")
public Object aroundBind(ProceedingJoinPoint joinPoint) throws Throwable
{
return histogram("core/session/count", joinPoint,
count.getAndIncrement());
}
{code}
Session expired and measured with:
{code}
@Around("execution(* org.apache.wicket.Session.onInvalidate())")
public Object aroundInvalidate(ProceedingJoinPoint joinPoint) throws
Throwable
{
return histogram("core/session/count", joinPoint,
count.getAndDecrement());
}
{code}
The issue where was that the increment is working, but the decrement always
results in an exception, because the Application cant be resolved with
Application.get().
{code}
org.apache.wicket.WicketRuntimeException: There is no application attached to
current thread ContainerBackgroundProcessor[StandardEngine[Catalina]]
at org.apache.wicket.Application.get(Application.java:236)
at
org.apache.wicket.metrics.WicketMetrics.getSettings(WicketMetrics.java:189)
at
org.apache.wicket.metrics.WicketMetrics.histogram(WicketMetrics.java:96)
at
org.apache.wicket.metrics.aspects.session.ISessionStoreAspect.aroundInvalidate(ISessionStoreAspect.java:49)
at org.apache.wicket.Session.onInvalidate(Session.java:918)
at
org.apache.wicket.session.HttpSessionStore$SessionBindingListener.valueUnbound(HttpSessionStore.java:458)
at
org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1838)
at
org.apache.catalina.session.StandardSession.expire(StandardSession.java:891)
at
org.apache.catalina.session.StandardSession.isValid(StandardSession.java:694)
at
org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:666)
at
org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:651)
at
org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java:5625)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1377)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1381)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1381)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1349)
at java.lang.Thread.run(Thread.java:745)
{code}
I think there is a limit by using meta data and application, but if I use
static variables you said that OSGi would make trouble - I don't know where to
store the registry / settings then. Any ideas?
> Add metrics for currently active sessions
> -----------------------------------------
>
> Key: WICKET-6128
> URL: https://issues.apache.org/jira/browse/WICKET-6128
> Project: Wicket
> Issue Type: Improvement
> Components: wicket-metrics
> Affects Versions: 7.3.0
> Reporter: Martin Grigorov
> Assignee: Tobias Soloschenko
> Priority: Minor
>
> Add metric for the number of currently active Wicket sessions.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)