ChannelFlowMethodHandler.java
01 package org.apache.qpid.client.handler;
02 
03 import org.apache.qpid.framing.ChannelFlowBody;
04 import org.apache.qpid.client.state.StateAwareMethodListener;
05 import org.apache.qpid.client.protocol.AMQProtocolSession;
06 import org.apache.qpid.AMQException;
07 import org.slf4j.Logger;
08 import org.slf4j.LoggerFactory;
09 
10 /*
11 *
12 * Licensed to the Apache Software Foundation (ASF) under one
13 * or more contributor license agreements.  See the NOTICE file
14 * distributed with this work for additional information
15 * regarding copyright ownership.  The ASF licenses this file
16 * to you under the Apache License, Version 2.0 (the
17 * "License"); you may not use this file except in compliance
18 * with the License.  You may obtain a copy of the License at
19 *
20 *   http://www.apache.org/licenses/LICENSE-2.0
21 *
22 * Unless required by applicable law or agreed to in writing,
23 * software distributed under the License is distributed on an
24 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
25 * KIND, either express or implied.  See the License for the
26 * specific language governing permissions and limitations
27 * under the License.
28 *
29 */
30 
31 public class ChannelFlowMethodHandler implements StateAwareMethodListener<ChannelFlowBody>
32 {
33     private static final Logger _logger = LoggerFactory.getLogger(ChannelFlowMethodHandler.class);
34     private static final ChannelFlowMethodHandler _instance = new ChannelFlowMethodHandler();
35 
36     public static ChannelFlowMethodHandler getInstance()
37     {
38         return _instance;
39     }
40 
41     private ChannelFlowMethodHandler()
42     { }
43 
44     public void methodReceived(AMQProtocolSession session, ChannelFlowBody body, int channelId)
45             throws AMQException
46     {
47         session.setFlowControl(channelId, body.getActive());
48     }
49 
50 
51 }