OpenEJB
  1. OpenEJB
  2. OPENEJB-1249

Undeploy apps and stop ResourceAdapters on shutdown

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.3
    • Fix Version/s: 3.1.3
    • Component/s: server
    • Labels:
    • Environment:
      NA

      Description

      SimpleServiceManager.stop() not processing ResourceAdapters on a standalone remote stop due an oversight.

      Current implementation calls containerSystem.getJNDIContext().listBindings("openejb/resourceAdapters"); and then hides the naming exception.

      The following snippet resolves this issue, and also checks for instances of ResourceAdapter.

      try {
      ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
      NamingEnumeration<Binding> namingEnumeration = null;

      try

      { namingEnumeration = containerSystem.getJNDIContext().listBindings("openejb/Resource"); }

      catch (NamingException ignored)

      { logger.debug("No resource adapters were created"); }

      if (namingEnumeration != null) {

      while (namingEnumeration.hasMoreElements()) {

      Binding binding = namingEnumeration.nextElement();
      Object object = binding.getObject();

      if (object instanceof ResourceAdapter) {

      ResourceAdapter resourceAdapter = (ResourceAdapter) object;

      logger.debug("Stopping ResourceAdapter: " + binding.getName());

      try

      { resourceAdapter.stop(); }

      catch (Exception e)

      { logger.fatal("ResourceAdapter Shutdown Failed: " + binding.getName(), e); }

      }
      }

      } else

      { logger.warning("No resources were found"); }

      } catch (Throwable e)

      { logger.fatal("Unable to get ResourceAdapters from JNDI. Stop must be called on them for proper vm shutdown.", e); }

      1. SSM Patch.patch
        5 kB
        Andy Gumbrecht
      2. Server.java.patch
        0.5 kB
        David Blevins
      3. OPENEJB-1249.patch
        14 kB
        Andy Gumbrecht
      4. OPENEJB-1249.patch
        14 kB
        Andy Gumbrecht

        Activity

        Hide
        Andy Gumbrecht added a comment -

        With ASF inclusion ...oops.

        Show
        Andy Gumbrecht added a comment - With ASF inclusion ...oops.
        Hide
        Andy Gumbrecht added a comment -

        This call returns a 'null' object as a/the Server.class instance is never registered with the SystemInstance.
        Server server = SystemInstance.get().getComponent(Server.class);

        Server.stop() call should call manager.stop(); 'after' OpenEJB.destroy(); as this initiates a vm shutdown.

        This patch resolves the above issues.

        Show
        Andy Gumbrecht added a comment - This call returns a 'null' object as a/the Server.class instance is never registered with the SystemInstance. Server server = SystemInstance.get().getComponent(Server.class); Server.stop() call should call manager.stop(); 'after' OpenEJB.destroy(); as this initiates a vm shutdown. This patch resolves the above issues.
        Hide
        David Blevins added a comment -

        Committed the Server.java version that undeploys all apps and stops all resource adapters.

        Show
        David Blevins added a comment - Committed the Server.java version that undeploys all apps and stops all resource adapters.
        Hide
        Andy Gumbrecht added a comment -

        Fix for this issue

        Show
        Andy Gumbrecht added a comment - Fix for this issue

          People

          • Assignee:
            Andy Gumbrecht
            Reporter:
            Andy Gumbrecht
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 5m
              5m
              Remaining:
              Remaining Estimate - 5m
              5m
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development