Search in sources :

Example 1 with UncheckedExecutionException

use of io.camunda.zeebe.util.exception.UncheckedExecutionException in project zeebe by camunda.

the class Broker method internalStart.

private void internalStart() {
    try {
        brokerContext = brokerStartupActor.start().join();
        healthCheckService.setBrokerStarted();
        startFuture.complete(this);
    } catch (final Exception bootStrapException) {
        final BrokerCfg brokerCfg = getConfig();
        LOG.error("Failed to start broker {}!", brokerCfg.getCluster().getNodeId(), bootStrapException);
        final UncheckedExecutionException exception = new UncheckedExecutionException("Failed to start broker", bootStrapException);
        startFuture.completeExceptionally(exception);
        throw exception;
    }
}
Also used : BrokerCfg(io.camunda.zeebe.broker.system.configuration.BrokerCfg) UncheckedExecutionException(io.camunda.zeebe.util.exception.UncheckedExecutionException) UncheckedExecutionException(io.camunda.zeebe.util.exception.UncheckedExecutionException) ExporterLoadException(io.camunda.zeebe.broker.exporter.repo.ExporterLoadException) ExternalJarLoadException(io.camunda.zeebe.util.jar.ExternalJarLoadException)

Example 2 with UncheckedExecutionException

use of io.camunda.zeebe.util.exception.UncheckedExecutionException in project zeebe by camunda.

the class BrokerClientImpl method close.

@Override
public void close() {
    if (isClosed) {
        return;
    }
    isClosed = true;
    LOG.debug("Closing gateway broker client ...");
    doAndLogException(topologyManager::close);
    LOG.debug("topology manager closed");
    if (jobAvailableSubscription != null) {
        jobAvailableSubscription.close();
    }
    if (ownsActorScheduler) {
        try {
            actorScheduler.stop().get(15, TimeUnit.SECONDS);
        } catch (final InterruptedException ie) {
            Thread.currentThread().interrupt();
            throw new UncheckedExecutionException(ERROR_MSG_STOP_FAILED, ie);
        } catch (final ExecutionException | TimeoutException e) {
            throw new UncheckedExecutionException(ERROR_MSG_STOP_FAILED, e);
        }
    }
    LOG.debug("Gateway broker client closed.");
}
Also used : UncheckedExecutionException(io.camunda.zeebe.util.exception.UncheckedExecutionException) UncheckedExecutionException(io.camunda.zeebe.util.exception.UncheckedExecutionException) ExecutionException(java.util.concurrent.ExecutionException) TimeoutException(java.util.concurrent.TimeoutException)

Example 3 with UncheckedExecutionException

use of io.camunda.zeebe.util.exception.UncheckedExecutionException in project zeebe by camunda.

the class ClusteringRule method before.

@Override
protected void before() throws IOException {
    partitionLatch = new CountDownLatch(partitionCount);
    // create brokers
    for (int nodeId = 0; nodeId < clusterSize; nodeId++) {
        getBroker(nodeId);
    }
    final var contactPoints = brokerCfgs.values().stream().map(BrokerCfg::getNetwork).map(NetworkCfg::getInternalApi).map(SocketBindingCfg::getAddress).map(NetUtil::toSocketAddressString).toArray(String[]::new);
    for (int nodeId = 0; nodeId < clusterSize; nodeId++) {
        final var brokerCfg = getBrokerCfg(nodeId);
        setInitialContactPoints(contactPoints).accept(brokerCfg);
    }
    // create gateway
    gateway = createGateway();
    gateway.start();
    // create client
    client = createClient();
    try {
        waitUntilBrokersStarted();
        waitForPartitionReplicationFactor();
        LOG.info("Full replication factor");
        waitUntilBrokersInTopology();
        LOG.info("All brokers in topology {}", getTopologyFromClient());
    } catch (final Exception e) {
        // If the previous waits timeouts, the brokers are not closed automatically.
        after();
        throw new UncheckedExecutionException("Cluster start failed", e);
    }
}
Also used : BrokerCfg(io.camunda.zeebe.broker.system.configuration.BrokerCfg) UncheckedExecutionException(io.camunda.zeebe.util.exception.UncheckedExecutionException) SocketBindingCfg(io.camunda.zeebe.broker.system.configuration.SocketBindingCfg) CountDownLatch(java.util.concurrent.CountDownLatch) TimeoutException(java.util.concurrent.TimeoutException) UncheckedExecutionException(io.camunda.zeebe.util.exception.UncheckedExecutionException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException)

