Package org.jboss.system

Examples of org.jboss.system.ServiceContext


               ServiceControllerMBean.class, false);
   }

   public String getStateString(ObjectName serviceName)
   {
      ServiceContext ctx = scmb.getServiceContext(serviceName);
      return ctx.getStateString();
   }
View Full Code Here


      scmb.remove(serviceName);
   }

   public boolean isStarted(ObjectName serviceName)
   {
      ServiceContext sc = scmb.getServiceContext(serviceName);
      return sc.state == ServiceContext.RUNNING;
   }
View Full Code Here

      return sc.state == ServiceContext.RUNNING;
   }
  
   public boolean isCreated(ObjectName serviceName)
   {
      ServiceContext sc = scmb.getServiceContext(serviceName);
      return sc.state == ServiceContext.CREATED;
   }
View Full Code Here

      return sc.state == ServiceContext.CREATED;
   }
  
   public boolean isStopped(ObjectName serviceName)
   {
      ServiceContext sc = scmb.getServiceContext(serviceName);
      return sc.state == ServiceContext.STOPPED;
   }
View Full Code Here

      return sc.state == ServiceContext.STOPPED;
   }
  
   public boolean isDestroyed(ObjectName serviceName)
   {
      ServiceContext sc = scmb.getServiceContext(serviceName);
      return sc.state == ServiceContext.DESTROYED;
   }
View Full Code Here

      return sc.state == ServiceContext.DESTROYED;
   }
  
   public boolean isFailed(ObjectName serviceName)
   {
      ServiceContext sc = scmb.getServiceContext(serviceName);
      return sc.state == ServiceContext.FAILED;
   }
View Full Code Here

   public List<ServiceContext> listIncompletelyDeployed()
   {
      List<ServiceContext> id = new ArrayList<ServiceContext>();
      for (Iterator<ServiceContext> i = installedServices.iterator(); i.hasNext();)
      {
         ServiceContext sc = i.next();
         if ( sc.state != ServiceContext.CREATED &&
              sc.state != ServiceContext.RUNNING &&
              sc.state != ServiceContext.STOPPED &&
              sc.state != ServiceContext.DESTROYED )
         {
View Full Code Here

   public List<ObjectName> listDeployedNames()
   {
      List<ObjectName> names = new ArrayList<ObjectName>(installedServices.size());
      for (Iterator<ServiceContext> i = installedServices.iterator(); i.hasNext();)
      {
         ServiceContext ctx = i.next();
         names.add(ctx.objectName);
      }

      return names;
   }
View Full Code Here

         log.warn("Ignoring request to register null service: ", new Exception("STACKTRACE"));
         return;
      }
     
      log.debug("Registering service " + serviceName);
      ServiceContext ctx = createServiceContext(serviceName);

      register(ctx, depends);
   }
View Full Code Here

         log.warn("Ignoring request to create null service: ", new Exception("STACKTRACE"));
         return;
      }
     
      log.debug("Creating service " + serviceName);
      ServiceContext ctx = createServiceContext(serviceName);

      // Register the context and its dependencies if necessary
      register(ctx, depends);

      // If we are already created (can happen in dependencies) or failed just return
      if (ctx.state == ServiceContext.CREATED
            || ctx.state == ServiceContext.RUNNING
            || ctx.state == ServiceContext.FAILED)
      {
         log.debug("Ignoring create request for service: " + ctx.objectName);
         return;
      }

      // JSR 77, and to avoid circular dependencies
      int oldState = ctx.state;
      ctx.state = ServiceContext.CREATED;

      // Are all the mbeans I depend on created?   if not just return
      for (Iterator iterator = ctx.iDependOn.iterator(); iterator.hasNext();)
      {
         ServiceContext sc = (ServiceContext) iterator.next();
         int state = sc.state;

         // A dependent is not created or running
         if (!(state == ServiceContext.CREATED || state == ServiceContext.RUNNING))
         {
            log.debug("waiting in create of " + serviceName +
                  " waiting on " + sc.objectName);
            ctx.state = oldState;
            return;
         }
      }

      // Call create on the service Proxy
      try
      {
         ctx.proxy.create();
         sendControllerNotification(ServiceMBean.CREATE_EVENT, serviceName);           
      }
      catch (Throwable e)
      {
         ctx.state = ServiceContext.FAILED;
         ctx.problem = e;
         log.warn("Problem creating service " + serviceName, e);
         return;
      }

      // Those that depend on me are waiting for my creation, recursively create them
      log.debug("Creating dependent components for: " + serviceName
            + " dependents are: " + ctx.dependsOnMe);
      ArrayList<ServiceContext> tmp = new ArrayList<ServiceContext>(ctx.dependsOnMe);
      for (int n = 0; n < tmp.size(); n++)
      {
         // marcf fixme circular dependencies?
         ServiceContext ctx2 = tmp.get(n);
         create(ctx2.objectName);
      }
      tmp.clear();
   }
View Full Code Here

TOP

Related Classes of org.jboss.system.ServiceContext

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.