Search in sources :

Example 1 with StrongbackException

use of com.github.nagyesta.abortmission.strongback.base.StrongbackException in project abort-mission by nagyesta.

the class RmiBackedStageStatisticsCollector method doLogTimeMeasurement.

@Override
protected void doLogTimeMeasurement(final String contextName, final MissionHealthCheckMatcher matcher, final boolean countdown, final StageTimeMeasurement measurement) {
    try {
        final LaunchStatisticsService service = RmiServiceProvider.service(registry);
        final RmiStageTimeMeasurement rmiMeasurement = new RmiStageTimeMeasurement(measurement);
        service.insertStageTimeMeasurement(contextName, matcher.getName(), countdown, rmiMeasurement);
    } catch (final RemoteException e) {
        LOGGER.error("Failed to log measurement.", e);
        throw new StrongbackException(e.getMessage(), e);
    }
}
Also used : LaunchStatisticsService(com.github.nagyesta.abortmission.strongback.rmi.service.LaunchStatisticsService) RemoteException(java.rmi.RemoteException) StrongbackException(com.github.nagyesta.abortmission.strongback.base.StrongbackException)

Example 2 with StrongbackException

use of com.github.nagyesta.abortmission.strongback.base.StrongbackException in project abort-mission by nagyesta.

the class H2ServerManager method doStop.

private void doStop() {
    try {
        sendShutdownCommand();
        Server.shutdownTcpServer(String.format(DEFAULT_TCP_URL_FORMAT, port), password, true, false);
    } catch (final Exception ex) {
        throw new StrongbackException("Server failed to stop.", ex);
    }
}
Also used : StrongbackException(com.github.nagyesta.abortmission.strongback.base.StrongbackException) SQLException(java.sql.SQLException) StrongbackException(com.github.nagyesta.abortmission.strongback.base.StrongbackException)

Example 3 with StrongbackException

use of com.github.nagyesta.abortmission.strongback.base.StrongbackException in project abort-mission by nagyesta.

the class RmiServerManager method startServer.

/**
 * Starts the server if needed.
 */
public void startServer() {
    try {
        doStart();
        Thread.currentThread().join();
    } catch (final InterruptedException ex) {
    // ignore
    } catch (final Exception ex) {
        throw new StrongbackException("Server startup failed.", ex);
    }
}
Also used : StrongbackException(com.github.nagyesta.abortmission.strongback.base.StrongbackException) StrongbackException(com.github.nagyesta.abortmission.strongback.base.StrongbackException)

Example 4 with StrongbackException

use of com.github.nagyesta.abortmission.strongback.base.StrongbackException in project abort-mission by nagyesta.

the class AbstractInMemoryDataSourceIntegrationTest method setUp.

@BeforeEach
void setUp() throws Exception {
    try {
        service = new SingletonLaunchStatisticsService();
        final Remote abortMissionService = UnicastRemoteObject.exportObject(service, port);
        if (Arrays.asList(registry.list()).contains(RmiServerConstants.SERVICE_NAME)) {
            registry.rebind(RmiServerConstants.SERVICE_NAME, abortMissionService);
        } else {
            registry.bind(RmiServerConstants.SERVICE_NAME, abortMissionService);
        }
    } catch (final Exception ex) {
        throw new StrongbackException("Server startup failed.", ex);
    }
}
Also used : Remote(java.rmi.Remote) StrongbackException(com.github.nagyesta.abortmission.strongback.base.StrongbackException) SingletonLaunchStatisticsService(com.github.nagyesta.abortmission.strongback.rmi.service.impl.SingletonLaunchStatisticsService) StrongbackException(com.github.nagyesta.abortmission.strongback.base.StrongbackException) RemoteException(java.rmi.RemoteException) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

StrongbackException (com.github.nagyesta.abortmission.strongback.base.StrongbackException)4 RemoteException (java.rmi.RemoteException)2 LaunchStatisticsService (com.github.nagyesta.abortmission.strongback.rmi.service.LaunchStatisticsService)1 SingletonLaunchStatisticsService (com.github.nagyesta.abortmission.strongback.rmi.service.impl.SingletonLaunchStatisticsService)1 Remote (java.rmi.Remote)1 SQLException (java.sql.SQLException)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1