Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.activemq.transport
Class NetworkChannel  view NetworkChannel download NetworkChannel.java

java.lang.Object
  extended byorg.activemq.transport.NetworkChannel
All Implemented Interfaces:
org.activemq.advisories.ConnectionAdvisoryEventListener, org.activemq.broker.ConsumerInfoListener, org.activemq.service.Service, TransportStatusEventListener
Direct Known Subclasses:
RemoteNetworkChannel

public class NetworkChannel
extends java.lang.Object
implements org.activemq.service.Service, org.activemq.broker.ConsumerInfoListener, org.activemq.advisories.ConnectionAdvisoryEventListener, TransportStatusEventListener

Represents a broker's connection with a single remote broker which bridges the two brokers to form a network.

The NetworkChannel contains a JMS connection with the remote broker.

New subscriptions on the local broker are multiplexed into the JMS connection so that messages published on the remote broker can be replayed onto the local broker.

Version:
$Revision: 1.1.1.1 $

Field Summary
protected  org.activemq.broker.BrokerContainer brokerContainer
           
private  SynchronizedBoolean connected
           
private  org.activemq.advisories.ConnectionAdvisor connectionAdvisor
           
private  boolean demandBasedForwarding
           
protected  org.activemq.ActiveMQConnection localConnection
           
private  org.activemq.ActiveMQPrefetchPolicy localPrefetchPolicy
           
private static org.apache.commons.logging.Log log
           
protected  int maximumRetries
           
protected  ConcurrentHashMap queueConsumerMap
           
protected  long reconnectSleepTime
           
private  boolean remote
           
protected  java.lang.String remoteBrokerName
           
protected  java.lang.String remoteClusterName
           
protected  org.activemq.ActiveMQConnection remoteConnection
           
protected  java.lang.String remotePassword
           
private  org.activemq.ActiveMQPrefetchPolicy remotePrefetchPolicy
           
protected  java.lang.String remoteUserName
           
private  SynchronizedBoolean started
           
private  SynchronizedBoolean stopped
           
protected  EDU.oswego.cs.dl.util.concurrent.PooledExecutor threadPool
           
protected  ConcurrentHashMap topicConsumerMap
           
protected  java.lang.String uri
           
 
Constructor Summary
NetworkChannel()
          Default constructor
NetworkChannel(NetworkConnector connector, org.activemq.broker.BrokerContainer brokerContainer, java.lang.String uri)
          Constructor
NetworkChannel(NetworkConnector connector, org.activemq.broker.BrokerContainer brokerContainer, TransportChannel channel, java.lang.String remoteBrokerName, java.lang.String remoteclusterName)
          Create a NetworkConnector from a TransportChannel
NetworkChannel(EDU.oswego.cs.dl.util.concurrent.PooledExecutor tp)
          Default Constructor
 
Method Summary
private  void addConsumerInfo(org.activemq.message.ActiveMQDestination destination, boolean topic, boolean durableTopic)
           
private  void addConsumerInfo(org.activemq.message.ConsumerInfo info)
           
private  NetworkMessageBridge createBridge(java.util.Map map, org.activemq.message.ActiveMQDestination destination, boolean durableTopic)
           
private  void doSetConnected()
           
 org.activemq.broker.BrokerContainer getBrokerContainer()
           
private  org.activemq.ActiveMQConnection getLocalConnection()
           
 org.activemq.ActiveMQPrefetchPolicy getLocalPrefetchPolicy()
           
 int getMaximumRetries()
           
 long getReconnectSleepTime()
           
 java.lang.String getRemoteBrokerName()
           
private  org.activemq.ActiveMQConnection getRemoteConnection()
           
 java.lang.String getRemotePassword()
           
 org.activemq.ActiveMQPrefetchPolicy getRemotePrefetchPolicy()
           
 java.lang.String getRemoteUserName()
           
protected  EDU.oswego.cs.dl.util.concurrent.PooledExecutor getThreadPool()
           
 java.lang.String getUri()
           
protected  void initialize()
           
private  void initializeLocal()
           
