public void shutdown() { log.debug("Stopping " + installedOrder.size() + " services"); KernelController controller = kernel.getController(); int serviceCounter = 0; // Uninstall all the contexts we know about ListIterator<ServiceControllerContext> iterator = installedOrder.listIterator(installedOrder.size()); while (iterator.hasPrevious()) { ServiceControllerContext context = iterator.previous(); controller.uninstall(context.getName()); ++serviceCounter; } log.debug("Stopped " + serviceCounter + " services"); // Shutdown ourselves controller.uninstall(ServiceControllerMBean.OBJECT_NAME.getCanonicalName()); }
/** * Add the passed lifecycle dependencies to the context * * @param context the context * @param depends the dependencies */ private void addDependencies(ServiceControllerContext context, Collection<ObjectName> depends) { DependencyInfo info = context.getDependencyInfo(); for (ObjectName other : depends) { info.addIDependOn(new LifecycleDependencyItem(context.getName(), other.getCanonicalName(), ControllerState.CREATE)); info.addIDependOn(new LifecycleDependencyItem(context.getName(), other.getCanonicalName(), ControllerState.START)); } }
/** * Add the passed lifecycle dependencies to the context * * @param context the context * @param depends the dependencies */ private void addDependencies(ServiceControllerContext context, Collection<ObjectName> depends) { DependencyInfo info = context.getDependencyInfo(); for (ObjectName other : depends) { info.addIDependOn(new LifecycleDependencyItem(context.getName(), other.getCanonicalName(), ControllerState.CREATE)); info.addIDependOn(new LifecycleDependencyItem(context.getName(), other.getCanonicalName(), ControllerState.START)); } }
public void shutdown() { log.debugf("Stopping %1d services", installedOrder.size()); KernelController controller = kernel.getController(); int serviceCounter = 0; // Uninstall all the contexts we know about ListIterator<ServiceControllerContext> iterator = installedOrder.listIterator(installedOrder.size()); while (iterator.hasPrevious()) { ServiceControllerContext context = iterator.previous(); controller.uninstall(context.getName()); ++serviceCounter; } log.debugf("Stopped %1d services", serviceCounter); // Shutdown ourselves controller.uninstall(ServiceControllerMBean.OBJECT_NAME.getCanonicalName()); }
/** * Safely remove any potentially registered context (usually after an error) * * @param ctx the context */ private void safelyRemoveAnyRegisteredContext(ServiceControllerContext ctx) { // First the context must have a controller Controller controller = ctx.getController(); if (controller != null) { // The name must be registered and it must be our context Object name = ctx.getName(); ControllerContext registered = controller.getContext(name, null); if (registered == ctx) controller.uninstall(name); } } }
/** * Safely remove any potentially registered context (usually after an error) * * @param ctx the context */ private void safelyRemoveAnyRegisteredContext(ServiceControllerContext ctx) { // First the context must have a controller Controller controller = ctx.getController(); if (controller != null) { // The name must be registered and it must be our context Object name = ctx.getName(); ControllerContext registered = controller.getContext(name, null); if (registered == ctx) controller.uninstall(name); } } }
public void visit(ServiceMetaDataVisitor visitor) { ServiceControllerContext context = visitor.getControllerContext(); Object name = context.getName(); List<String> list = dependencies; try { List<ObjectName> names = getObjectNames(); list = new ArrayList<String>(names.size()); for (ObjectName objectName : names) list.add(objectName.getCanonicalName()); } catch (MalformedObjectNameException ignored) { } for (String other : list) { // TODO visitor.addDependency(new LifecycleDependencyItem(name, other, ControllerState.CONFIGURED)); visitor.addDependency(new LifecycleDependencyItem(name, other, ControllerState.CREATE)); visitor.addDependency(new LifecycleDependencyItem(name, other, ControllerState.START)); } visitor.visit(this); } }
public void visit(ServiceMetaDataVisitor visitor) { ServiceControllerContext context = visitor.getControllerContext(); Object name = context.getName(); List<String> list = dependencies; try { List<ObjectName> names = getObjectNames(); list = new ArrayList<String>(names.size()); for (ObjectName objectName : names) list.add(objectName.getCanonicalName()); } catch (MalformedObjectNameException ignored) { } for (String other : list) { // TODO visitor.addDependency(new LifecycleDependencyItem(name, other, ControllerState.CONFIGURED)); visitor.addDependency(new LifecycleDependencyItem(name, other, ControllerState.CREATE)); visitor.addDependency(new LifecycleDependencyItem(name, other, ControllerState.START)); } visitor.visit(this); } }
public void visit(ServiceMetaDataVisitor visitor) { ServiceControllerContext context = visitor.getControllerContext(); Object name = context.getName(); ControllerState whenRequired = visitor.getContextState(); DependencyItem item = new AbstractDependencyItem(name, dependency, whenRequired, dependentState); visitor.addDependency(item); visitor.visit(this); }
public void visit(ServiceMetaDataVisitor visitor) { ServiceControllerContext context = visitor.getControllerContext(); underlyingContext = context; // remember context, leak? Object name = context.getName(); ControllerState whenRequired = visitor.getContextState(); DependencyItem item = new AbstractDependencyItem(name, dependency, whenRequired, dependentState); visitor.addDependency(item); visitor.visit(this); } }
public void visit(ServiceMetaDataVisitor visitor) { ServiceControllerContext context = visitor.getControllerContext(); Object name = context.getName(); ControllerState whenRequired = visitor.getContextState(); DependencyItem item = new AbstractDependencyItem(name, dependency, whenRequired, dependentState); visitor.addDependency(item); visitor.visit(this); }
public void visit(ServiceMetaDataVisitor visitor) { ServiceControllerContext context = visitor.getControllerContext(); Object name = context.getName(); ControllerState whenRequired = visitor.getContextState(); DependencyItem item = new AbstractDependencyItem(name, dependency, whenRequired, dependentState); visitor.addDependency(item); visitor.visit(this); } }
/** * @see ServiceDependencyMetaData#visit(ServiceMetaDataVisitor) * */ @Override public void visit(ServiceMetaDataVisitor visitor) { ServiceControllerContext context = visitor.getControllerContext(); Object name = context.getName(); Object dependency = this.getIDependOn(); try { dependency = getIDependOnObjectName().getCanonicalName(); } catch (MalformedObjectNameException ignored) { } visitor.addDependency(new AbstractDependencyItem(name, dependency, this.whenRequired, this.dependentState)); visitor.visit(this); } }
public void visit(ServiceMetaDataVisitor visitor) { ServiceControllerContext context = visitor.getControllerContext(); Object name = context.getName(); Object other = iDependOn; try { other = getIDependOnObjectName().getCanonicalName(); } catch (MalformedObjectNameException ignored) { } visitor.addDependency(new LifecycleDependencyItem(name, other, ControllerState.CREATE)); visitor.addDependency(new LifecycleDependencyItem(name, other, ControllerState.START)); visitor.visit(this); } }
public void visit(ServiceMetaDataVisitor visitor) { ServiceControllerContext context = visitor.getControllerContext(); Object name = context.getName(); Object other = dependency; try { other = getObjectName().getCanonicalName(); } catch (MalformedObjectNameException ignored) { } // TODO visitor.addDependency(new LifecycleDependencyItem(name, other, ControllerState.CONFIGURED)); visitor.addDependency(new LifecycleDependencyItem(name, other, ControllerState.CREATE)); visitor.addDependency(new LifecycleDependencyItem(name, other, ControllerState.START)); visitor.visit(this); } }
public void visit(ServiceMetaDataVisitor visitor) { ServiceControllerContext context = visitor.getControllerContext(); Object name = context.getName(); Object other = dependency; try { other = getObjectName().getCanonicalName(); } catch (MalformedObjectNameException ignored) { } // TODO visitor.addDependency(new LifecycleDependencyItem(name, other, ControllerState.CONFIGURED)); visitor.addDependency(new LifecycleDependencyItem(name, other, ControllerState.CREATE)); visitor.addDependency(new LifecycleDependencyItem(name, other, ControllerState.START)); visitor.visit(this); } }
public void visit(ServiceMetaDataVisitor visitor) { ServiceControllerContext context = visitor.getControllerContext(); Object name = context.getName(); Object other = iDependOn; try { other = getIDependOnObjectName().getCanonicalName(); } catch (MalformedObjectNameException ignored) { } visitor.addDependency(new LifecycleDependencyItem(name, other, ControllerState.CREATE)); visitor.addDependency(new LifecycleDependencyItem(name, other, ControllerState.START)); visitor.visit(this); } }