Search in sources :

Example 11 with AeronException

use of io.aeron.exceptions.AeronException in project aeron by real-logic.

the class UdpChannelTransport method updateEndpoint.

/**
 * Endpoint has moved to a new address. Handle this.
 *
 * @param newAddress      to send data to.
 * @param statusIndicator for the channel
 */
public void updateEndpoint(final InetSocketAddress newAddress, final AtomicCounter statusIndicator) {
    try {
        if (null != sendDatagramChannel) {
            sendDatagramChannel.disconnect();
            sendDatagramChannel.connect(newAddress);
            connectAddress = newAddress;
            if (null != statusIndicator) {
                statusIndicator.setOrdered(ChannelEndpointStatus.ACTIVE);
            }
        }
    } catch (final Exception ex) {
        if (null != statusIndicator) {
            statusIndicator.setOrdered(ChannelEndpointStatus.ERRORED);
        }
        final String message = "re-resolve endpoint channel error - " + ex.getMessage() + " (at " + ex.getStackTrace()[0].toString() + "): " + udpChannel.originalUriString();
        throw new AeronException(message, ex);
    }
}
Also used : AeronException(io.aeron.exceptions.AeronException) IOException(java.io.IOException) AeronException(io.aeron.exceptions.AeronException) PortUnreachableException(java.net.PortUnreachableException)

Example 12 with AeronException

use of io.aeron.exceptions.AeronException in project aeron by real-logic.

the class FileStoreLogFactory method checkStorage.

private void checkStorage(final long logLength) {
    if (checkStorage) {
        final long usableSpace = getUsableSpace();
        if (usableSpace < logLength) {
            throw new AeronException("insufficient usable storage for new log of length=" + logLength + " in " + fileStore);
        }
        if (usableSpace <= lowStorageWarningThreshold) {
            final String msg = "space is running low: threshold=" + lowStorageWarningThreshold + " usable=" + usableSpace + " in " + fileStore;
            errorHandler.onError(new AeronException(msg, AeronException.Category.WARN));
        }
    }
}
Also used : AeronException(io.aeron.exceptions.AeronException)

Aggregations

AeronException (io.aeron.exceptions.AeronException)12 IOException (java.io.IOException)6 DriverProxy (io.aeron.DriverProxy)2 DriverTimeoutException (io.aeron.exceptions.DriverTimeoutException)2 File (java.io.File)2 InetSocketAddress (java.net.InetSocketAddress)2 PortUnreachableException (java.net.PortUnreachableException)2 MappedByteBuffer (java.nio.MappedByteBuffer)2 FileChannel (java.nio.channels.FileChannel)2 NoSuchFileException (java.nio.file.NoSuchFileException)2 DirectBuffer (org.agrona.DirectBuffer)2 ManyToOneRingBuffer (org.agrona.concurrent.ringbuffer.ManyToOneRingBuffer)2 Test (org.junit.jupiter.api.Test)2 InOrder (org.mockito.InOrder)2