/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.client.protocol; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.ReentrantLock; import org.apache.qpid.AMQException; import org.apache.qpid.AMQTimeoutException; import org.apache.qpid.client.failover.FailoverException; import org.apache.qpid.client.util.BlockingWaiter; import org.apache.qpid.framing.AMQMethodBody; import org.apache.qpid.protocol.AMQMethodEvent; import org.apache.qpid.protocol.AMQMethodListener; /** * BlockingMethodFrameListener is a 'rendezvous' which acts as a {@link AMQMethodListener} that delegates handling of * incoming methods to a method listener implemented as a sub-class of this and hands off the processed method or * error to a consumer. The producer of the event does not have to wait for the consumer to take the event, so this * differs from a 'rendezvous' in that sense. * *
BlockingMethodFrameListeners are used to coordinate waiting for replies to method calls that expect a response. * They are always used in a 'one-shot' manner, that is, to recieve just one response. Usually the caller has to register * them as method listeners with an event dispatcher and remember to de-register them (in a finally block) once they * have been completed. * * The {@link #processMethod} must return true on any incoming method that it handles. This indicates to * this listeners that the method it is waiting for has arrived. Incoming methods are also filtered by channel prior to * being passed to the {@link #processMethod} method, so responses are only received for a particular channel. The * channel id must be passed to the constructor. * * Errors from the producer are rethrown to the consumer. * *Responsibilities | Collaborations * |
---|---|
Accept notification of AMQP method events. | {@link AMQMethodEvent} * |
Delegate handling of the method to another method listener. | {@link AMQMethodBody} * |
Block until a method is handled by the delegated to handler. * | |
Propagate the most recent exception to the consumer. * |