コード例 #1
0
  /**
   * @param cctx Context.
   * @param id Partition ID.
   */
  @SuppressWarnings("ExternalizableWithoutPublicNoArgConstructor")
  GridDhtLocalPartition(GridCacheContext cctx, int id) {
    assert cctx != null;

    this.id = id;
    this.cctx = cctx;

    log = U.logger(cctx.kernalContext(), logRef, this);

    rent =
        new GridFutureAdapter<Object>() {
          @Override
          public String toString() {
            return "PartitionRentFuture [part=" + GridDhtLocalPartition.this + ", map=" + map + ']';
          }
        };

    map = new ConcurrentHashMap8<>(cctx.config().getStartSize() / cctx.affinity().partitions());

    int delQueueSize =
        CU.isSystemCache(cctx.name())
            ? 100
            : Math.max(MAX_DELETE_QUEUE_SIZE / cctx.affinity().partitions(), 20);

    rmvQueue = new GridCircularBuffer<>(U.ceilPow2(delQueueSize));
  }
コード例 #2
0
  private void scheduleRecheck() {
    if (!isDone()) {
      GridTimeoutObject old = timeoutObj;

      if (old != null) cctx.kernalContext().timeout().removeTimeoutObject(old);

      GridTimeoutObject timeoutObj =
          new GridTimeoutObjectAdapter(
              cctx.gridConfig().getNetworkTimeout()
                  * Math.max(1, cctx.gridConfig().getCacheConfiguration().length)) {
            @Override
            public void onTimeout() {
              cctx.kernalContext()
                  .closure()
                  .runLocalSafe(
                      new Runnable() {
                        @Override
                        public void run() {
                          if (isDone()) return;

                          if (!enterBusy()) return;

                          try {
                            U.warn(
                                log,
                                "Retrying preload partition exchange due to timeout [done="
                                    + isDone()
                                    + ", dummy="
                                    + dummy
                                    + ", exchId="
                                    + exchId
                                    + ", rcvdIds="
                                    + F.id8s(rcvdIds)
                                    + ", rmtIds="
                                    + F.id8s(rmtIds)
                                    + ", remaining="
                                    + F.id8s(remaining())
                                    + ", init="
                                    + init
                                    + ", initFut="
                                    + initFut.isDone()
                                    + ", ready="
                                    + ready
                                    + ", replied="
                                    + replied
                                    + ", added="
                                    + added
                                    + ", oldest="
                                    + U.id8(oldestNode.get().id())
                                    + ", oldestOrder="
                                    + oldestNode.get().order()
                                    + ", evtLatch="
                                    + evtLatch.getCount()
                                    + ", locNodeOrder="
                                    + cctx.localNode().order()
                                    + ", locNodeId="
                                    + cctx.localNode().id()
                                    + ']',
                                "Retrying preload partition exchange due to timeout.");

                            recheck();
                          } finally {
                            leaveBusy();
                          }
                        }
                      });
            }
          };

      this.timeoutObj = timeoutObj;

      cctx.kernalContext().timeout().addTimeoutObject(timeoutObj);
    }
  }