Example 4 with UncheckedExecutionException

use of io.camunda.zeebe.util.exception.UncheckedExecutionException in project zeebe by zeebe-io.

the class Broker method internalStart.

private void internalStart() {
    try {
        brokerContext = brokerStartupActor.start().join();
        healthCheckService.setBrokerStarted();
        startFuture.complete(this);
    } catch (final Exception bootStrapException) {
        final BrokerCfg brokerCfg = getConfig();
        LOG.error("Failed to start broker {}!", brokerCfg.getCluster().getNodeId(), bootStrapException);
        final UncheckedExecutionException exception = new UncheckedExecutionException("Failed to start broker", bootStrapException);
        startFuture.completeExceptionally(exception);
        throw exception;
    }
}
Also used : BrokerCfg(io.camunda.zeebe.broker.system.configuration.BrokerCfg) UncheckedExecutionException(io.camunda.zeebe.util.exception.UncheckedExecutionException) UncheckedExecutionException(io.camunda.zeebe.util.exception.UncheckedExecutionException) ExporterLoadException(io.camunda.zeebe.broker.exporter.repo.ExporterLoadException) ExternalJarLoadException(io.camunda.zeebe.util.jar.ExternalJarLoadException)

Example 5 with UncheckedExecutionException

use of io.camunda.zeebe.util.exception.UncheckedExecutionException in project zeebe by camunda-cloud.

the class ClusteringRule method before.

@Override
protected void before() throws IOException {
    partitionLatch = new CountDownLatch(partitionCount);
    // create brokers
    for (int nodeId = 0; nodeId < clusterSize; nodeId++) {
        getBroker(nodeId);
    }
    final var contactPoints = brokerCfgs.values().stream().map(BrokerCfg::getNetwork).map(NetworkCfg::getInternalApi).map(SocketBindingCfg::getAddress).map(NetUtil::toSocketAddressString).toArray(String[]::new);
    for (int nodeId = 0; nodeId < clusterSize; nodeId++) {
        final var brokerCfg = getBrokerCfg(nodeId);
        setInitialContactPoints(contactPoints).accept(brokerCfg);
    }
    // create gateway
    gateway = createGateway();
    gateway.start().join();
    // create client
    client = createClient();
    try {
        waitUntilBrokersStarted();
        waitForPartitionReplicationFactor();
        LOG.info("Full replication factor");
        waitUntilBrokersInTopology();
        LOG.info("All brokers in topology {}", getTopologyFromClient());
    } catch (final Exception e) {
        // If the previous waits timeouts, the brokers are not closed automatically.
        after();
        throw new UncheckedExecutionException("Cluster start failed", e);
    }
}
Also used : BrokerCfg(io.camunda.zeebe.broker.system.configuration.BrokerCfg) UncheckedExecutionException(io.camunda.zeebe.util.exception.UncheckedExecutionException) SocketBindingCfg(io.camunda.zeebe.broker.system.configuration.SocketBindingCfg) CountDownLatch(java.util.concurrent.CountDownLatch) TimeoutException(java.util.concurrent.TimeoutException) UncheckedExecutionException(io.camunda.zeebe.util.exception.UncheckedExecutionException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

UncheckedExecutionException (io.camunda.zeebe.util.exception.UncheckedExecutionException)9 BrokerCfg (io.camunda.zeebe.broker.system.configuration.BrokerCfg)6 ExecutionException (java.util.concurrent.ExecutionException)6 TimeoutException (java.util.concurrent.TimeoutException)6 ExporterLoadException (io.camunda.zeebe.broker.exporter.repo.ExporterLoadException)3 SocketBindingCfg (io.camunda.zeebe.broker.system.configuration.SocketBindingCfg)3 ExternalJarLoadException (io.camunda.zeebe.util.jar.ExternalJarLoadException)3 IOException (java.io.IOException)3 UncheckedIOException (java.io.UncheckedIOException)3 CountDownLatch (java.util.concurrent.CountDownLatch)3