Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.activemq.broker.impl
Class DefaultBroker

    java.lang.Object
      org.codehaus.activemq.capacity.DelegateCapacityMonitor
          org.codehaus.activemq.broker.impl.DefaultBroker

All Implemented Interfaces:
  Broker, CapacityMonitor, Service

public class DefaultBroker
extends DelegateCapacityMonitor
implements Broker

The default `Broker` implementation

Version:
  $Revision: 1.11 $

Nested Class Summary

Nested classes inherited from class org.codehaus.activemq.capacity.CapacityMonitor
`CapacityMonitor.BasicCapacityMonitor`

Field Summary
`protected static java.lang.Class[]` | `NEWINSTANCE_PARAMETER_TYPES`
`protected static java.lang.String` | `PERSISTENCE_ADAPTER_PROPERTY`
`protected static java.lang.String` | `PROPERTY_STORE_DIRECTORY`

Fields inherited from class org.codehaus.activemq.capacity.DelegateCapacityMonitor
``

Constructor Summary
`DefaultBroker(java.lang.String brokerName)`
`DefaultBroker(java.lang.String brokerName, PersistenceAdapter persistenceAdapter)`

Method Summary
`void` | `acknowledgeMessage(BrokerClient client, MessageAck ack)` Acknowledge consumption of a message by the Message Consumer
`void` | `acknowledgeTransactedMessage(BrokerClient client, java.lang.String transactionId, MessageAck ack)` Acknowledge consumption of a message within a transaction
`void` | `addMessageConsumer(BrokerClient client, ConsumerInfo info)` Add an active message consumer
`protected void` | `checkValid()`
`void` | `cleanUpClient(BrokerClient client)` A hint to the broker that an BrokerClient has stopped This enables the broker to clean-up any outstanding processing that may be outstanding
`void` | `commitTransaction(BrokerClient client, ActiveMQXid xid, boolean onePhase)` Commit an XA Transaction.
`void` | `commitTransaction(BrokerClient client, java.lang.String transactionId)` commit a transaction
`protected MessageContainerManager[]` | `createContainerManagers()` Factory method to create the default container managers
`protected JMSException` | `createInstantiateAdapterException(java.lang.Class adapterClass, java.lang.Throwable e)`
`protected PersistenceAdapter` | `createPersistenceAdapter()` Factory method to create a default persistence adapter
`void` | `deleteSubscription(java.lang.String clientId, java.lang.String subscriberName)` Delete a durable subscriber
`java.lang.String` | `getBrokerName()`
`MessageContainerManager[]` | `getContainerManagers()`
`long` | `getMaximumMemoryUsage()`
`PersistenceAdapter` | `getPersistenceAdapter()`
`ActiveMQXid[]` | `getPreparedTransactions(BrokerClient client)` Gets the prepared XA transactions.
`PreparedTransactionStore` | `getPreparedTransactionStore()`
`protected java.lang.String` | `getStoreDirectory()`
`java.io.File` | `getTempDir()` Get a temp directory - used for spooling
`TransactionManager` | `getTransactionManager()`
`protected java.lang.Class` | `loadClass(java.lang.String name, boolean ignoreErrors)` Tries to load the given class from the current context class loader or class loader which loaded us or return null if the class could not be found
`int` | `prepareTransaction(BrokerClient client, ActiveMQXid xid)` Prepares an XA Transaciton.
`void` | `redeliverMessage(BrokerClient client, MessageAck ack)` Called after a rollback of a JMS transaction to redeliver the message to the consumers dispatch queue
`void` | `removeMessageConsumer(BrokerClient client, ConsumerInfo info)` remove an active message consumer
`void` | `rollbackTransaction(BrokerClient client, ActiveMQXid xid)` Rollback an XA Transaction.
`void` | `rollbackTransaction(BrokerClient client, java.lang.String transactionId)` rollback a transaction
`void` | `sendMessage(BrokerClient client, ActiveMQMessage message)` send a message to the broker
`void` | `sendTransactedMessage(BrokerClient client, java.lang.String transactionId, ActiveMQMessage message)` send a message to the broker within a transaction
`void` | `setContainerManagers(MessageContainerManager[] containerManagers)`
`void` | `setMaximumMemoryUsage(long maximumMemoryUsage)`
`void` | `setPersistenceAdapter(PersistenceAdapter persistenceAdapter)`
`void` | `setPreparedTransactionStore(PreparedTransactionStore preparedTransactionStore)`
`void` | `setTempDir(java.io.File tempDir)`
`void` | `setTransactionManager(TransactionManager transactionManager)`
`void` | `start()` Start this Service
`void` | `startTransaction(BrokerClient client, ActiveMQXid xid)` Starts an XA Transaction.
`void` | `startTransaction(BrokerClient client, java.lang.String transactionId)` Start a transaction.
`void` | `stop()` stop this Service
`protected PersistenceAdapter` | `tryCreatePersistenceAdapter(java.lang.String className, java.io.File directory, boolean ignoreErrors)`
`protected void` | `validateConsumer(ConsumerInfo info)` Ensures the consumer is valid, throwing a meaningful exception if not