private  void initializeRemote()
           
 boolean isDemandBasedForwarding()
           
 void onConsumerInfo(org.activemq.broker.BrokerClient client, org.activemq.message.ConsumerInfo info)
          Listen for new Consumer events at this broker
 void onEvent(org.activemq.advisories.ConnectionAdvisoryEvent event)
          Implementation of ConnectionAdvisoryEventListener
private  void removeConsumerInfo(org.activemq.message.ConsumerInfo info)
           
 void setBrokerContainer(org.activemq.broker.BrokerContainer brokerContainer)
           
 void setDemandBasedForwarding(boolean demandBasedForwarding)
           
 void setLocalPrefetchPolicy(org.activemq.ActiveMQPrefetchPolicy localPrefetchPolicy)
           
 void setMaximumRetries(int maximumRetries)
           
 void setReconnectSleepTime(long reconnectSleepTime)
           
 void setRemoteBrokerName(java.lang.String remoteBrokerName)
           
 void setRemotePassword(java.lang.String remotePassword)
           
 void setRemotePrefetchPolicy(org.activemq.ActiveMQPrefetchPolicy remotePrefetchPolicy)
           
 void setRemoteUserName(java.lang.String remoteUserName)
           
protected  void setThreadPool(EDU.oswego.cs.dl.util.concurrent.PooledExecutor threadPool)
           
 void setUri(java.lang.String uri)
          set the uri of the broker(s) this channel is connected to
 void start()
          Start the channel
private  void startSubscriptions()
           
private  void startSubscriptions(java.util.Map destinations, boolean topic, boolean durableTopic)
           
 void statusChanged(TransportStatusEvent event)
          called when the status of a transport channel changes
 void stop()
          stop the channel
 java.lang.String toString()
          Convert this Object to a human-readable String.
private  void upgradeBridge(NetworkMessageBridge bridge)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

uri

protected java.lang.String uri

brokerContainer

protected org.activemq.broker.BrokerContainer brokerContainer

localConnection

protected org.activemq.ActiveMQConnection localConnection

remoteConnection

protected org.activemq.ActiveMQConnection remoteConnection

topicConsumerMap

protected ConcurrentHashMap topicConsumerMap

queueConsumerMap

protected ConcurrentHashMap queueConsumerMap

remoteUserName

protected java.lang.String remoteUserName

remotePassword

protected java.lang.String remotePassword

remoteBrokerName

protected java.lang.String remoteBrokerName

remoteClusterName

protected java.lang.String remoteClusterName

maximumRetries

protected int maximumRetries

reconnectSleepTime

protected long reconnectSleepTime

threadPool

protected EDU.oswego.cs.dl.util.concurrent.PooledExecutor threadPool

remote

private boolean remote

started

private SynchronizedBoolean started

connected

private SynchronizedBoolean connected

stopped

private SynchronizedBoolean stopped

connectionAdvisor

private org.activemq.advisories.ConnectionAdvisor connectionAdvisor

localPrefetchPolicy

private org.activemq.ActiveMQPrefetchPolicy localPrefetchPolicy

remotePrefetchPolicy

private org.activemq.ActiveMQPrefetchPolicy remotePrefetchPolicy

demandBasedForwarding

private boolean demandBasedForwarding
Constructor Detail

NetworkChannel

public NetworkChannel()
Default constructor


NetworkChannel

public NetworkChannel(EDU.oswego.cs.dl.util.concurrent.PooledExecutor tp)
Default Constructor


NetworkChannel

public NetworkChannel(NetworkConnector connector,
                      org.activemq.broker.BrokerContainer brokerContainer,
                      java.lang.String uri)
Constructor


NetworkChannel

public NetworkChannel(NetworkConnector connector,
                      org.activemq.broker.BrokerContainer brokerContainer,
                      TransportChannel channel,
                      java.lang.String remoteBrokerName,
                      java.lang.String remoteclusterName)
               throws javax.jms.JMSException
Create a NetworkConnector from a TransportChannel

Method Detail

statusChanged

public void statusChanged(TransportStatusEvent event)
Description copied from interface: TransportStatusEventListener
called when the status of a transport channel changes

Specified by:
statusChanged in interface TransportStatusEventListener

doSetConnected

