Java 类io.vertx.core.impl.ContextInternal 实例源码

项目:vertx-zero    文件:FakeClusterManager.java   
@Override
public void add(final K k, final V v, final Handler<AsyncResult<Void>> completionHandler) {
    final ContextInternal ctx = FakeClusterManager.this.vertx.getOrCreateContext();
    ctx.executeBlocking(fut -> {
        ChoosableSet<V> vals = this.map.get(k);
        if (vals == null) {
            vals = new ChoosableSet<>(1);
            final ChoosableSet<V> prevVals = this.map.putIfAbsent(k, vals);
            if (prevVals != null) {
                vals = prevVals;
            }
        }
        vals.add(v);
        fut.complete();
    }, this.taskQueue, completionHandler);
}
项目:vertx-zero    文件:FakeClusterManager.java   
@Override
public void remove(final K k, final V v, final Handler<AsyncResult<Boolean>> completionHandler) {
    final ContextInternal ctx = FakeClusterManager.this.vertx.getOrCreateContext();
    ctx.executeBlocking(fut -> {
        final ChoosableSet<V> vals = this.map.get(k);
        boolean found = false;
        if (vals != null) {
            final boolean removed = vals.remove(v);
            if (removed) {
                if (vals.isEmpty()) {
                    this.map.remove(k);
                }
                found = true;
            }
        }
        fut.complete(found);
    }, this.taskQueue, completionHandler);
}
项目:vertx-zero    文件:FakeClusterManager.java   
@Override
public void removeAllMatching(final Predicate<V> p, final Handler<AsyncResult<Void>> completionHandler) {
    final ContextInternal ctx = FakeClusterManager.this.vertx.getOrCreateContext();
    ctx.executeBlocking(fut -> {
        final Iterator<Entry<K, ChoosableSet<V>>> mapIter = this.map.entrySet().iterator();
        while (mapIter.hasNext()) {
            final Entry<K, ChoosableSet<V>> entry = mapIter.next();
            final ChoosableSet<V> vals = entry.getValue();
            final Iterator<V> iter = vals.iterator();
            while (iter.hasNext()) {
                final V val = iter.next();
                if (p.test(val)) {
                    iter.remove();
                }
            }
            if (vals.isEmpty()) {
                mapIter.remove();
            }
        }
        fut.complete();
    }, this.taskQueue, completionHandler);
}
项目:vertx-jdbc-client    文件:JDBCSQLRowStream.java   
JDBCSQLRowStream(ContextInternal ctx, TaskQueue statementsQueue, Statement st, ResultSet rs, int fetchSize) throws SQLException {
  this.ctx = ctx;
  this.st = st;
  this.fetchSize = fetchSize;
  this.rs = rs;
  this.statementsQueue = statementsQueue;

  accumulator = new ArrayDeque<>(fetchSize);
  metaData = rs.getMetaData();
  cols = metaData.getColumnCount();
  paused.set(true);
  stClosed.set(false);
  rsClosed.set(false);
  // the first rs is populated in the constructor
  more.set(true);
}
项目:vertx-zero    文件:FakeClusterManager.java   
@Override
public void get(final K k, final Handler<AsyncResult<ChoosableIterable<V>>> asyncResultHandler) {
    final ContextInternal ctx = FakeClusterManager.this.vertx.getOrCreateContext();
    ctx.executeBlocking(fut -> {
        ChoosableIterable<V> it = this.map.get(k);
        if (it == null) {
            it = new ChoosableSet<>(0);
        }
        fut.complete(it);
    }, this.taskQueue, asyncResultHandler);
}
项目:vertx-jdbc-client    文件:JDBCBatch.java   
private JDBCBatch(Vertx vertx, JDBCStatementHelper helper, SQLOptions options, ContextInternal ctx, Type type, List<String> sql, List<JsonArray> in, List<JsonArray> out) {
  super(vertx, helper, options, ctx);
  this.type = type;
  this.sql = sql;
  this.in = in;
  this.out = out;
}
项目:vertx-jdbc-client    文件:JDBCConnectionImpl.java   
public JDBCConnectionImpl(Context context, JDBCStatementHelper helper, Connection conn, PoolMetrics metrics, Object metric) {
  this.vertx = context.owner();
  this.helper = helper;
  this.conn = conn;
  this.metrics = metrics;
  this.metric = metric;
  this.ctx = (ContextInternal) context;
}
项目:vertx-shell    文件:VertxIoHandlerBridge.java   
public VertxIoHandlerBridge(ContextInternal context) {
  this.context = context;
}
项目:vertx-shell    文件:VertxSshTtyTest.java   
@Before
public void before() {
  super.before();
  vertx = Vertx.vertx();
  context = (ContextInternal) vertx.getOrCreateContext();
}
项目:vertx-amqp-bridge    文件:AmqpBridgeImpl.java   
boolean onContextEventLoop() {
  return ((ContextInternal) bridgeContext).nettyEventLoop().inEventLoop();
}
项目:vertx-jdbc-client    文件:JDBCClientImpl.java   
@Override
public JDBCClient update(String sql, Handler<AsyncResult<UpdateResult>> resultHandler) {
  ContextInternal ctx = (ContextInternal) vertx.getOrCreateContext();
  executeDirect(ctx, new JDBCUpdate(vertx, helper, null, ctx, sql, null), resultHandler);
  return this;
}
项目:vertx-jdbc-client    文件:JDBCClientImpl.java   
@Override
public JDBCClient updateWithParams(String sql, JsonArray in, Handler<AsyncResult<UpdateResult>> resultHandler) {
  ContextInternal ctx = (ContextInternal) vertx.getOrCreateContext();
  executeDirect(ctx, new JDBCUpdate(vertx, helper, null, ctx, sql, in), resultHandler);
  return this;
}
项目:vertx-jdbc-client    文件:JDBCClientImpl.java   
@Override
public JDBCClient query(String sql, Handler<AsyncResult<ResultSet>> resultHandler) {
  ContextInternal ctx = (ContextInternal) vertx.getOrCreateContext();
  executeDirect(ctx, new JDBCQuery(vertx, helper, null, ctx, sql, null), resultHandler);
  return this;
}
项目:vertx-jdbc-client    文件:JDBCClientImpl.java   
@Override
public JDBCClient queryWithParams(String sql, JsonArray in, Handler<AsyncResult<ResultSet>> resultHandler) {
  ContextInternal ctx = (ContextInternal) vertx.getOrCreateContext();
  executeDirect(ctx, new JDBCQuery(vertx, helper, null, ctx, sql, in), resultHandler);
  return this;
}
项目:vertx-jdbc-client    文件:JDBCExecute.java   
public JDBCExecute(Vertx vertx, SQLOptions options, ContextInternal ctx, String sql) {
  super(vertx, options, ctx);
  this.sql = sql;
}
项目:vertx-jdbc-client    文件:StreamQuery.java   
public StreamQuery(Vertx vertx, JDBCStatementHelper helper, SQLOptions options, ContextInternal ctx, TaskQueue statementsQueue, String sql, JsonArray in) {
  super(vertx, helper, options, ctx);
  this.sql = sql;
  this.in = in;
  this.statementsQueue = statementsQueue;
}
项目:vertx-jdbc-client    文件:JDBCUpdate.java   
public JDBCUpdate(Vertx vertx, JDBCStatementHelper helper, SQLOptions options, ContextInternal ctx, String sql, JsonArray in) {
  super(vertx, helper, options, ctx);
  this.sql = sql;
  this.in = in;
}
项目:vertx-jdbc-client    文件:JDBCCallable.java   
public JDBCCallable(Vertx vertx, JDBCStatementHelper helper, SQLOptions options, ContextInternal ctx, String sql, JsonArray in, JsonArray out) {
  super(vertx, helper, options, ctx);
  this.sql = sql;
  this.in = in;
  this.out = out;
}
项目:vertx-jdbc-client    文件:JDBCBatch.java   
public JDBCBatch(Vertx vertx, JDBCStatementHelper helper, SQLOptions options, ContextInternal ctx, List<String> sql) {
  this(vertx, helper, options, ctx, Type.STATEMENT, sql, null, null);
}
项目:vertx-jdbc-client    文件:JDBCBatch.java   
public JDBCBatch(Vertx vertx, JDBCStatementHelper helper, SQLOptions options, ContextInternal ctx, String sql, List<JsonArray> in) {
  this(vertx, helper, options, ctx, Type.PREPARED, Collections.singletonList(sql), in, null);
}
项目:vertx-jdbc-client    文件:JDBCBatch.java   
public JDBCBatch(Vertx vertx, JDBCStatementHelper helper, SQLOptions options, ContextInternal ctx, String sql, List<JsonArray> in, List<JsonArray> out) {
  this(vertx, helper, options, ctx, Type.CALLABLE, Collections.singletonList(sql), in, out);
}
项目:vertx-jdbc-client    文件:JDBCQuery.java   
public JDBCQuery(Vertx vertx, JDBCStatementHelper helper, SQLOptions options, ContextInternal ctx, String sql, JsonArray in) {
  super(vertx, helper, options, ctx);
  this.sql = sql;
  this.in = in;
}
项目:vertx-jdbc-client    文件:JDBCClose.java   
public JDBCClose(Vertx vertx, SQLOptions options, ContextInternal ctx) {
  super(vertx, options, ctx);
}
项目:vertx-jdbc-client    文件:JDBCAutoCommit.java   
public JDBCAutoCommit(Vertx vertx, SQLOptions options, ContextInternal ctx, boolean autoCommit) {
  super(vertx, options, ctx);
  this.autoCommit = autoCommit;
}
项目:vertx-jdbc-client    文件:JDBCCommit.java   
public JDBCCommit(Vertx vertx, SQLOptions options, ContextInternal ctx) {
  super(vertx, options, ctx);
}
项目:vertx-jdbc-client    文件:AbstractJDBCAction.java   
protected AbstractJDBCAction(Vertx vertx, SQLOptions options, ContextInternal ctx) {
  this(vertx, null, options, ctx);
}
项目:vertx-jdbc-client    文件:AbstractJDBCAction.java   
protected AbstractJDBCAction(Vertx vertx, JDBCStatementHelper helper, SQLOptions options, ContextInternal ctx) {
  this.vertx = vertx;
  this.options = options;
  this.ctx = ctx;
  this.helper = helper;
}
项目:vertx-jdbc-client    文件:JDBCRollback.java   
public JDBCRollback(Vertx vertx, SQLOptions options, ContextInternal ctx) {
  super(vertx, options, ctx);
}