public void registerVerticleFactory(VerticleFactory factory) { if (factory.prefix() == null) { throw new IllegalArgumentException("factory.prefix() cannot be null"); } if (verticleFactories.containsKey(factory.prefix())) { throw new IllegalArgumentException( "There is already a registered verticle factory with prefix " + factory.prefix()); } verticleFactories.put(factory.prefix(), factory); }
private void loadVerticleFactories() { ServiceLoader<VerticleFactory> factories = ServiceLoader.load(VerticleFactory.class); Iterator<VerticleFactory> iter = factories.iterator(); while (iter.hasNext()) { VerticleFactory factory = iter.next(); factory.init(vertx); String prefix = factory.prefix(); if (verticleFactories.containsKey(prefix)) { log.warn( "Not loading verticle factory: " + factory + " as prefix " + prefix + " is already in use"); } else { verticleFactories.put(prefix, factory); } } }
public void unregisterVerticleFactory(VerticleFactory factory) { if (verticleFactories.remove(factory.prefix()) == null) { throw new IllegalArgumentException("Factory " + factory + " is not registered"); } }