@Override
  public boolean isCallTimedOut(Operation op) {
    // Join operations should not be checked for timeout
    // because caller is not member of this cluster
    // and can have a different clock.
    if (!op.returnsResponse() || isJoinOperation(op)) {
      return false;
    }

    long callTimeout = op.getCallTimeout();
    long invocationTime = op.getInvocationTime();
    long expireTime = invocationTime + callTimeout;

    if (expireTime <= 0 || expireTime == Long.MAX_VALUE) {
      return false;
    }

    ClusterClock clusterClock = nodeEngine.getClusterService().getClusterClock();
    long now = clusterClock.getClusterTime();
    if (expireTime < now) {
      return true;
    }

    return false;
  }
 public boolean write(SocketWritable socketWritable) {
   final Packet packet = (Packet) socketWritable;
   if (nodeEngine.getNode().isActive()) {
     packet.setConn(thisConnection);
     MemberImpl member = nodeEngine.getClusterService().getMember(thisAddress);
     if (member != null) {
       member.didRead();
     }
     nodeEngine.handlePacket(packet);
     return true;
   }
   return false;
 }
 public boolean write(SocketWritable socketWritable) {
   final Packet packet = (Packet) socketWritable;
   if (nodeEngine.getNode().isActive()) {
     Packet newPacket = readFromPacket(packet);
     MemberImpl member = nodeEngine.getClusterService().getMember(localEndpoint);
     if (member != null) {
       member.didRead();
     }
     nodeEngine.getPacketTransceiver().receive(newPacket);
     return true;
   }
   return false;
 }
  public void start() {
    logger.finest("Starting OperationService");

    ManagedExecutorService asyncExecutor =
        nodeEngine
            .getExecutionService()
            .register(
                ExecutionService.ASYNC_EXECUTOR,
                Runtime.getRuntime().availableProcessors(),
                ASYNC_QUEUE_CAPACITY,
                ExecutorType.CONCRETE);

    this.invocationContext =
        new Invocation.Context(
            asyncExecutor,
            nodeEngine.getClusterService().getClusterClock(),
            nodeEngine.getClusterService(),
            node.connectionManager,
            node.nodeEngine.getExecutionService(),
            nodeEngine.getProperties().getMillis(OPERATION_CALL_TIMEOUT_MILLIS),
            invocationRegistry,
            invocationMonitor,
            nodeEngine.getLocalMember().getUuid(),
            nodeEngine.getLogger(Invocation.class),
            node,
            nodeEngine,
            nodeEngine.getPartitionService(),
            this,
            operationExecutor,
            retryCount,
            serializationService,
            nodeEngine.getThisAddress());

    invocationMonitor.start();
    operationExecutor.start();
    asyncResponseHandler.start();
    slowOperationDetector.start();
  }
Esempio n. 5
0
 @Override
 public ClusterService getClusterService() {
   return nodeEngine.getClusterService();
 }