Search in sources :

Example 1 with ConnectionClosingTicker

use of org.apache.qpid.server.protocol.ConnectionClosingTicker in project qpid-broker-j by apache.

the class ServerConnection method setState.

protected void setState(State state) {
    synchronized (lock) {
        this.state = state;
        lock.notifyAll();
    }
    if (state == State.CLOSING) {
        long timeoutTime = System.currentTimeMillis() + getAmqpConnection().getContextValue(Long.class, org.apache.qpid.server.model.Connection.CLOSE_RESPONSE_TIMEOUT);
        getAmqpConnection().getAggregateTicker().addTicker(new ConnectionClosingTicker(timeoutTime, (ServerNetworkConnection) getNetworkConnection()));
        // trigger a wakeup to ensure the ticker will be taken into account
        getAmqpConnection().notifyWork();
    }
}
Also used : ServerNetworkConnection(org.apache.qpid.server.transport.ServerNetworkConnection) AtomicLong(java.util.concurrent.atomic.AtomicLong) ConnectionClosingTicker(org.apache.qpid.server.protocol.ConnectionClosingTicker)

Example 2 with ConnectionClosingTicker

use of org.apache.qpid.server.protocol.ConnectionClosingTicker in project qpid-broker-j by apache.

the class AMQPConnection_1_0Impl method addCloseTicker.

private void addCloseTicker() {
    long timeoutTime = System.currentTimeMillis() + getContextValue(Long.class, Connection.CLOSE_RESPONSE_TIMEOUT);
    getAggregateTicker().addTicker(new ConnectionClosingTicker(timeoutTime, getNetwork()));
    // trigger a wakeup to ensure the ticker will be taken into account
    notifyWork();
}
Also used : ConnectionClosingTicker(org.apache.qpid.server.protocol.ConnectionClosingTicker)

Example 3 with ConnectionClosingTicker

use of org.apache.qpid.server.protocol.ConnectionClosingTicker in project qpid-broker-j by apache.

the class AMQPConnection_0_8Impl method sendConnectionClose.

private void sendConnectionClose(int channelId, AMQFrame frame) {
    if (_orderlyClose.compareAndSet(false, true)) {
        try {
            markChannelAwaitingCloseOk(channelId);
            completeAndCloseAllChannels();
        } finally {
            try {
                writeFrame(frame);
            } finally {
                final long timeoutTime = System.currentTimeMillis() + getContextValue(Long.class, Connection.CLOSE_RESPONSE_TIMEOUT);
                getAggregateTicker().addTicker(new ConnectionClosingTicker(timeoutTime, getNetwork()));
                // trigger a wakeup to ensure the ticker will be taken into account
                notifyWork();
            }
        }
    }
}
Also used : ConnectionClosingTicker(org.apache.qpid.server.protocol.ConnectionClosingTicker)

Aggregations

ConnectionClosingTicker (org.apache.qpid.server.protocol.ConnectionClosingTicker)3 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 ServerNetworkConnection (org.apache.qpid.server.transport.ServerNetworkConnection)1