Search in sources :

Example 1 with JetService

use of com.hazelcast.jet.impl.JetService in project hazelcast-jet by hazelcast.

the class AsyncMapWriterTest method when_tooManyConcurrentOps_then_refuseFlush.

@Test
public void when_tooManyConcurrentOps_then_refuseFlush() throws Exception {
    // Given
    writer.put("key1", "value1");
    writer.put("key2", "value2");
    writer.put("key3", "value3");
    writer.put("key4", "value4");
    CompletableFuture<Void> future = new CompletableFuture<>();
    JetService service = nodeEngine.getService(JetService.SERVICE_NAME);
    service.numConcurrentPutAllOps().set(MAX_PARALLEL_ASYNC_OPS - NODE_COUNT + 1);
    // When
    boolean flushed = writer.tryFlushAsync(future);
    // Then
    assertFalse("tryFlushAsync should fail", flushed);
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) JetService(com.hazelcast.jet.impl.JetService) Test(org.junit.Test)

Example 2 with JetService

use of com.hazelcast.jet.impl.JetService in project hazelcast-jet by hazelcast.

the class ExecutionPlan method initProcSuppliers.

// End implementation of IdentifiedDataSerializable
private void initProcSuppliers() {
    JetService service = nodeEngine.getService(JetService.SERVICE_NAME);
    for (VertexDef vertex : vertices) {
        ProcessorSupplier supplier = vertex.processorSupplier();
        ILogger logger = nodeEngine.getLogger(supplier.getClass().getName() + '.' + vertex.name() + "#ProcessorSupplier");
        supplier.init(new ProcSupplierCtx(service.getJetInstance(), logger, vertex.name(), vertex.localParallelism(), vertex.totalParallelism()));
    }
}
Also used : ProcSupplierCtx(com.hazelcast.jet.impl.execution.init.Contexts.ProcSupplierCtx) JetService(com.hazelcast.jet.impl.JetService) ILogger(com.hazelcast.logging.ILogger) ProcessorSupplier(com.hazelcast.jet.core.ProcessorSupplier)

Example 3 with JetService

use of com.hazelcast.jet.impl.JetService in project hazelcast-jet by hazelcast.

the class AsyncOperation method doSendResponse.

public final void doSendResponse(Object value) {
    try {
        sendResponse(value);
    } finally {
        final JetService service = getService();
        service.getLiveOperationRegistry().deregister(this);
    }
}
Also used : JetService(com.hazelcast.jet.impl.JetService)

Example 4 with JetService

use of com.hazelcast.jet.impl.JetService in project hazelcast-jet by hazelcast.

the class CompleteExecutionOperation method run.

@Override
public void run() throws Exception {
    ILogger logger = getLogger();
    JetService service = getService();
    Address callerAddress = getCallerAddress();
    logger.fine("Completing execution " + idToString(executionId) + " from caller: " + callerAddress + " with " + error);
    Address masterAddress = getNodeEngine().getMasterAddress();
    if (!callerAddress.equals(masterAddress)) {
        throw new IllegalStateException("Caller " + callerAddress + " cannot complete execution of " + idToString(executionId) + " because it is not master. Master is: " + masterAddress);
    }
    service.getJobExecutionService().completeExecution(executionId, error);
}
Also used : JetService(com.hazelcast.jet.impl.JetService) Address(com.hazelcast.nio.Address) ILogger(com.hazelcast.logging.ILogger)

Example 5 with JetService

use of com.hazelcast.jet.impl.JetService in project hazelcast-jet by hazelcast.

the class GetJobConfigOperation method run.

@Override
public void run() throws Exception {
    JetService service = getService();
    response = service.getJobCoordinationService().getJobConfig(jobId());
}
Also used : JetService(com.hazelcast.jet.impl.JetService)

Aggregations

JetService (com.hazelcast.jet.impl.JetService)28 Test (org.junit.Test)9 MockPS (com.hazelcast.jet.core.TestProcessors.MockPS)6 JetInstance (com.hazelcast.jet.JetInstance)5 Job (com.hazelcast.jet.Job)5 JobConfig (com.hazelcast.jet.config.JobConfig)5 StuckProcessor (com.hazelcast.jet.core.TestProcessors.StuckProcessor)5 JobCoordinationService (com.hazelcast.jet.impl.JobCoordinationService)5 JetConfig (com.hazelcast.jet.config.JetConfig)4 STARTING (com.hazelcast.jet.core.JobStatus.STARTING)4 JobRepository (com.hazelcast.jet.impl.JobRepository)4 MasterContext (com.hazelcast.jet.impl.MasterContext)4 Address (com.hazelcast.nio.Address)4 CompletableFuture (java.util.concurrent.CompletableFuture)4 CountDownLatch (java.util.concurrent.CountDownLatch)4 Future (java.util.concurrent.Future)4 Assert.assertEquals (org.junit.Assert.assertEquals)4 Assert.assertNotNull (org.junit.Assert.assertNotNull)4 Assert.assertTrue (org.junit.Assert.assertTrue)4 Assert.fail (org.junit.Assert.fail)4