private void registerExitHandler(PlatformManager mgr) { mgr.registerExitHandler(new VoidHandler() { public void handle() { unblock(); } }); }
/** * Exits the container. */ public static void exit() { PhpVerticleFactory.container.exit(); }
/** * Stop the platform manager */ @Override public void stop() { manager.stop(); } }
/** * Returns the Vertx configuration. */ public static ArrayValue config(Env env) { return PhpTypes.arrayFromJson(env, PhpVerticleFactory.container.config()); }
private PlatformManager createPM(int port, String host, int quorumSize, String haGroup) { PlatformManager pm = PlatformLocator.factory.createPlatformManager(port, host, quorumSize, haGroup); registerExitHandler(pm); return pm; }
/** * {@inheritDoc} */ @Override public Verticle createVerticle(String main) throws Exception { Verticle verticle = new HK2VerticleLoader(main, cl); verticle.setVertx(vertx); verticle.setContainer(container); return verticle; }
@Override public void start(StartContext context) throws StartException { this.platformManager = PlatformLocator.factory.createPlatformManager(); }
/** * Returns the Vertx logger. */ public static Logger logger() { return PhpVerticleFactory.container.logger(); }
synchronized void decRef() { refCount--; if (!resident && refCount == 0) { mgr.removeModule(moduleKey); mcl.close(); if (factory != null) { factory.close(); } } }
/** * Override this method to signify that start is complete sometime _after_ the start() method has returned * This is useful if your verticle deploys other verticles or modules and you don't want this verticle to * be considered started until the other modules and verticles have been started. * @param startedResult When you are happy your verticle is started set the result */ public void start(Future<Void> startedResult) { start(); startedResult.setResult(null); }
@Override public void start(StartContext context) throws StartException { this.vertx = this.platformManagerInjector.getValue().vertx(); }
/** * Vert.x calls the stop method when the verticle is undeployed. * Put any cleanup code for your verticle in here */ @Override public void stop() { this.cl = null; // Destroy the service locator ServiceLocatorFactory.getInstance().destroy(locator); locator = null; // Stop the real verticle if (realVerticle != null) { realVerticle.stop(); realVerticle = null; } }
public synchronized VerticleFactory getVerticleFactory(String factoryName, Vertx vertx, Container container) throws ClassNotFoundException, InstantiationException, IllegalAccessException { if (factory == null) { Class clazz = mcl.loadClass(factoryName); factory = (VerticleFactory)clazz.newInstance(); factory.init(vertx, container, mcl); } return factory; }
/** * List all deployments, with deployment ID and number of instances * * @return map of instances */ @Override public Map<String, Integer> listInstances() { return manager.listInstances(); }
public void reportException(Throwable t) { factory.reportException(logger, t); } }
private PlatformManager createPM(int port, String host) { PlatformManager pm = PlatformLocator.factory.createPlatformManager(port, host); registerExitHandler(pm); return pm; }
public JavaClassRunner(Class<?> klass) throws InitializationError { super(klass); setTestProperties(); mgr = PlatformLocator.factory.createPlatformManager(); }
@Override public void stop(StopContext context) { this.platformManager.stop(); }
/** * Register a handler that will be called when the platform exits because of a verticle calling container.exit() * * @param handler The handler */ @Override public void registerExitHandler(Handler<Void> handler) { manager.registerExitHandler(handler); }