@Override public SoftwareProcessDriver getDriver() { return super.getDriver(); }
@Override protected void connectSensors() { super.connectSensors(); connectServiceUpIsRunning(); }
protected void preStop() { // note asymmetry that disconnectSensors is done in the entity not the driver // whereas on start the *driver* calls connectSensors, before calling postStart, // ie waiting for the entity truly to be started before calling postStart; // TODO feels like that confusion could be eliminated with a single place for pre/post logic!) log.debug("disconnecting sensors for "+this+" in entity.preStop"); disconnectSensors(); }
@Override protected void connectSensors() { super.connectSensors(); super.connectServiceUpIsRunning(); }
@Override protected void disconnectSensors() { super.disconnectServiceUpIsRunning(); super.disconnectSensors(); } }
protected void callRebindHooks() { connectSensors(); waitForServiceUp(); }
@Override protected void postStartCustom() { entity().postDriverStart(); if (entity().connectedSensors) { // many impls aren't idempotent - though they should be! log.debug("skipping connecting sensors for "+entity()+" in driver-tasks postStartCustom because already connected (e.g. restarting)"); } else { log.debug("connecting sensors for "+entity()+" in driver-tasks postStartCustom because already connected (e.g. restarting)"); entity().connectSensors(); } entity().waitForServiceUp(); entity().postStart(); }
@Override public void restart() { if (((SoftwareProcessImpl)entity()).getDriver() == null) { log.debug("restart of "+entity()+" has no driver - doing machine-level restart"); super.restart(); return; } if (Strings.isEmpty(entity().getAttribute(Attributes.HOSTNAME))) { log.debug("restart of "+entity()+" has no hostname - doing machine-level restart"); super.restart(); return; } log.debug("restart of "+entity()+" appears to have driver and hostname - doing driver-level restart"); ((SoftwareProcessImpl)entity()).getDriver().restart(); DynamicTasks.queue("post-restart", new Runnable() { public void run() { postStartCustom(); if (entity().getAttribute(Attributes.SERVICE_STATE) == Lifecycle.STARTING) entity().setAttribute(Attributes.SERVICE_STATE, Lifecycle.RUNNING); }}); }
@Override public void init() { super.init(); }
@Override protected void preStop() { // FIXME Confirm don't need to call jmxAdapter.deactivateAdapter(); super.preStop(); }
Task<?> task = Tasks.builder().name("stop").body(new Runnable() { public void run() { doStop(); } }).build(); Entities.submit(this, task).getUnchecked();
@Override protected void postStart() { super.postStart(); isActive = true; update(); }
@Override public JMSBrokerImpl configure(Map properties) { if (queueNames==null) queueNames = Lists.newArrayList(); if (groovyTruth(properties.get("queue"))) queueNames.add((String) properties.remove("queue")); if (groovyTruth(properties.get("queues"))) queueNames.addAll((Collection<String>) properties.remove("queues")); if (topicNames==null) topicNames = Lists.newArrayList(); if (groovyTruth(properties.get("topic"))) topicNames.add((String) properties.remove("topic")); if (groovyTruth(properties.get("topics"))) topicNames.addAll((Collection<String>) properties.remove("topics")); return (JMSBrokerImpl) super.configure(properties); }
@Override public void init() { super.init(); setAttribute(BROKER_ID, Math.abs(hashCode())); // Must be positive for partitioning to work }
@Override protected void preStop() { super.preStop(); serverPoolMemberTrackerPolicy.reset(); }
/** @see JavaWebAppSoftwareProcessImpl#stop() */ @Override protected void doStop() { super.doStop(); // zero our workrate derived workrates. setAttribute(REQUESTS_PER_SECOND, 0D); setAttribute(AVG_REQUESTS_PER_SECOND, 0D); } }
@Override protected void postStart() { super.postStart(); getDriver().configure(); // TODO implement this using AMQP connection, no external mechanism available // queueNames.each { String name -> addQueue(name) } }
@Override public AbstractEntity configure(Map flags) { AbstractEntity result = super.configure(flags); // Support old "cluster" flag (deprecated) if (flags.containsKey("cluster")) { Group cluster = (Group) flags.get("cluster"); LOG.warn("Deprecated use of AbstractController.cluster: entity {}; value {}", this, cluster); if (getConfig(SERVER_POOL) == null) { setConfig(SERVER_POOL, cluster); } } return result; }
@Override public RedisStoreDriver getDriver() { return (RedisStoreDriver) super.getDriver(); }
@Override protected void connectSensors() { super.connectSensors(); setBrokerUrl(); }