Package com.caucho.jca.pool

Examples of com.caucho.jca.pool.UserTransactionImpl


        xa.registerSynchronization(new EntityManagerSynchronization(em));

        return em;
      }

      UserTransactionImpl ut = _ut.getCurrentUserTransactionImpl();

      if (ut != null && ut.isInContext()) {
        em = _emf.createEntityManager(_persistenceUnit.getProperties());

        _threadEntityManager.set(em);

        ut.enlistCloseResource(new EntityManagerCloseResource(em));

        return em;
      }
     
      return null;
View Full Code Here


    Thread thread = Thread.currentThread();
    ClassLoader oldLoader = thread.getContextClassLoader();

    WebApp webApp = _webApp;

    UserTransactionImpl ut = null;
    if (_isTop)
      ut = _utm.getUserTransaction();

    try {
      thread.setContextClassLoader(webApp.getClassLoader());

      if (! webApp.enterWebApp() && webApp.getConfigException() == null) {
        if (response instanceof HttpServletResponse) {
          HttpServletResponse res = (HttpServletResponse) response;

          res.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
        }

        return;
      }

      /*
      if (_securityRoleMap != null && request instanceof AbstractHttpRequest)
        ((AbstractHttpRequest) request).setRoleMap(_securityRoleMap);
      */
      for (int i = 0; i < _requestListeners.length; i++) {
        ServletRequestEvent event = new ServletRequestEvent(_webApp, request);

        _requestListeners[i].requestInitialized(event);
      }

      _next.doFilter(request, response);
    } catch (Throwable e) {
      _errorPageManager.sendServletError(e, request, response);
    } finally {
      webApp.exitWebApp();

      for (int i = _requestListeners.length - 1; i >= 0; i--) {
        try {
          ServletRequestEvent event = new ServletRequestEvent(_webApp, request);

          _requestListeners[i].requestDestroyed(event);
        } catch (Throwable e) {
          log.log(Level.WARNING, e.toString(), e);
        }
      }

      // put finish() before access log so the session isn't tied up while
      // logging

      // needed for things like closing the session
      if (request instanceof HttpServletRequestImpl)
        ((HttpServletRequestImpl) request).finishInvocation();

      // server/1ld5
      if (_isTop) {
        ((CauchoResponse) response).close();

        try {
          if (ut != null)
            ut.abortTransaction();
        } catch (Throwable e) {
          log.log(Level.WARNING, e.toString(), e);
        }
      }

View Full Code Here

TOP

Related Classes of com.caucho.jca.pool.UserTransactionImpl

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.