當前位置: 首頁>>代碼示例>>Java>>正文


Java Vertx.getOrCreateContext方法代碼示例

本文整理匯總了Java中io.vertx.core.Vertx.getOrCreateContext方法的典型用法代碼示例。如果您正苦於以下問題:Java Vertx.getOrCreateContext方法的具體用法?Java Vertx.getOrCreateContext怎麽用?Java Vertx.getOrCreateContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.vertx.core.Vertx的用法示例。


在下文中一共展示了Vertx.getOrCreateContext方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: PgPoolImpl

import io.vertx.core.Vertx; //導入方法依賴的package包/類
public PgPoolImpl(Vertx vertx, boolean closeVertx, PgPoolOptions options) {
  int maxSize = options.getMaxSize();
  if (maxSize < 1) {
    throw new IllegalArgumentException("Pool max size must be > 0");
  }
  this.context = vertx.getOrCreateContext();
  this.factory = new PgConnectionFactory(context, Vertx.currentContext() != null, options);
  this.pool = new ConnectionPool(factory::connect, maxSize);
  this.closeVertx = closeVertx;
}
 
開發者ID:vietj,項目名稱:reactive-pg-client,代碼行數:11,代碼來源:PgPoolImpl.java

示例2: BinlogClientImpl

import io.vertx.core.Vertx; //導入方法依賴的package包/類
public BinlogClientImpl(Vertx vertx, BinlogClientOptions options) {
  this.vertx = vertx;
  this.context = vertx.getOrCreateContext();
  this.host = options.getHost();
  this.port = options.getPort();
  this.connectTimeout = options.getConnectTimeout();
  this.sqlClient = MySQLClient.createNonShared(vertx,
    new JsonObject()
      .put("host", options.getHost())
      .put("port", options.getPort())
      .put("database", "information_schema")
      .put("maxPoolSize", 1)
      .put("username", options.getUsername())
      .put("password",
          "".equals(options.getPassword()) ?
            null : options.getPassword())
  );
  dispatcher = new EventDispatcher(vertx,
    new SchemaResolver(sqlClient));
  client = new BinaryLogClient(
    host, port,
    options.getUsername(),
    Optional.ofNullable(
      options.getPassword()
    ).orElse("")
  );
  if (options.getFilename() != null) {
    client.setBinlogFilename(options.getFilename());
  }
  if (options.getPosition() != -1) {
    client.setBinlogPosition(options.getPosition());
  }
  client.setHeartbeatInterval(options.getHeartbeatInterval());
  client.setKeepAlive(options.isKeepAlive());
  client.setKeepAliveInterval(options.getKeepAliveInterval());
  client.registerEventListener(this::handle);
}
 
開發者ID:guoyu511,項目名稱:vertx-mysql-binlog-client,代碼行數:38,代碼來源:BinlogClientImpl.java


注:本文中的io.vertx.core.Vertx.getOrCreateContext方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。