context.runOnContext(v -> { try { verticle.init(vertx, context); Future<Void> startFuture = Future.future(); verticle.start(startFuture);
@Override public void init(Vertx vertx, Context context) { delegateVerticle.init(vertx, context); }
context.runOnContext(v -> { try { verticle.init(vertx, context); Future<Void> startFuture = Future.future(); verticle.start(startFuture);
private Verticle createVerticle(final Class<?> clazz, ClassLoader classLoader) throws Exception { if (clazz.isAnnotationPresent(SpringVerticle.class)) { return createSpringVerticle(clazz, classLoader); } else if (Verticle.class.isAssignableFrom(clazz)) { // init a non spring verticle, but this should not happen final Verticle verticle = Verticle.class.cast(clazz.newInstance()); verticle.init(vertx, vertx.getOrCreateContext()); return verticle; } return null; }
@DocAnnotation$annotation$(description = " When you add a new route with a regular expression, you can add named capture groups for parameters. <br/>\n However, if you need more complex parameters names (like \"param_name\"), you can add parameters names with\n this function. You have to name capture groups in regex with names: \"p0\", \"p1\", \"p2\", ... <br/>\n <br/>\n For example: If you declare route with regex \\/(?<p0>[a-z]*)\\/(?<p1>[a-z]*) and group names ") @Override public void start(Future<Void> startFuture) throws Exception { ClassLoader loader = module.runner.getModuleClassLoader(); Method introspector = loader.loadClass("io.vertx.ceylon.core.impl.resolveVerticles_").getDeclaredMethod("resolveVerticles", String.class, String.class); Map<String, Callable<?>> moduleFactories = (Map<String, Callable<?>>) introspector.invoke(null, module.name, null); Callable<?> factory = moduleFactories.values().iterator().next(); verticle = (Verticle) factory.call(); verticle.init(vertx, context); verticle.start(startFuture); }
/** * Initialise the verticle.<p> * This is called by Vert.x when the verticle instance is deployed. Don't call it yourself. * * @param vertx the deploying Vert.x instance * @param context the context of the verticle */ @Override public void init(Vertx vertx, Context context) { super.init(vertx, context); try { // Create the real verticle and init realVerticle = createRealVerticle(); realVerticle.init(vertx, context); } catch (Throwable t) { if (t instanceof RuntimeException) { throw (RuntimeException) t; } throw new RuntimeException(t); } }
/** * Initialise the verticle.<p> * This is called by Vert.x when the verticle instance is deployed. Don't call it yourself. * * @param vertx the deploying Vert.x instance * @param context the context of the verticle */ @Override public void init(Vertx vertx, Context context) { super.init(vertx, context); try { // Create the real verticle and init realVerticle = createRealVerticle(); realVerticle.init(vertx, context); } catch (Throwable t) { if (t instanceof RuntimeException) { throw (RuntimeException) t; } throw new RuntimeException(t); } }
/** * Initialise the verticle.<p> * This is called by Vert.x when the verticle instance is deployed. Don't call it yourself. * * @param vertx the deploying Vert.x instance * @param context the context of the verticle */ @Override public void init(Vertx vertx, Context context) { super.init(vertx, context); try { // Create the real verticle and init realVerticle = createRealVerticle(); realVerticle.init(vertx, context); } catch (Throwable t) { if (t instanceof RuntimeException) { throw (RuntimeException) t; } throw new RuntimeException(t); } }