• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Future类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.vertx.java.core.Future的典型用法代码示例。如果您正苦于以下问题:Java Future类的具体用法?Java Future怎么用?Java Future使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Future类属于org.vertx.java.core包,在下文中一共展示了Future类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: start

import org.vertx.java.core.Future; //导入依赖的package包/类
@Override
public void start(final Future<Void> startedResult) {
    container.deployVerticle("net.zyclonite.vertx.NetSocketVerticle", new AsyncResultHandler<String>() {
        public void handle(AsyncResult<String> deployResult) {
            if (deployResult.succeeded()) {
                startedResult.setResult(null);
            } else {
                startedResult.setFailure(deployResult.cause());
            }
        }
    });
    container.deployVerticle("net.zyclonite.vertx.HttpVerticle");
    container.deployVerticle("net.zyclonite.vertx.WebSocketVerticle");
    container.deployVerticle("JavaScriptVerticle.js");
    container.deployVerticle("ClosureVerticle.clj");
}
 
开发者ID:bwinparty,项目名称:HelloVertX,代码行数:17,代码来源:ApplicationVerticle.java


示例2: start

import org.vertx.java.core.Future; //导入依赖的package包/类
@Override
  public void start(final Future<Void> startedResult) {
try {
	InputStream input = MessageSendWithReplyTest.class.getResourceAsStream("/config/integration-test-config.json");
	String configString;

	configString = IOUtils.toString(input, Charset.defaultCharset());

	config = new JsonObject(configString);
	url = HttpRequestHelper.constructUrlStringFromConfig(config, EventBusInstruction.send);
	System.out.println("URL: " + url);
       container.deployVerticle(JerseyModule.class.getName(), config, new Handler<AsyncResult<String>>() {	        
		public void handle(AsyncResult<String> event) {
			if (event.succeeded()) {
				startedResult.setResult(null);
				MessageSendWithReplyTest.super.start();
			} else {
				startedResult.setFailure(event.cause());
			}
		}	         					
        });

} catch (IOException e) {
	startedResult.setFailure(e);
}
  }
 
开发者ID:j2ro,项目名称:mod-http-event-bus-bridge,代码行数:27,代码来源:MessageSendWithReplyTest.java


示例3: start

import org.vertx.java.core.Future; //导入依赖的package包/类
@Override
  public void start(final Future<Void> startedResult) {
try {
	InputStream input = MessagePublishTest.class.getResourceAsStream("/config/integration-test-config.json");
	String configString;

	configString = IOUtils.toString(input, Charset.defaultCharset());

	config = new JsonObject(configString);
	url = HttpRequestHelper.constructUrlStringFromConfig(config, EventBusInstruction.publish);
	
       container.deployVerticle(JerseyModule.class.getName(), config, new Handler<AsyncResult<String>>() {	        
		public void handle(AsyncResult<String> event) {
			if (event.succeeded()) {
				startedResult.setResult(null);
				MessagePublishTest.super.start();
			} else {
				startedResult.setFailure(event.cause());
			}
		}	         					
        });

} catch (IOException e) {
	startedResult.setFailure(e);
}
  }
 
开发者ID:j2ro,项目名称:mod-http-event-bus-bridge,代码行数:27,代码来源:MessagePublishTest.java


示例4: start

import org.vertx.java.core.Future; //导入依赖的package包/类
@Override
  public void start(final Future<Void> startedResult) {
try {
	InputStream input = MessageSendTest.class.getResourceAsStream("/config/integration-test-config.json");
	String configString;

	configString = IOUtils.toString(input, Charset.defaultCharset());

	config = new JsonObject(configString);
	url = HttpRequestHelper.constructUrlStringFromConfig(config, EventBusInstruction.send);
	
       container.deployVerticle(JerseyModule.class.getName(), config, new Handler<AsyncResult<String>>() {	        
		public void handle(AsyncResult<String> event) {
			if (event.succeeded()) {
				startedResult.setResult(null);
				MessageSendTest.super.start();
			} else {
				startedResult.setFailure(event.cause());
			}
		}	         					
        });

} catch (IOException e) {
	startedResult.setFailure(e);
}
  }
 
开发者ID:j2ro,项目名称:mod-http-event-bus-bridge,代码行数:27,代码来源:MessageSendTest.java


示例5: start

import org.vertx.java.core.Future; //导入依赖的package包/类
@Override
public void start(final Future<Void> startResult) {
  // Register a handler on the event bus to which users can send
  // a message telling the file sender to send a file.
  vertx.eventBus().registerHandler("sendfile", messageHandler, new Handler<AsyncResult<Void>>() {
    @Override
    public void handle(AsyncResult<Void> result) {
      // Once the handler has been registered, tell Vert.x and Vertigo
      // that the component has finished setup.
      if (result.failed()) {
        startResult.setFailure(result.cause());
      } else {
        startResult.setResult(null);
      }
    }
  });
}
 
