Package org.jboss.as.test.clustering.cluster.ejb.stateful.bean

Examples of org.jboss.as.test.clustering.cluster.ejb.stateful.bean.Incrementor


    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String module = getRequiredParameter(req, MODULE);
        String bean = getRequiredParameter(req, BEAN);
        HttpSession session = req.getSession(true);
        Incrementor incrementor = (Incrementor) session.getAttribute(BEAN);
        if (incrementor == null) {
            try (LocalEJBDirectory directory = new LocalEJBDirectory(module)) {
                incrementor = directory.lookupStateful(bean, Incrementor.class);
            } catch (NamingException e) {
                throw new ServletException(e);
            }
        }
        try {
            resp.setHeader(COUNT, String.valueOf(incrementor.increment()));
            session.setAttribute(BEAN, incrementor);
        } catch (NoSuchEJBException e) {
            resp.setHeader(COUNT, String.valueOf(0));
            session.removeAttribute(BEAN);
        }
View Full Code Here

TOP

Related Classes of org.jboss.as.test.clustering.cluster.ejb.stateful.bean.Incrementor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.