Search in sources :

Example 1 with ConnectionTimeoutException

use of kieker.monitoring.writer.tcp.ConnectionTimeoutException in project iobserve-analysis by research-iobserve.

the class TcpProbeController method createNewTcpWriter.

private SingleSocketTcpWriter createNewTcpWriter(final String hostname, final int port) throws RemoteControlFailedException {
    final Configuration configuration = new Configuration();
    configuration.setProperty(SingleSocketTcpWriter.CONFIG_HOSTNAME, hostname);
    configuration.setProperty(SingleSocketTcpWriter.CONFIG_PORT, port);
    configuration.setProperty(SingleSocketTcpWriter.CONFIG_CONN_TIMEOUT_IN_MS, TcpProbeController.CONN_TIMEOUT_IN_MS);
    configuration.setProperty(SingleSocketTcpWriter.CONFIG_FLUSH, true);
    configuration.setProperty(SingleSocketTcpWriter.CONFIG_BUFFERSIZE, 65535);
    final SingleSocketTcpWriter tcpWriter;
    try {
        tcpWriter = new SingleSocketTcpWriter(configuration);
        tcpWriter.onStarting();
    } catch (final IOException | ConnectionTimeoutException e) {
        // runtime exception is thrown after timeout
        if (TcpProbeController.LOGGER.isDebugEnabled()) {
            TcpProbeController.LOGGER.debug("Could not create TCP connections to " + hostname + " on port " + port, e);
        }
        throw new RemoteControlFailedException("Could not create TCP connections to " + hostname + " on port " + port + ", writer was not created ");
    }
    return tcpWriter;
}
Also used : ConnectionTimeoutException(kieker.monitoring.writer.tcp.ConnectionTimeoutException) Configuration(kieker.common.configuration.Configuration) SingleSocketTcpWriter(kieker.monitoring.writer.tcp.SingleSocketTcpWriter) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 Configuration (kieker.common.configuration.Configuration)1 ConnectionTimeoutException (kieker.monitoring.writer.tcp.ConnectionTimeoutException)1 SingleSocketTcpWriter (kieker.monitoring.writer.tcp.SingleSocketTcpWriter)1