コード例 #1
0
  /** {@inheritDoc} */
  @Override
  public void start() throws GridException {
    super.start();

    ctx.io()
        .addHandler(
            GridNearGetResponse.class,
            new CI2<UUID, GridNearGetResponse<K, V>>() {
              @Override
              public void apply(UUID nodeId, GridNearGetResponse<K, V> res) {
                processGetResponse(nodeId, res);
              }
            });

    ctx.io()
        .addHandler(
            GridNearTxPrepareResponse.class,
            new CI2<UUID, GridNearTxPrepareResponse<K, V>>() {
              @Override
              public void apply(UUID nodeId, GridNearTxPrepareResponse<K, V> res) {
                processPrepareResponse(nodeId, res);
              }
            });

    ctx.io()
        .addHandler(
            GridNearTxFinishResponse.class,
            new CI2<UUID, GridNearTxFinishResponse<K, V>>() {
              @Override
              public void apply(UUID nodeId, GridNearTxFinishResponse<K, V> res) {
                processFinishResponse(nodeId, res);
              }
            });

    ctx.io()
        .addHandler(
            GridNearLockResponse.class,
            new CI2<UUID, GridNearLockResponse<K, V>>() {
              @Override
              public void apply(UUID nodeId, GridNearLockResponse<K, V> res) {
                processLockResponse(nodeId, res);
              }
            });
  }
コード例 #2
0
  /** {@inheritDoc} */
  @Override
  public void start() throws GridException {
    super.start();

    GridCacheIoManager<K, V> io = ctx.io();

    io.addHandler(
        GridDistributedLockRequest.class,
        new CI2<UUID, GridDistributedLockRequest<K, V>>() {
          @Override
          public void apply(UUID nodeId, GridDistributedLockRequest<K, V> req) {
            processLockRequest(nodeId, req);
          }
        });

    io.addHandler(
        GridDistributedLockResponse.class,
        new CI2<UUID, GridDistributedLockResponse<K, V>>() {
          @Override
          public void apply(UUID nodeId, GridDistributedLockResponse<K, V> res) {
            processLockResponse(nodeId, res);
          }
        });

    io.addHandler(
        GridDistributedTxFinishRequest.class,
        new CI2<UUID, GridDistributedTxFinishRequest<K, V>>() {
          @Override
          public void apply(UUID nodeId, GridDistributedTxFinishRequest<K, V> req) {
            processFinishRequest(nodeId, req);
          }
        });

    io.addHandler(
        GridDistributedTxFinishResponse.class,
        new CI2<UUID, GridDistributedTxFinishResponse<K, V>>() {
          @Override
          public void apply(UUID nodeId, GridDistributedTxFinishResponse<K, V> res) {
            processFinishResponse(nodeId, res);
          }
        });

    io.addHandler(
        GridDistributedTxPrepareRequest.class,
        new CI2<UUID, GridDistributedTxPrepareRequest<K, V>>() {
          @Override
          public void apply(UUID nodeId, GridDistributedTxPrepareRequest<K, V> req) {
            processPrepareRequest(nodeId, req);
          }
        });

    io.addHandler(
        GridDistributedTxPrepareResponse.class,
        new CI2<UUID, GridDistributedTxPrepareResponse<K, V>>() {
          @Override
          public void apply(UUID nodeId, GridDistributedTxPrepareResponse<K, V> res) {
            processPrepareResponse(nodeId, res);
          }
        });

    io.addHandler(
        GridDistributedUnlockRequest.class,
        new CI2<UUID, GridDistributedUnlockRequest<K, V>>() {
          @Override
          public void apply(UUID nodeId, GridDistributedUnlockRequest<K, V> req) {
            processUnlockRequest(nodeId, req);
          }
        });

    preldr = new GridReplicatedPreloader<K, V>(ctx);

    preldr.start();
  }