Methods inherited from class org.codehaus.activemq.capacity.DelegateCapacityMonitor
`addCapacityEventListener, getCurrentCapacity, getCurrentValue, getName, getRoundedCapacity, getRoundingFactor, getValueLimit, removeCapacityEventListener, setCurrentValue, setDelegate, setName, setRoundingFactor, setValueLimit`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.codehaus.activemq.capacity.CapacityMonitor
`addCapacityEventListener, getCurrentCapacity, getCurrentValue, getName, getRoundedCapacity, getRoundingFactor, getValueLimit, removeCapacityEventListener, setCurrentValue, setName, setRoundingFactor, setValueLimit`

Field Detail

### PROPERTY_STORE_DIRECTORY

    protected static final java.lang.String PROPERTY_STORE_DIRECTORY

See Also:
  Constant Field Values

### PERSISTENCE_ADAPTER_PROPERTY

    protected static final java.lang.String PERSISTENCE_ADAPTER_PROPERTY

See Also:
  Constant Field Values

### NEWINSTANCE_PARAMETER_TYPES

    protected static final java.lang.Class[] NEWINSTANCE_PARAMETER_TYPES

Constructor Detail

### DefaultBroker

    public DefaultBroker(java.lang.String brokerName)

### DefaultBroker

    public DefaultBroker(java.lang.String brokerName,
                         PersistenceAdapter persistenceAdapter)

Method Detail

### start

    public void start()
               throws JMSException

  Start this Service

  Specified by:
    `start` in interface `Service`
  Throws:
    `JMSException`

### stop

    public void stop()
              throws JMSException

  stop this Service

  Specified by:
    `stop` in interface `Service`
  Throws:
    `JMSException`

### acknowledgeMessage

    public void acknowledgeMessage(BrokerClient client,
                                   MessageAck ack)
                            throws JMSException

  Acknowledge consumption of a message by the Message Consumer

  Specified by:
    `acknowledgeMessage` in interface `Broker`
  Parameters:
    `client` -
    `ack` -
  Throws:
    `JMSException`

### acknowledgeTransactedMessage

    public void acknowledgeTransactedMessage(BrokerClient client,
                                             java.lang.String transactionId,
                                             MessageAck ack)
                                      throws JMSException

  Acknowledge consumption of a message within a transaction

  Specified by:
    `acknowledgeTransactedMessage` in interface `Broker`
  Parameters:
    `client` -
    `transactionId` -
    `ack` -
  Throws:
    `JMSException`

### sendMessage

    public void sendMessage(BrokerClient client,
                            ActiveMQMessage message)
                     throws JMSException

  send a message to the broker

  Specified by:
    `sendMessage` in interface `Broker`
  Parameters:
    `client` -
    `message` -
  Throws:
    `JMSException`

### sendTransactedMessage

    public void sendTransactedMessage(BrokerClient client,
                                      java.lang.String transactionId,
                                      ActiveMQMessage message)
                               throws JMSException

  send a message to the broker within a transaction

  Specified by:
    `sendTransactedMessage` in interface `Broker`
  Parameters:
    `client` -
    `transactionId` -
    `message` -
  Throws:
    `JMSException`