开发者ID:kuujo,项目名称:vertigo,代码行数:18,代码来源:FileSendNetwork.java


示例6: start

import org.vertx.java.core.Future; //导入依赖的package包/类
@Override
public void start(final Future<Void> startResult) {
  component = Components.createComponent(vertx, container);
  context = component.context();
  cluster = component.cluster();
  logger = component.logger();
  input = component.input();
  output = component.output();
  vertigo = new Vertigo(this);
  log = LoggerFactory.getLogger(String.format("%s-%s", getClass().getCanonicalName(), context.address()));

  log.info(String.format("%s - Starting", component));
  component.start(new Handler<AsyncResult<Void>>() {
    @Override
    public void handle(AsyncResult<Void> result) {
      if (result.failed()) {
        startResult.setFailure(result.cause());
      } else {
        ComponentVerticle.super.start(startResult);
      }
    }
  });
}
 
开发者ID:kuujo,项目名称:vertigo,代码行数:24,代码来源:ComponentVerticle.java


示例7: start

import org.vertx.java.core.Future; //导入依赖的package包/类
@Override
public void start(Handler<AsyncResult<Void>> doneHandler) {
  final Future<Void> future = new DefaultFutureResult<Void>().setHandler(doneHandler);
  if (!started) {
    setup(new Handler<AsyncResult<Void>>() {
      @Override
      public void handle(AsyncResult<Void> result) {
        if (result.failed()) {
          future.setFailure(result.cause());
        } else {
          future.setResult(null);
        }
      }
    });
  }
  else {
    future.setResult(null);
  }
}
 
开发者ID:kuujo,项目名称:vertigo,代码行数:20,代码来源:DefaultComponent.java


示例8: start

import org.vertx.java.core.Future; //导入依赖的package包/类
@Override
public void start(final Future<Void> future) {
  vertx.eventBus().registerHandler("test", new Handler<Message<String>>() {
    @Override
    public void handle(Message<String> message) {
      received.add(message.body());
      if (received.size() == count) {
        testComplete();
      }
    }
  }, new Handler<AsyncResult<Void>>() {
    @Override
    public void handle(AsyncResult<Void> result) {
      if (result.failed()) {
        future.setFailure(result.cause());
      } else {
        TestManyToManySender.super.start(future);
      }
    }
  });
}
 
开发者ID:kuujo,项目名称:vertigo,代码行数:22,代码来源:PortTest.java


示例9: start

import org.vertx.java.core.Future; //导入依赖的package包/类
@Override
public void start(final Future<Void> startedResult) {
  super.start();
  final CountingCompletionHandler<Void> countDownLatch =
      new CountingCompletionHandler<Void>((VertxInternal) vertx);
  countDownLatch.setHandler(new Handler<AsyncResult<Void>>() {
    @Override
    public void handle(AsyncResult<Void> ar) {
      if (ar.failed()) {
        startedResult.setFailure(ar.cause());
      } else if (ar.succeeded()) {
        startedResult.setResult(null);
      }
    }
  });
  new ChannelBridge(vertx, config).setHook(new BridgeHook(vertx)).bridge(countDownLatch);
}
 
开发者ID:goodow,项目名称:realtime-channel,代码行数:18,代码来源:ChannelVerticle.java


示例10: start

import org.vertx.java.core.Future; //导入依赖的package包/类
@Override
public void start(Future<Void> startedResult) {
    //super.start();

    this.eventBus = vertx.eventBus();
    startNetServer(1234);
    startSockJSServer();

    // Here is how we start a Spring Application Context in Vert.x with mod-spring-appcontext
    // First create a JsonObject
    JsonObject configFiles = new JsonObject();

    // Then create a JsonArray to store the locations of your Spring configurations
    JsonArray xmlFilesArray = new JsonArray();
    xmlFilesArray.add("META-INF/spring/spring-in-vertx-context.xml");

    // Add the JsonAarry to the property "configFiles
    configFiles.putArray("configFiles", xmlFilesArray);
    // Add the type of Spring configuration that you are using xml or @Configuration to the property "configType"
    configFiles.putString("configType", ConfigType.XML.getValue());

    SpringApplicationContextHolder.setVertx(vertx);
    SpringApplicationContextHolder.createApplicationContext(configFiles);

    /* The first time this is called is when the ApplicationContext(s) are created. There is actually two created
       a parent and a child context. the parent will have the Vert.x instance so that the child, which has your beans
       can have vertx injected into them.
    */
    ApplicationContext context = SpringApplicationContextHolder.getApplicationContext();

    ChatHandler chatHandler = context.getBean(ChatHandler.class);

    eventBus.registerHandler(ChatService.CHAT_ADDRESS, chatHandler);
}
 
