Exemplo n.º 1
0
 private Data getBackupOperationData(BackupAwareOperation backupAwareOp) {
   Operation backupOp = backupAwareOp.getBackupOperation();
   if (backupOp == null) {
     throw new IllegalArgumentException("Backup operation should not be null! " + backupAwareOp);
   }
   Operation op = (Operation) backupAwareOp;
   // set service name of backup operation.
   // if getServiceName() method is overridden to return the same name
   // then this will have no effect.
   backupOp.setServiceName(op.getServiceName());
   return nodeEngine.getSerializationService().toData(backupOp);
 }
Exemplo n.º 2
0
 @Override
 public boolean open(NodeEngine nodeEngine) {
   NodeEngineImpl nei = (NodeEngineImpl) nodeEngine;
   InternalPartitionService ps = nei.getPartitionService();
   MapService mapService = nei.getService(MapService.SERVICE_NAME);
   ss = nei.getSerializationService();
   Address partitionOwner = ps.getPartitionOwner(partitionId);
   if (partitionOwner == null) {
     return false;
   }
   RecordStore recordStore =
       mapService.getMapServiceContext().getRecordStore(partitionId, mapName);
   iterator = recordStore.entrySetData().iterator();
   return true;
 }
  public OperationServiceImpl(NodeEngineImpl nodeEngine) {
    this.nodeEngine = nodeEngine;
    this.node = nodeEngine.getNode();
    this.thisAddress = node.getThisAddress();
    this.logger = node.getLogger(OperationService.class);
    this.serializationService = (InternalSerializationService) nodeEngine.getSerializationService();

    this.backpressureRegulator =
        new BackpressureRegulator(
            node.getProperties(), node.getLogger(BackpressureRegulator.class));

    int coreSize = Runtime.getRuntime().availableProcessors();
    boolean reallyMultiCore = coreSize >= CORE_SIZE_CHECK;
    int concurrencyLevel = reallyMultiCore ? coreSize * CORE_SIZE_FACTOR : CONCURRENCY_LEVEL;

    this.invocationRegistry =
        new InvocationRegistry(
            node.getLogger(OperationServiceImpl.class),
            backpressureRegulator.newCallIdSequence(),
            concurrencyLevel);

    this.invocationMonitor =
        new InvocationMonitor(
            nodeEngine,
            thisAddress,
            node.getHazelcastThreadGroup(),
            node.getProperties(),
            invocationRegistry,
            node.getLogger(InvocationMonitor.class),
            serializationService,
            nodeEngine.getServiceManager());

    this.operationBackupHandler = new OperationBackupHandler(this);

    this.responseHandler =
        new ResponseHandler(
            node.getLogger(ResponseHandler.class),
            node.getSerializationService(),
            invocationRegistry,
            nodeEngine);
    this.asyncResponseHandler =
        new AsyncResponseHandler(
            node.getHazelcastThreadGroup(),
            node.getLogger(AsyncResponseHandler.class),
            responseHandler,
            node.getProperties());

    this.operationExecutor =
        new OperationExecutorImpl(
            node.getProperties(),
            node.loggingService,
            thisAddress,
            new OperationRunnerFactoryImpl(this),
            node.getHazelcastThreadGroup(),
            node.getNodeExtension());

    this.slowOperationDetector =
        new SlowOperationDetector(
            node.loggingService,
            operationExecutor.getGenericOperationRunners(),
            operationExecutor.getPartitionOperationRunners(),
            node.getProperties(),
            node.getHazelcastThreadGroup());
  }