コード例 #1
0
 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);
 }
コード例 #2
0
 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);
     }
   }
 }
コード例 #3
0
 public void unregisterVerticleFactory(VerticleFactory factory) {
   if (verticleFactories.remove(factory.prefix()) == null) {
     throw new IllegalArgumentException("Factory " + factory + " is not registered");
   }
 }