Package org.codehaus.activemq.message

Examples of org.codehaus.activemq.message.KeepAlive


  private void examineChannel(ReliableTransportChannel channel) {
    if (channel.getLastReceiptTimestamp() < (System.currentTimeMillis() - channel.getKeepAliveTimeout()))
      if (channel.isTransportConnected() && !channel.isPendingStop()) {
        log.info("Sending keep-alive on channel " + channel.toString());
        KeepAlive packet = new KeepAlive();
        packet.setId(packetIdGenerator.generateId());
        try {
          channel.asyncSend(packet);
          zombieChannelSuspects.add(channel);
        } catch (JMSException e) {
          log.error("Error sending keep-alive to channel " + channel.toString()
View Full Code Here


  private void examineChannel(ReliableTransportChannel channel) {
    if (channel.getLastReceiptTimestamp() < (System.currentTimeMillis() - channel.getKeepAliveTimeout()))
      if (channel.isTransportConnected() && !channel.isPendingStop()) {
        log.debug("Sending keep-alive on channel " + channel.toString());
        KeepAlive packet = new KeepAlive();
        packet.setId(packetIdGenerator.generateId());
        try {
          channel.asyncSendWithReceipt(packet);
          zombieChannelSuspects.add(channel);
        } catch (JMSException e) {
          log.error("Error sending keep-alive to channel " + channel.toString()
View Full Code Here

     * validate the connection
     * @param timeout
     * @throws JMSException
     */
  public void validateConnection(int timeout) throws JMSException {
    KeepAlive packet = new KeepAlive();
    packet.setReceiptRequired(true);
    packet.setId(this.packetIdGenerator.getNextShortSequence());
    // In most cases, if the transport is dead due to network errors
    // the network error will be recognised immediately and an exception
    // thrown. If the duplicate client ids are due to misconfiguration,
    // we make sure that we do not terminate the "right" connection
    // prematurely by using a long timeout here. If the existing client
View Full Code Here

    assertTrue("Exceptions were thrown: " + exceptions, exceptions.size() == 0);
  }
 
  public void testAsyncSendWithReceipt() throws Exception {
    sendReceipts = true;
    Packet packet = new KeepAlive();
    packet.setId((short)1);
        ReceiptHolder rh = sender.asyncSendWithReceipt(packet);
        Receipt result = rh.getReceipt(5000);
        if (result == null) fail("Should have gotten receipt");
  }
View Full Code Here

  private void examineChannel(ReliableTransportChannel channel) {
    if ((channel.getLastReceiptTimestamp() + channel.getKeepAliveTimeout()) < System.currentTimeMillis())
      if (channel.isTransportConnected() && !channel.isPendingStop()) {
        log.debug("Sending keep-alive on channel " + channel.toString());
        KeepAlive packet = new KeepAlive();
        packet.setReceiptRequired(true);
        try {
          channel.asyncSendWithReceipt(packet);
          zombieChannelSuspects.add(channel);
        } catch (JMSException e) {
          log.error("Error sending keep-alive to channel " + channel.toString()
View Full Code Here

            }
        }
    }
   
  public void validateConnection(int timeout) throws JMSException {
    KeepAlive packet = new KeepAlive();
    packet.setReceiptRequired(true);
    packet.setId(this.packetIdGenerator.getNextShortSequence());
    // In most cases, if the transport is dead due to network errors
    // the network error will be recognised immediately and an exception
    // thrown. If the duplicate client ids are due to misconfiguration,
    // we make sure that we do not terminate the "right" connection
    // prematurely by using a long timeout here. If the existing client
View Full Code Here

    assertTrue("Exceptions were thrown: " + exceptions, exceptions.size() == 0);
  }
 
  public void testAsyncSendWithReceipt() throws Exception {
    sendReceipts = true;
    Packet packet = new KeepAlive();
    packet.setId((short)1);
        ReceiptHolder rh = sender.asyncSendWithReceipt(packet);
        Receipt result = rh.getReceipt(5000);
        if (result == null) fail("Should have gotten receipt");
  }
View Full Code Here

  private void examineChannel(ReliableTransportChannel channel) {
    if (channel.getLastReceiptTimestamp() < (System.currentTimeMillis() - channel.getKeepAliveTimeout()))
      if (channel.isTransportConnected() && !channel.isPendingStop()) {
        log.info("Sending keep-alive on channel " + channel.toString());
        KeepAlive packet = new KeepAlive();
        packet.setId(packetIdGenerator.generateId());
        try {
          channel.asyncSendWithReceipt(packet);
          zombieChannelSuspects.add(channel);
        } catch (JMSException e) {
          log.error("Error sending keep-alive to channel " + channel.toString()
View Full Code Here

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

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

    assertTrue("Exceptions were thrown: " + exceptions, exceptions.size() == 0);
  }
 
  public void testAsyncSendWithReceipt() throws Exception {
    sendReceipts = true;
    Packet packet = new KeepAlive();
    packet.setId("1");
        ReceiptHolder rh = sender.asyncSendWithReceipt(packet);
        Receipt result = rh.getReceipt(5000);
        if (result == null) fail("Should have gotten receipt");
  }
View Full Code Here

TOP

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

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.