private void doSetConnected()

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


start

public void start()
Start the channel

Specified by:
start in interface org.activemq.service.Service

stop

public void stop()
          throws javax.jms.JMSException
stop the channel

Specified by:
stop in interface org.activemq.service.Service

onConsumerInfo

public void onConsumerInfo(org.activemq.broker.BrokerClient client,
                           org.activemq.message.ConsumerInfo info)
Listen for new Consumer events at this broker

Specified by:
onConsumerInfo in interface org.activemq.broker.ConsumerInfoListener

getUri

public java.lang.String getUri()

setUri

public void setUri(java.lang.String uri)
set the uri of the broker(s) this channel is connected to


getRemotePassword

public java.lang.String getRemotePassword()

setRemotePassword

public void setRemotePassword(java.lang.String remotePassword)

getRemoteUserName

public java.lang.String getRemoteUserName()

setRemoteUserName

public void setRemoteUserName(java.lang.String remoteUserName)

getBrokerContainer

public org.activemq.broker.BrokerContainer getBrokerContainer()

setBrokerContainer

public void setBrokerContainer(org.activemq.broker.BrokerContainer brokerContainer)

getMaximumRetries

public int getMaximumRetries()

setMaximumRetries

public void setMaximumRetries(int maximumRetries)

getReconnectSleepTime

public long getReconnectSleepTime()

setReconnectSleepTime

public void setReconnectSleepTime(long reconnectSleepTime)

getRemoteBrokerName

public java.lang.String getRemoteBrokerName()

setRemoteBrokerName

public void setRemoteBrokerName(java.lang.String remoteBrokerName)

getThreadPool

protected EDU.oswego.cs.dl.util.concurrent.PooledExecutor getThreadPool()

setThreadPool

protected void setThreadPool(EDU.oswego.cs.dl.util.concurrent.PooledExecutor threadPool)

getLocalConnection

private org.activemq.ActiveMQConnection getLocalConnection()
                                                    throws javax.jms.JMSException

getRemoteConnection

private org.activemq.ActiveMQConnection getRemoteConnection()
                                                     throws javax.jms.JMSException

getLocalPrefetchPolicy

public org.activemq.ActiveMQPrefetchPolicy getLocalPrefetchPolicy()

setLocalPrefetchPolicy

public void setLocalPrefetchPolicy(org.activemq.ActiveMQPrefetchPolicy localPrefetchPolicy)

getRemotePrefetchPolicy

public org.activemq.ActiveMQPrefetchPolicy getRemotePrefetchPolicy()

setRemotePrefetchPolicy

public void setRemotePrefetchPolicy(org.activemq.ActiveMQPrefetchPolicy remotePrefetchPolicy)

isDemandBasedForwarding

public boolean isDemandBasedForwarding()

setDemandBasedForwarding

public void setDemandBasedForwarding(boolean demandBasedForwarding)

onEvent

public void onEvent(org.activemq.advisories.ConnectionAdvisoryEvent event)
Implementation of ConnectionAdvisoryEventListener

Specified by:
onEvent in interface org.activemq.advisories.ConnectionAdvisoryEventListener

addConsumerInfo

private void addConsumerInfo(org.activemq.message.ConsumerInfo info)

addConsumerInfo

private void addConsumerInfo(org.activemq.message.ActiveMQDestination destination,
                             boolean topic,
                             boolean durableTopic)

upgradeBridge

private void upgradeBridge(NetworkMessageBridge bridge)

createBridge

private NetworkMessageBridge createBridge(java.util.Map map,
                                          org.activemq.message.ActiveMQDestination destination,
                                          boolean durableTopic)

removeConsumerInfo

private void removeConsumerInfo(org.activemq.message.ConsumerInfo info)

startSubscriptions

private void startSubscriptions()

startSubscriptions

private void startSubscriptions(java.util.Map destinations,
                                boolean topic,
                                boolean durableTopic)

initialize

protected void initialize()
                   throws javax.jms.JMSException

initializeRemote

private void initializeRemote()
                       throws javax.jms.JMSException

initializeLocal

private void initializeLocal()
                      throws javax.jms.JMSException