code: @Override
      public void end() {
          final EntityManager em = entityManager.get();
  
          // Let's not penalize users for calling end() multiple times.
          if (null == em) {
            return;
          }
  
          final EntityTransaction tx = em.getTransaction();
  
          if(tx.isActive()) {
              LOG.warn("There was an active transaction at the end of a request");
              tx.commit();
          }
  
          em.close();
          entityManager.remove();
      }
docs: /*
  This is called as the last thing in the doFilter method in the Servlet filter.
  @see com.google.inject.persist.UnitOfWork#end()