开发者ID:bytor99999,项目名称:SpringInAVertxWorld,代码行数:35,代码来源:ChatVerticle.java


示例11: start

import org.vertx.java.core.Future; //导入依赖的package包/类
@Override
public void start(final Future<Void> startedResult) {
	fileSystem = vertx.fileSystem();
	eventBus = vertx.eventBus();
	config = container.config();

	mapPathContent = new ConcurrentHashMap<>();

	registerOnEventBus();

	boolean pullInOnStartup = config.getBoolean(WebjarModuleConfig.PULLIN_ON_STARTUP,
			WebjarModuleConfig.PULLIN_ON_STARTUP_DEFAULT);
	if (pullInOnStartup) {
		container.deployWorkerVerticle(WebjarPullerVerticle.class.getName(), config, 1, false,
				new AsyncResultHandler<String>() {
					@Override
					public void handle(AsyncResult<String> event) {
						if (event.failed()) {
							startedResult.setFailure(event.cause());
						}

						loadWebjars();
						startedResult.setResult(null);
					}
				});
	} else {
		loadWebjars();
		startedResult.setResult(null);
	}
}
 
开发者ID:ylemoigne,项目名称:vertx-mod-webjar,代码行数:31,代码来源:WebjarVerticle.java


示例12: start

import org.vertx.java.core.Future; //导入依赖的package包/类
@Override
public void start(final Future<Void> startResult) {
  vertx.eventBus().registerHandler("test", messageHandler, new Handler<AsyncResult<Void>>() {
    @Override
    public void handle(AsyncResult<Void> result) {
      if (result.failed()) {
        startResult.setFailure(result.cause());
      } else {
        FaultTolerantFeeder.super.start(startResult);
      }
    }
  });
}
 
开发者ID:kuujo,项目名称:vertigo,代码行数:14,代码来源:FaultTolerantNetwork.java


示例13: start

import org.vertx.java.core.Future; //导入依赖的package包/类
@Override
public void start(final Future<Void> startResult) {
  boolean localOnly = container.config().getBoolean("local", false);
  String clusterName = container.config().getString("cluster", "vertigo");
  String groupName = container.config().getString("group", "DEFAULT");
  String nodeAddress = container.config().getString("node", Addresses.createUniqueAddress());
  PlatformManager platform = new DefaultPlatformManager(vertx, container);
  ClusterListener listener = new ClusterListenerFactory(vertx).createClusterListener(localOnly);
  ClusterData data = new ClusterDataFactory(vertx).createClusterData(localOnly);
  cluster = new DefaultClusterManager(clusterName, vertx, new ContextManager(vertx), platform, listener, data);
  group = new DefaultGroupManager(String.format("%s.%s", clusterName, groupName), clusterName, vertx, new ContextManager(vertx), platform, listener, data);
  node = new DefaultNodeManager(String.format("%s.%s.%s", clusterName, groupName, nodeAddress), String.format("%s.%s", clusterName, groupName), clusterName, vertx, new ContextManager(vertx), platform, listener, data);
  final CountingCompletionHandler<Void> counter = new CountingCompletionHandler<Void>(3);
  counter.setHandler(new Handler<AsyncResult<Void>>() {
    @Override
    public void handle(AsyncResult<Void> result) {
      if (result.failed()) {
        startResult.setFailure(result.cause());
      } else {
        startResult.setResult((Void) null);
      }
    }
  });
  cluster.start(counter);
  group.start(counter);
  node.start(counter);
}
 
开发者ID:kuujo,项目名称:vertigo,代码行数:28,代码来源:ClusterAgent.java


示例14: registerHandler

import org.vertx.java.core.Future; //导入依赖的package包/类
private void registerHandler(Future<Void> startedResult) {
	eb.registerHandler(config.getString("address", "image.resizer"), this);
	logger.info("BusModBase: Image resizer starts on address: " + config.getString("address"));
	startedResult.setResult(null);
}
 
开发者ID:web-education,项目名称:mod-image-resizer,代码行数:6,代码来源:ImageResizer.java



注:本文中的org.vertx.java.core.Future类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ShaderLinkHelper类代码示例发布时间:2022-05-22
下一篇:
Java KerberosTestUtils类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap