Package org.codehaus.activemq.message

Examples of org.codehaus.activemq.message.CapacityInfo


     * @throws IOException thrown if an error occurs
     */

    public void writePacket(Packet packet, DataOutput dataOut) throws IOException {
        super.writePacket(packet, dataOut);
        CapacityInfo info = (CapacityInfo) packet;
        super.writeUTF(info.getResourceName(), dataOut);
        dataOut.writeShort(info.getCorrelationId());
        dataOut.writeByte(info.getCapacity());
        dataOut.writeInt((int)info.getFlowControlTimeout());
    }
View Full Code Here


                catch (JMSException jmsEx) {
                    handleAsyncException(jmsEx);
                }
            }
            else if (packet.getPacketType() == Packet.CAPACITY_INFO) {
                CapacityInfo info = (CapacityInfo) packet;
                flowControlSleepTime = info.getFlowControlTimeout();
                //System.out.println("SET FLOW TIMEOUT = " + flowControlSleepTime + " FOR " + info);
            } else if (packet.getPacketType() == Packet.KEEP_ALIVE && packet.isReceiptRequired()) {
              Receipt receipt = new Receipt();
                receipt.setCorrelationId(packet.getId());
                receipt.setReceiptRequired(false);
View Full Code Here

     *
     * @param event
     */
    public void capacityChanged(CapacityMonitorEvent event) {
        //send the event to broker ...
        CapacityInfo info = new CapacityInfo();
        info.setResourceName(event.getMonitorName());
        info.setCapacity(event.getCapacity());
        //System.out.println("Cap changed: " + event);
        try {
            asyncSendPacket(info, false);
        }
        catch (JMSException e) {
View Full Code Here

    /**
     * @return a new Packet instance
     */

    public Packet createPacket() {
        return new CapacityInfo();
    }
View Full Code Here

     * @throws IOException
     */

    public void buildPacket(Packet packet, DataInput dataIn) throws IOException {
        super.buildPacket(packet, dataIn);
        CapacityInfo info = (CapacityInfo) packet;
        info.setResourceName(dataIn.readUTF());
        info.setCorrelationId(dataIn.readShort());
        info.setCapacity(dataIn.readByte());
        info.setFlowControlTimeout((int)dataIn.readInt());
    }
View Full Code Here

                            DurableUnsubscribe ds = (DurableUnsubscribe) packet;
                            brokerConnector.durableUnsubscribe(this, ds);
                            break;
                        }
                        case Packet.CAPACITY_INFO : {
                            CapacityInfo info = (CapacityInfo) packet;
                            consumeCapacityInfo(info);
                            break;
                        }
                        case Packet.CAPACITY_INFO_REQUEST : {
                            updateCapacityInfo(packet.getId());
View Full Code Here

     * Update the peer Connection about the Broker's capacity for messages
     *
     * @param capacity
     */
    public void updateBrokerCapacity(int capacity) {
        CapacityInfo info = new CapacityInfo();
        info.setResourceName(this.brokerConnector.getBrokerInfo().getBrokerName());
        info.setCapacity(capacity);
        info.setFlowControlTimeout(getFlowControlTimeout(capacity));
        send(info);
    }
View Full Code Here

    private void consumeCapacityInfo(CapacityInfo info) {
        this.capacity = info.getCapacity();
    }

    private void updateCapacityInfo(short correlationId) {
        CapacityInfo info = new CapacityInfo();
        info.setResourceName(this.brokerConnector.getBrokerInfo().getBrokerName());
        info.setCorrelationId(correlationId);
        info.setCapacity(this.brokerConnector.getBrokerCapacity());
        info.setFlowControlTimeout(getFlowControlTimeout(info.getCapacity()));
        send(info);
    }
View Full Code Here

                catch (JMSException jmsEx) {
                    handleAsyncException(jmsEx);
                }
            }
            else if (packet.getPacketType() == Packet.CAPACITY_INFO) {
                CapacityInfo info = (CapacityInfo) packet;
                flowControlSleepTime = info.getFlowControlTimeout();
                //System.out.println("SET FLOW TIMEOUT = " + flowControlSleepTime + " FOR " + info);
            }
        }
    }
View Full Code Here

     *
     * @param event
     */
    public void capacityChanged(CapacityMonitorEvent event) {
        //send the event to broker ...
        CapacityInfo info = new CapacityInfo();
        info.setId(packetIdGenerator.generateId());
        info.setResourceName(event.getMonitorName());
        info.setCapacity(event.getCapacity());
        //System.out.println("Cap changed: " + event);
        try {
            asyncSendPacket(info);
        }
        catch (JMSException e) {
View Full Code Here

TOP

Related Classes of org.codehaus.activemq.message.CapacityInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.