### addMessageConsumer

    public void addMessageConsumer(BrokerClient client,
                                   ConsumerInfo info)
                            throws JMSException

  Add an active message consumer

  Specified by:
    `addMessageConsumer` in interface `Broker`
  Parameters:
    `client` -
    `info` -
  Throws:
    `JMSException`

### removeMessageConsumer

    public void removeMessageConsumer(BrokerClient client,
                                      ConsumerInfo info)
                               throws JMSException

  remove an active message consumer

  Specified by:
    `removeMessageConsumer` in interface `Broker`
  Parameters:
    `client` -
    `info` -
  Throws:
    `JMSException`

### redeliverMessage

    public void redeliverMessage(BrokerClient client,
                                 MessageAck ack)
                          throws JMSException

  Description copied from interface: `Broker`
  Called after a rollback of a JMS transaction to redeliver the message to the consumers dispatch queue

  Specified by:
    `redeliverMessage` in interface `Broker`
  Parameters:
    `client` -
    `ack` -
  Throws:
    `JMSException`

### deleteSubscription

    public void deleteSubscription(java.lang.String clientId,
                                   java.lang.String subscriberName)
                            throws JMSException

  Delete a durable subscriber

  Specified by:
    `deleteSubscription` in interface `Broker`
  Parameters:
    `clientId` -
    `subscriberName` -
  Throws:
    `JMSException` - if the subscriber doesn't exist or is still active

### startTransaction

    public void startTransaction(BrokerClient client,
                                 java.lang.String transactionId)
                          throws JMSException

  Start a transaction.

  Specified by:
    `startTransaction` in interface `Broker`
  Parameters:
    `client` -
    `transactionId` -
  Throws:
    `JMSException`
  See Also:
    `Broker.startTransaction(org.codehaus.activemq.broker.BrokerClient, java.lang.String)`

### commitTransaction

    public void commitTransaction(BrokerClient client,
                                  java.lang.String transactionId)
                           throws JMSException

  commit a transaction

  Specified by:
    `commitTransaction` in interface `Broker`
  Parameters:
    `client` -
    `transactionId` -
  Throws:
    `JMSException`

### rollbackTransaction

    public void rollbackTransaction(BrokerClient client,
                                    java.lang.String transactionId)
                             throws JMSException

  rollback a transaction

  Specified by:
    `rollbackTransaction` in interface `Broker`
  Parameters:
    `client` -
    `transactionId` -
  Throws:
    `JMSException`

### startTransaction

    public void startTransaction(BrokerClient client,
                                 ActiveMQXid xid)
                          throws XAException

  Starts an XA Transaction.

  Specified by:
    `startTransaction` in interface `Broker`
  Parameters:
    `client` -
    `xid` -
  Throws:
    `XAException`
  See Also:
    `Broker.startTransaction(org.codehaus.activemq.broker.BrokerClient, org.codehaus.activemq.message.ActiveMQXid)`

### prepareTransaction

    public int prepareTransaction(BrokerClient client,
                                  ActiveMQXid xid)
                           throws XAException

  Prepares an XA Transaciton.

  Specified by:
    `prepareTransaction` in interface `Broker`
  Parameters:
    `client` -
    `xid` -
  Throws:
    `XAException`
  See Also:
    `Broker.prepareTransaction(org.codehaus.activemq.broker.BrokerClient, org.codehaus.activemq.message.ActiveMQXid)`

### rollbackTransaction

    public void rollbackTransaction(BrokerClient client,
                                    ActiveMQXid xid)
                             throws XAException

  Rollback an XA Transaction.

  Specified by:
    `rollbackTransaction` in interface `Broker`
  Parameters:
    `client` -
    `xid` -
  Throws:
    `XAException`
  See Also:
    `Broker.rollbackTransaction(org.codehaus.activemq.broker.BrokerClient, org.codehaus.activemq.message.ActiveMQXid)`

