java - How can I know how many concurrent flows are currently active -
does spring-webflow provide way of getting know number of flows executing ?
i work around global bean, maybe webflow provides solution out-of-the-box.
edit: requested, here called "global bean" solution based on flowexecutionlisteneradapter
package your.package; import org.apache.log4j.logger; import org.springframework.webflow.core.collection.attributemap; import org.springframework.webflow.definition.statedefinition; import org.springframework.webflow.definition.transitiondefinition; import org.springframework.webflow.execution.flowexecutionlisteneradapter; import org.springframework.webflow.execution.flowsession; import org.springframework.webflow.execution.requestcontext; public class flowexecutionlistener extends flowexecutionlisteneradapter { private static logger logger = logger.getlogger(flowexecutionlistener.class); private int sessioncount = 0; @override public void sessionstarted(final requestcontext context, final flowsession session) { super.sessionstarted(context, session); sessioncount++; logger.debug("sessionstarted, state: " + session.getstate().getid() + ", count: " + sessioncount); } @override public void sessionended(final requestcontext context, final flowsession session, final string outcome, final attributemap output) { super.sessionended(context, session, outcome, output); sessioncount--; logger.debug("sessionended, state: " + session.getstate().getid() + ", count: " + sessioncount); } }
the bean must registered @ spring-level:
<bean id="flowexecutionlistener" class="your.package.flowexecutionlistener" />
edit2:
if have more 1 webflow in application, count all active flows. in case want account them separately, can flow's id session.getdefinition().getid().
Comments
Post a Comment