static List<InvokerService> createServiceList(Service[] services) { List<InvokerService> invokerServices = new ArrayList<InvokerService>(services.length); for (Service service : services) { invokerServices.add(new InvokerService(service)); } return invokerServices; }
/** * No public constructor. Use @{link InvokerService#createServiceArray(Service[])}. */ private InvokerService(Service service) { setService(service); }
/** * <p>getObjectInstances</p> */ public void getObjectInstances() { for (InvokerService invokerService : getServices()) { Service service = invokerService.getService(); try { // find the mbean LOG.debug("finding mbean instance {}", service.getName()); ObjectName name = new ObjectName(service.getName()); invokerService.setMbean(getServer().getObjectInstance(name)); } catch (Throwable t) { LOG.error("An error occurred loading the mbean {} of type {} it will be skipped", service.getName(), service.getClassName(), t); invokerService.setBadThrowable(t); } } }
Service service = invokerService.getService(); String name = invokerService.getService().getName(); ObjectInstance mbean = invokerService.getMbean(); if (invokerService.isBadService()) { resultInfo.add(new InvokerResult(service, mbean, null, invokerService.getBadThrowable())); if (isFailFast()) { return resultInfo; for (final Invoke invoke : invokerService.getService().getInvokes()) { if (invoke.getPass() != pass || !getAtType().equals(invoke.getAt())) { continue;
private List<String> status(final MBeanServer server) { LOG.debug("Beginning status check"); final Invoker invoker = new Invoker(); invoker.setServer(server); invoker.setAtType(InvokeAtType.STATUS); invoker.setFailFast(false); final List<InvokerService> services = InvokerService.createServiceList(new ServiceConfigFactory().getServices()); invoker.setServices(services); invoker.getObjectInstances(); final List<InvokerResult> results = invoker.invokeMethods(); final List<String> statusInfo = new ArrayList<String>(results.size()); for (final InvokerResult invokerResult : results) { if (invokerResult.getThrowable() == null) { statusInfo.add("Status: " + invokerResult.getMbean().getObjectName() + " = " + invokerResult.getResult().toString()); } else { statusInfo.add("Status: " + invokerResult.getMbean().getObjectName() + " = STATUS_CHECK_ERROR"); } } LOG.debug("Status check complete"); return statusInfo; }
/** * Get the last pass for a set of InvokerServices. * * @param invokerServices list to look at * @return highest pass value found for all Invoke objects in the * invokerServices list */ private int getLastPass() { List<InvokerService> invokerServices = getServices(); int end = 0; for (InvokerService invokerService : invokerServices) { Invoke[] invokes = invokerService.getService().getInvoke(); if (invokes == null) { continue; } for (Invoke invoke : invokes) { if (invoke.getPass() > end) { end = invoke.getPass(); } } } return end; }
Service service = invokerService.getService(); try { invokerService.setMbean(getServer().registerMBean(bean, name)); invokerService.setBadThrowable(t);
Service service = invokerService.getService(); String name = invokerService.getService().getName(); ObjectInstance mbean = invokerService.getMbean(); if (invokerService.isBadService()) { resultInfo.add(new InvokerResult(service, mbean, null, invokerService.getBadThrowable())); if (isFailFast()) { return resultInfo; for (Invoke invoke : invokerService.getService().getInvoke()) { if (invoke.getPass() != pass || !getAtType().equals(invoke.getAt())) { continue;
private void stop(MBeanServer server) { LOG.debug("Beginning shutdown"); Invoker invoker = new Invoker(); invoker.setServer(server); invoker.setAtType(InvokeAtType.STOP); invoker.setReverse(true); invoker.setFailFast(false); List<InvokerService> services = InvokerService.createServiceList(new ServiceConfigFactory().getServices()); invoker.setServices(services); invoker.getObjectInstances(); invoker.invokeMethods(); LOG.debug("Shutdown complete"); }
/** * Get the last pass for a set of InvokerServices. * * @param invokerServices list to look at * @return highest pass value found for all Invoke objects in the * invokerServices list */ private int getLastPass() { List<InvokerService> invokerServices = getServices(); int end = 0; for (final InvokerService invokerService : invokerServices) { final List<Invoke> invokes = invokerService.getService().getInvokes(); if (invokes == null) { continue; } for (final Invoke invoke : invokes) { if (invoke.getPass() > end) { end = invoke.getPass(); } } } return end; }
/** * <p>getObjectInstances</p> */ public void getObjectInstances() { for (InvokerService invokerService : getServices()) { Service service = invokerService.getService(); try { // find the mbean if (log().isDebugEnabled()) { log().debug("finding mbean instance " + service.getName()); } ObjectName name = new ObjectName(service.getName()); invokerService.setMbean(getServer().getObjectInstance(name)); } catch (Throwable t) { log().error("An error occurred loading the mbean " + service.getName() + " of type " + service.getClassName() + " it will be skipped", t); invokerService.setBadThrowable(t); } } }
private List<String> status(final MBeanServer server) { log().debug("Beginning status check"); final Invoker invoker = new Invoker(); invoker.setServer(server); invoker.setAtType(InvokeAtType.STATUS); invoker.setFailFast(false); final List<InvokerService> services = InvokerService.createServiceList(Invoker.getDefaultServiceConfigFactory().getServices()); invoker.setServices(services); invoker.getObjectInstances(); final List<InvokerResult> results = invoker.invokeMethods(); final List<String> statusInfo = new ArrayList<String>(results.size()); for (final InvokerResult invokerResult : results) { if (invokerResult.getThrowable() == null) { statusInfo.add("Status: " + invokerResult.getMbean().getObjectName() + " = " + invokerResult.getResult().toString()); } else { statusInfo.add("Status: " + invokerResult.getMbean().getObjectName() + " = STATUS_CHECK_ERROR"); } } log().debug("Status check complete"); return statusInfo; }
/** * No public constructor. Use @{link InvokerService#createServiceArray(Service[])}. */ private InvokerService(Service service) { setService(service); }
static List<InvokerService> createServiceList(Service[] services) { List<InvokerService> invokerServices = new ArrayList<InvokerService>(services.length); for (Service service : services) { invokerServices.add(new InvokerService(service)); } return invokerServices; }
Service service = invokerService.getService(); try { invokerService.setMbean(getServer().registerMBean(bean, name)); + service.getClassName() + ": " + t, t); invokerService.setBadThrowable(t);
invoker.setServer(server); invoker.setAtType(InvokeAtType.START); List<InvokerService> services = InvokerService.createServiceList(new ServiceConfigFactory().getServices()); invoker.setServices(services); invoker.instantiateClasses();
invoker.setServer(server); invoker.setAtType(InvokeAtType.START); List<InvokerService> services = InvokerService.createServiceList(Invoker.getDefaultServiceConfigFactory().getServices()); invoker.setServices(services); invoker.instantiateClasses();
private void stop(MBeanServer server) { log().debug("Beginning shutdown"); Invoker invoker = new Invoker(); invoker.setServer(server); invoker.setAtType(InvokeAtType.STOP); invoker.setReverse(true); invoker.setFailFast(false); List<InvokerService> services = InvokerService.createServiceList(Invoker.getDefaultServiceConfigFactory().getServices()); invoker.setServices(services); invoker.getObjectInstances(); invoker.invokeMethods(); log().debug("Shutdown complete"); }