### commitTransaction

    public void commitTransaction(BrokerClient client,
                                  ActiveMQXid xid,
                                  boolean onePhase)
                           throws XAException

  Commit an XA Transaction.

  Specified by:
    `commitTransaction` in interface `Broker`
  Parameters:
    `client` -
    `xid` -
    `onePhase` -
  Throws:
    `XAException`
  See Also:
    `Broker.commitTransaction(org.codehaus.activemq.broker.BrokerClient, org.codehaus.activemq.message.ActiveMQXid, boolean)`

### cleanUpClient

    public void cleanUpClient(BrokerClient client)
                       throws JMSException

  A hint to the broker that an BrokerClient has stopped This enables the broker to clean-up any outstanding processing that may be outstanding

  Specified by:
    `cleanUpClient` in interface `Broker`
  Parameters:
    `client` -
  Throws:
    `JMSException`

### getPreparedTransactions

    public ActiveMQXid[] getPreparedTransactions(BrokerClient client)
                                          throws XAException

  Gets the prepared XA transactions.

  Specified by:
    `getPreparedTransactions` in interface `Broker`
  Parameters:
    `client` -
  Throws:
    `XAException`
  See Also:
    `Broker.getPreparedTransactions(org.codehaus.activemq.broker.BrokerClient)`

### getTempDir

    public java.io.File getTempDir()

  Get a temp directory - used for spooling

  Specified by:
    `getTempDir` in interface `Broker`
  Returns:
    a File ptr to the directory

### getBrokerName

    public java.lang.String getBrokerName()

  Specified by:
    `getBrokerName` in interface `Broker`

### setTempDir

    public void setTempDir(java.io.File tempDir)

### getContainerManagers

    public MessageContainerManager[] getContainerManagers()

### setContainerManagers

    public void setContainerManagers(MessageContainerManager[] containerManagers)

### getPersistenceAdapter

    public PersistenceAdapter getPersistenceAdapter()

  Specified by:
    `getPersistenceAdapter` in interface `Broker`

### setPersistenceAdapter

    public void setPersistenceAdapter(PersistenceAdapter persistenceAdapter)

  Specified by:
    `setPersistenceAdapter` in interface `Broker`

### getTransactionManager

    public TransactionManager getTransactionManager()

### setTransactionManager

    public void setTransactionManager(TransactionManager transactionManager)

### getPreparedTransactionStore

    public PreparedTransactionStore getPreparedTransactionStore()

### setPreparedTransactionStore

    public void setPreparedTransactionStore(PreparedTransactionStore preparedTransactionStore)

### getMaximumMemoryUsage

    public long getMaximumMemoryUsage()

  Returns:
    Returns the maximumMemoryUsage.

### setMaximumMemoryUsage

    public void setMaximumMemoryUsage(long maximumMemoryUsage)

  Parameters:
    `maximumMemoryUsage` - The maximumMemoryUsage to set.

### createPersistenceAdapter

    protected PersistenceAdapter createPersistenceAdapter()
                                                   throws JMSException

  Factory method to create a default persistence adapter

  Returns:
  Throws:
    `JMSException`

### tryCreatePersistenceAdapter

    protected PersistenceAdapter tryCreatePersistenceAdapter(java.lang.String className,
                                                             java.io.File directory,
                                                             boolean ignoreErrors)
                                                      throws JMSException

  Throws:
    `JMSException`

### createInstantiateAdapterException

    protected JMSException createInstantiateAdapterException(java.lang.Class adapterClass,
                                                             java.lang.Throwable e)

### loadClass

    protected java.lang.Class loadClass(java.lang.String name,
                                        boolean ignoreErrors)
                                 throws JMSException

  Tries to load the given class from the current context class loader or class loader which loaded us or return null if the class could not be found

  Throws:
    `JMSException`

### getStoreDirectory

    protected java.lang.String getStoreDirectory()

### createContainerManagers

    protected MessageContainerManager[] createContainerManagers()

  Factory method to create the default container managers

  Returns:

### validateConsumer

    protected void validateConsumer(ConsumerInfo info)
                             throws JMSException

  Ensures the consumer is valid, throwing a meaningful exception if not

  Parameters:
    `info` -
  Throws:
    `JMSException`

### checkValid

    protected void checkValid()
                       throws JMSException

  Throws:
    `JMSException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 Protique, Ltd.. All Rights Reserved.