Example usage for com.rabbitmq.client MissedHeartbeatException MissedHeartbeatException

List of usage examples for com.rabbitmq.client MissedHeartbeatException MissedHeartbeatException

Introduction

In this page you can find the example usage for com.rabbitmq.client MissedHeartbeatException MissedHeartbeatException.

Prototype

public MissedHeartbeatException(String reason) 

Source Link

Usage

From source file:de.htwk_leipzig.bis.connection.handshake.clientRewrite.Copyright.java

License:Mozilla Public License

/**
 * Called when a frame-read operation times out
 * /*from   ww w.  j a  v  a  2  s  .  c  om*/
 * @throws MissedHeartbeatException
 *             if heart-beats have been missed
 */
private void handleSocketTimeout() throws SocketTimeoutException {
    if (_inConnectionNegotiation) {
        throw new SocketTimeoutException("Timeout during Connection negotiation");
    }

    if (_heartbeat == 0) { // No heart-beating
        return;
    }

    // We check against 8 = 2 * 4 because we need to wait for at
    // least two complete heartbeat setting intervals before
    // complaining, and we've set the socket timeout to a quarter
    // of the heartbeat setting in setHeartbeat above.
    if (++_missedHeartbeats > (2 * 4)) {
        throw new MissedHeartbeatException("Heartbeat missing with heartbeat = " + _heartbeat + " seconds");
    }
}