More checkstyle fixes

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@563982 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2007-08-08 18:56:59 +00:00
parent 43ba1be188
commit f812e34179
452 changed files with 17426 additions and 17633 deletions

View File

@ -32,7 +32,6 @@ import javax.jms.TemporaryTopic;
import javax.jms.TextMessage;
import javax.jms.Topic;
import org.apache.activemq.command.ActiveMQBytesMessage;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQMapMessage;
@ -46,7 +45,8 @@ import org.apache.activemq.command.ActiveMQTextMessage;
import org.apache.activemq.command.ActiveMQTopic;
/**
* A helper class for converting normal JMS interfaces into ActiveMQ specific ones.
* A helper class for converting normal JMS interfaces into ActiveMQ specific
* ones.
*
* @version $Revision: 1.1 $
*/
@ -55,8 +55,10 @@ public class ActiveMQMessageTransformation {
/**
* Creates a an available JMS message from another provider.
*
* @param destination - Destination to be converted into ActiveMQ's implementation.
* @return ActiveMQDestination - ActiveMQ's implementation of the destination.
* @param destination - Destination to be converted into ActiveMQ's
* implementation.
* @return ActiveMQDestination - ActiveMQ's implementation of the
* destination.
* @throws JMSException if an error occurs
*/
public static ActiveMQDestination transformDestination(Destination destination) throws JMSException {
@ -66,18 +68,14 @@ public class ActiveMQMessageTransformation {
if (destination instanceof ActiveMQDestination) {
return (ActiveMQDestination)destination;
}
else {
} else {
if (destination instanceof TemporaryQueue) {
activeMQDestination = new ActiveMQTempQueue(((Queue)destination).getQueueName());
}
else if (destination instanceof TemporaryTopic) {
} else if (destination instanceof TemporaryTopic) {
activeMQDestination = new ActiveMQTempTopic(((Topic)destination).getTopicName());
}
else if (destination instanceof Queue) {
} else if (destination instanceof Queue) {
activeMQDestination = new ActiveMQQueue(((Queue)destination).getQueueName());
}
else if (destination instanceof Topic) {
} else if (destination instanceof Topic) {
activeMQDestination = new ActiveMQTopic(((Topic)destination).getTopicName());
}
}
@ -86,17 +84,19 @@ public class ActiveMQMessageTransformation {
return activeMQDestination;
}
/**
* Creates a fast shallow copy of the current ActiveMQMessage or creates a whole new
* message instance from an available JMS message from another provider.
* Creates a fast shallow copy of the current ActiveMQMessage or creates a
* whole new message instance from an available JMS message from another
* provider.
*
* @param message - Message to be converted into ActiveMQ's implementation.
* @param connection
* @return ActiveMQMessage - ActiveMQ's implementation object of the message.
* @return ActiveMQMessage - ActiveMQ's implementation object of the
* message.
* @throws JMSException if an error occurs
*/
public static final ActiveMQMessage transformMessage(Message message, ActiveMQConnection connection) throws JMSException {
public static final ActiveMQMessage transformMessage(Message message, ActiveMQConnection connection)
throws JMSException {
if (message instanceof ActiveMQMessage) {
return (ActiveMQMessage)message;
@ -174,7 +174,8 @@ public class ActiveMQMessageTransformation {
}
/**
* Copies the standard JMS and user defined properties from the givem message to the specified message
* Copies the standard JMS and user defined properties from the givem
* message to the specified message
*
* @param fromMessage the message to take the properties from
* @param toMesage the message to add the properties to

View File

@ -16,22 +16,20 @@
*/
package org.apache.activemq;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ConsumerId;
import javax.jms.JMSException;
import javax.jms.Queue;
import javax.jms.QueueReceiver;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ConsumerId;
/**
* A client uses a <CODE>QueueReceiver</CODE> object to receive messages that
* have been delivered to a queue.
* <p/>
* have been delivered to a queue. <p/>
* <P>
* Although it is possible to have multiple <CODE>QueueReceiver</CODE> s for
* the same queue, the JMS API does not define how messages are distributed
* between the <CODE>QueueReceiver</CODE>s.
* <p/>
* between the <CODE>QueueReceiver</CODE>s. <p/>
* <P>
* If a <CODE>QueueReceiver</CODE> specifies a message selector, the messages
* that are not selected remain on the queue. By definition, a message selector
@ -39,13 +37,13 @@ import javax.jms.QueueReceiver;
* the skipped messages are eventually read, the total ordering of the reads
* does not retain the partial order defined by each message producer. Only
* <CODE>QueueReceiver</CODE> s without a message selector will read messages
* in message producer order.
* <p/>
* in message producer order. <p/>
* <P>
* Creating a <CODE>MessageConsumer</CODE> provides the same features as
* creating a <CODE>QueueReceiver</CODE>. A <CODE>MessageConsumer</CODE>
* object is recommended for creating new code. The <CODE>QueueReceiver
* </CODE> is provided to support existing code.
* </CODE>
* is provided to support existing code.
*
* @see javax.jms.Session#createConsumer(javax.jms.Destination, String)
* @see javax.jms.Session#createConsumer(javax.jms.Destination)
@ -54,8 +52,7 @@ import javax.jms.QueueReceiver;
* @see javax.jms.MessageConsumer
*/
public class ActiveMQQueueReceiver extends ActiveMQMessageConsumer implements
QueueReceiver {
public class ActiveMQQueueReceiver extends ActiveMQMessageConsumer implements QueueReceiver {
/**
* @param theSession
@ -66,18 +63,20 @@ public class ActiveMQQueueReceiver extends ActiveMQMessageConsumer implements
* @param asyncDispatch
* @throws JMSException
*/
protected ActiveMQQueueReceiver(ActiveMQSession theSession,
ConsumerId consumerId, ActiveMQDestination destination, String selector, int prefetch, int maximumPendingMessageCount, boolean asyncDispatch)
protected ActiveMQQueueReceiver(ActiveMQSession theSession, ConsumerId consumerId,
ActiveMQDestination destination, String selector, int prefetch,
int maximumPendingMessageCount, boolean asyncDispatch)
throws JMSException {
super(theSession, consumerId, destination, null, selector, prefetch, maximumPendingMessageCount, false, false, asyncDispatch);
super(theSession, consumerId, destination, null, selector, prefetch, maximumPendingMessageCount,
false, false, asyncDispatch);
}
/**
* Gets the <CODE>Queue</CODE> associated with this queue receiver.
*
* @return this receiver's <CODE>Queue</CODE>
* @throws JMSException if the JMS provider fails to get the queue for this queue
* receiver due to some internal error.
* @throws JMSException if the JMS provider fails to get the queue for this
* queue receiver due to some internal error.
*/
public Queue getQueue() throws JMSException {

View File

@ -26,41 +26,40 @@ import org.apache.activemq.command.ActiveMQDestination;
/**
* A client uses a <CODE>QueueSender</CODE> object to send messages to a
* queue.
* <p/>
* queue. <p/>
* <P>
* Normally, the <CODE>Queue</CODE> is specified when a <CODE>QueueSender
* </CODE> is created. In this case, an attempt to use the <CODE>send</CODE>
* methods for an unidentified <CODE>QueueSender</CODE> will throw a <CODE>
* </CODE>
* is created. In this case, an attempt to use the <CODE>send</CODE> methods
* for an unidentified <CODE>QueueSender</CODE> will throw a <CODE>
* java.lang.UnsupportedOperationException</CODE>.
* <p/>
* <P>
* If the <CODE>QueueSender</CODE> is created with an unidentified <CODE>
* Queue</CODE>, an attempt to use the <CODE>send</CODE> methods that
* assume that the <CODE>Queue</CODE> has been identified will throw a <CODE>
* Queue</CODE>,
* an attempt to use the <CODE>send</CODE> methods that assume that the
* <CODE>Queue</CODE> has been identified will throw a <CODE>
* java.lang.UnsupportedOperationException</CODE>.
* <p/>
* <P>
* During the execution of its <CODE>send</CODE> method, a message must not
* be changed by other threads within the client. If the message is modified,
* the result of the <CODE>send</CODE> is undefined.
* <p/>
* During the execution of its <CODE>send</CODE> method, a message must not be
* changed by other threads within the client. If the message is modified, the
* result of the <CODE>send</CODE> is undefined. <p/>
* <P>
* After sending a message, a client may retain and modify it without affecting
* the message that has been sent. The same message object may be sent multiple
* times.
* <p/>
* times. <p/>
* <P>
* The following message headers are set as part of sending a message: <code>JMSDestination</code>,
* <code>JMSDeliveryMode</code>,<code>JMSExpiration</code>,<code>JMSPriority</code>,
* The following message headers are set as part of sending a message:
* <code>JMSDestination</code>, <code>JMSDeliveryMode</code>,<code>JMSExpiration</code>,<code>JMSPriority</code>,
* <code>JMSMessageID</code> and <code>JMSTimeStamp</code>. When the
* message is sent, the values of these headers are ignored. After the
* completion of the <CODE>send</CODE>, the headers hold the values
* specified by the method sending the message. It is possible for the <code>send</code>
* completion of the <CODE>send</CODE>, the headers hold the values specified
* by the method sending the message. It is possible for the <code>send</code>
* method not to set <code>JMSMessageID</code> and <code>JMSTimeStamp</code>
* if the setting of these headers is explicitly disabled by the <code>MessageProducer.setDisableMessageID</code>
* or <code>MessageProducer.setDisableMessageTimestamp</code> method.
* <p/>
* if the setting of these headers is explicitly disabled by the
* <code>MessageProducer.setDisableMessageID</code> or
* <code>MessageProducer.setDisableMessageTimestamp</code> method. <p/>
* <P>
* Creating a <CODE>MessageProducer</CODE> provides the same features as
* creating a <CODE>QueueSender</CODE>. A <CODE>MessageProducer</CODE>
@ -75,9 +74,7 @@ public class ActiveMQQueueSender extends ActiveMQMessageProducer implements Queu
protected ActiveMQQueueSender(ActiveMQSession session, ActiveMQDestination destination)
throws JMSException {
super(session,
session.getNextProducerId(),
destination);
super(session, session.getNextProducerId(), destination);
}
/**
@ -93,10 +90,9 @@ public class ActiveMQQueueSender extends ActiveMQMessageProducer implements Queu
}
/**
* Sends a message to a queue for an unidentified message producer. Uses
* the <CODE>QueueSender</CODE>'s default delivery mode, priority, and
* time to live.
* <p/>
* Sends a message to a queue for an unidentified message producer. Uses the
* <CODE>QueueSender</CODE>'s default delivery mode, priority, and time
* to live. <p/>
* <P>
* Typically, a message producer is assigned a queue at creation time;
* however, the JMS API also supports unidentified message producers, which
@ -104,8 +100,8 @@ public class ActiveMQQueueSender extends ActiveMQMessageProducer implements Queu
*
* @param queue the queue to send this message to
* @param message the message to send
* @throws JMSException if the JMS provider fails to send the message due to some
* internal error.
* @throws JMSException if the JMS provider fails to send the message due to
* some internal error.
* @see javax.jms.MessageProducer#getDeliveryMode()
* @see javax.jms.MessageProducer#getTimeToLive()
* @see javax.jms.MessageProducer#getPriority()
@ -117,8 +113,7 @@ public class ActiveMQQueueSender extends ActiveMQMessageProducer implements Queu
/**
* Sends a message to a queue for an unidentified message producer,
* specifying delivery mode, priority and time to live.
* <p/>
* specifying delivery mode, priority and time to live. <p/>
* <P>
* Typically, a message producer is assigned a queue at creation time;
* however, the JMS API also supports unidentified message producers, which
@ -129,16 +124,12 @@ public class ActiveMQQueueSender extends ActiveMQMessageProducer implements Queu
* @param deliveryMode the delivery mode to use
* @param priority the priority for this message
* @param timeToLive the message's lifetime (in milliseconds)
* @throws JMSException if the JMS provider fails to send the message due to some
* internal error.
* @throws JMSException if the JMS provider fails to send the message due to
* some internal error.
*/
public void send(Queue queue, Message message, int deliveryMode, int priority, long timeToLive)
throws JMSException {
super.send(queue,
message,
deliveryMode,
priority,
timeToLive);
super.send(queue, message, deliveryMode, priority, timeToLive);
}
}

View File

@ -96,8 +96,8 @@ public class ActiveMQSessionExecutor implements Task {
Thread.currentThread().interrupt();
}
} else {
while (iterate())
;
while (iterate()) {
}
}
}
}
@ -128,10 +128,11 @@ public class ActiveMQSessionExecutor implements Task {
synchronized void start() {
if (!messageQueue.isRunning()) {
messageQueue.start();
if (hasUncomsumedMessages())
if (hasUncomsumedMessages()) {
wakeup();
}
}
}
void stop() throws JMSException {
try {

View File

@ -104,8 +104,9 @@ public class ActiveMQTopicSession implements TopicSession {
* @throws JMSException
*/
public MessageConsumer createConsumer(Destination destination) throws JMSException {
if (destination instanceof Queue)
if (destination instanceof Queue) {
throw new InvalidDestinationException("Queues are not supported by a TopicSession");
}
return next.createConsumer(destination);
}
@ -116,8 +117,9 @@ public class ActiveMQTopicSession implements TopicSession {
* @throws JMSException
*/
public MessageConsumer createConsumer(Destination destination, String messageSelector) throws JMSException {
if (destination instanceof Queue)
if (destination instanceof Queue) {
throw new InvalidDestinationException("Queues are not supported by a TopicSession");
}
return next.createConsumer(destination, messageSelector);
}
@ -129,8 +131,9 @@ public class ActiveMQTopicSession implements TopicSession {
* @throws JMSException
*/
public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean NoLocal) throws JMSException {
if (destination instanceof Queue)
if (destination instanceof Queue) {
throw new InvalidDestinationException("Queues are not supported by a TopicSession");
}
return next.createConsumer(destination, messageSelector, NoLocal);
}
@ -195,8 +198,9 @@ public class ActiveMQTopicSession implements TopicSession {
* @throws JMSException
*/
public MessageProducer createProducer(Destination destination) throws JMSException {
if (destination instanceof Queue)
if (destination instanceof Queue) {
throw new InvalidDestinationException("Queues are not supported by a TopicSession");
}
return next.createProducer(destination);
}

View File

@ -20,8 +20,8 @@ import javax.jms.JMSException;
/**
* Provides a uniform interface that can be used to close all the JMS obejcts
* that provide a close() method. Useful for when you want to collect
* a heterogeous set of JMS object in a collection to be closed at a later time.
* that provide a close() method. Useful for when you want to collect a
* heterogeous set of JMS object in a collection to be closed at a later time.
*
* @version $Revision: 1.2 $
*/
@ -30,7 +30,8 @@ public interface Closeable {
/**
* Closes a JMS object.
* <P>
* Many JMS objects are closeable such as Connections, Sessions, Consumers and Producers.
* Many JMS objects are closeable such as Connections, Sessions, Consumers
* and Producers.
*
* @throws JMSException if the JMS provider fails to close the object due to
* some internal error.

View File

@ -27,26 +27,30 @@ import javax.jms.JMSException;
import javax.jms.Topic;
/**
* The StreamConnection interface allows you to send and receive
* data from a Destination in using standard java InputStream and OutputStream
* objects. It's best use case is to send and receive large amounts of data
* that would be to large to hold in a single JMS message.
* The StreamConnection interface allows you to send and receive data from a
* Destination in using standard java InputStream and OutputStream objects. It's
* best use case is to send and receive large amounts of data that would be to
* large to hold in a single JMS message.
*
* @version $Revision$
*/
public interface StreamConnection extends Connection {
public InputStream createInputStream(Destination dest) throws JMSException;
public InputStream createInputStream(Destination dest, String messageSelector) throws JMSException;
public InputStream createInputStream(Destination dest, String messageSelector, boolean noLocal) throws JMSException;
public InputStream createDurableInputStream(Topic dest, String name) throws JMSException;
public InputStream createDurableInputStream(Topic dest, String name, String messageSelector) throws JMSException;
public InputStream createDurableInputStream(Topic dest, String name, String messageSelector, boolean noLocal) throws JMSException;
public OutputStream createOutputStream(Destination dest) throws JMSException;
public OutputStream createOutputStream(Destination dest, Map streamProperties, int deliveryMode,
int priority, long timeToLive) throws JMSException;
public OutputStream createOutputStream(Destination dest, Map streamProperties, int deliveryMode, int priority, long timeToLive) throws JMSException;
/**
* Unsubscribes a durable subscription that has been created by a client.
@ -55,17 +59,16 @@ public interface StreamConnection extends Connection {
* subscriber by its provider.
* <P>
* It is erroneous for a client to delete a durable subscription while there
* is an active <CODE>MessageConsumer </CODE> or <CODE>TopicSubscriber</CODE>
* for the subscription, or while a consumed message is part of a pending
* transaction or has not been acknowledged in the session.
* is an active <CODE>MessageConsumer </CODE> or
* <CODE>TopicSubscriber</CODE> for the subscription, or while a consumed
* message is part of a pending transaction or has not been acknowledged in
* the session.
*
* @param name
* the name used to identify this subscription
* @throws JMSException
* if the session fails to unsubscribe to the durable
* @param name the name used to identify this subscription
* @throws JMSException if the session fails to unsubscribe to the durable
* subscription due to some internal error.
* @throws InvalidDestinationException
* if an invalid subscription name is specified.
* @throws InvalidDestinationException if an invalid subscription name is
* specified.
* @since 1.1
*/
public void unsubscribe(String name) throws JMSException;

View File

@ -50,18 +50,20 @@ public class AdvisorySupport {
}
public static ActiveMQTopic getConsumerAdvisoryTopic(ActiveMQDestination destination) {
if (destination.isQueue())
if (destination.isQueue()) {
return new ActiveMQTopic(QUEUE_CONSUMER_ADVISORY_TOPIC_PREFIX + destination.getPhysicalName());
else
} else {
return new ActiveMQTopic(TOPIC_CONSUMER_ADVISORY_TOPIC_PREFIX + destination.getPhysicalName());
}
}
public static ActiveMQTopic getProducerAdvisoryTopic(ActiveMQDestination destination) {
if (destination.isQueue())
if (destination.isQueue()) {
return new ActiveMQTopic(QUEUE_PRODUCER_ADVISORY_TOPIC_PREFIX + destination.getPhysicalName());
else
} else {
return new ActiveMQTopic(TOPIC_PRODUCER_ADVISORY_TOPIC_PREFIX + destination.getPhysicalName());
}
}
public static ActiveMQTopic getExpiredMessageTopic(ActiveMQDestination destination) {
if (destination.isQueue()) {

View File

@ -30,8 +30,8 @@ import javax.jms.JMSException;
import org.apache.activemq.command.ActiveMQBlobMessage;
/**
* A default implementation of {@link BlobUploadStrategy} which uses the URL class to upload
* files or streams to a remote URL
* A default implementation of {@link BlobUploadStrategy} which uses the URL
* class to upload files or streams to a remote URL
*/
public class DefaultBlobUploadStrategy implements BlobUploadStrategy {
private BlobTransferPolicy transferPolicy;
@ -51,7 +51,8 @@ public class DefaultBlobUploadStrategy implements BlobUploadStrategy {
connection.setRequestMethod("PUT");
connection.setDoOutput(true);
// use chunked mode or otherwise URLConnection loads everything into memory
// use chunked mode or otherwise URLConnection loads everything into
// memory
// (chunked mode not supported before JRE 1.5)
connection.setChunkedStreamingMode(transferPolicy.getBufferSize());
@ -66,8 +67,8 @@ public class DefaultBlobUploadStrategy implements BlobUploadStrategy {
fis.close();
if (!isSuccessfulCode(connection.getResponseCode())) {
throw new IOException("PUT was not successful: "
+ connection.getResponseCode() + " " + connection.getResponseMessage());
throw new IOException("PUT was not successful: " + connection.getResponseCode() + " "
+ connection.getResponseMessage());
}
return url;
@ -82,8 +83,8 @@ public class DefaultBlobUploadStrategy implements BlobUploadStrategy {
connection.disconnect();
if (!isSuccessfulCode(connection.getResponseCode())) {
throw new IOException("DELETE was not successful: "
+ connection.getResponseCode() + " " + connection.getResponseMessage());
throw new IOException("DELETE was not successful: " + connection.getResponseCode() + " "
+ connection.getResponseMessage());
}
}

View File

@ -23,15 +23,16 @@ import org.apache.activemq.util.FactoryFinder;
import org.apache.activemq.util.IOExceptionSupport;
/**
* A helper class to create a fully configured broker service using a URI.
* The list of currently supported URI syntaxes is described
* <a href="http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html">here</a>
* A helper class to create a fully configured broker service using a URI. The
* list of currently supported URI syntaxes is described <a
* href="http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html">here</a>
*
* @version $Revision$
*/
public class BrokerFactory {
static final private FactoryFinder brokerFactoryHandlerFinder = new FactoryFinder("META-INF/services/org/apache/activemq/broker/");
static final private FactoryFinder brokerFactoryHandlerFinder = new FactoryFinder(
"META-INF/services/org/apache/activemq/broker/");
public static BrokerFactoryHandler createBrokerFactoryHandler(String type) throws IOException {
try {
@ -43,6 +44,7 @@ public class BrokerFactory {
/**
* Creates a broker from a URI configuration
*
* @param brokerURI the URI scheme to configure the broker
* @throws Exception
*/
@ -52,14 +54,17 @@ public class BrokerFactory {
/**
* Creates a broker from a URI configuration
*
* @param brokerURI the URI scheme to configure the broker
* @param startBroker whether or not the broker should have its {@link BrokerService#start()} method called after construction
* @param startBroker whether or not the broker should have its
* {@link BrokerService#start()} method called after
* construction
* @throws Exception
*/
public static BrokerService createBroker(URI brokerURI, boolean startBroker) throws Exception {
if( brokerURI.getScheme() == null )
if (brokerURI.getScheme() == null) {
throw new IllegalArgumentException("Invalid broker URI, no scheme specified: " + brokerURI);
}
BrokerFactoryHandler handler = createBrokerFactoryHandler(brokerURI.getScheme());
BrokerService broker = handler.createBroker(brokerURI);
if (startBroker) {
@ -68,9 +73,9 @@ public class BrokerFactory {
return broker;
}
/**
* Creates a broker from a URI configuration
*
* @param brokerURI the URI scheme to configure the broker
* @throws Exception
*/
@ -78,16 +83,17 @@ public class BrokerFactory {
return createBroker(new URI(brokerURI));
}
/**
* Creates a broker from a URI configuration
*
* @param brokerURI the URI scheme to configure the broker
* @param startBroker whether or not the broker should have its {@link BrokerService#start()} method called after construction
* @param startBroker whether or not the broker should have its
* {@link BrokerService#start()} method called after
* construction
* @throws Exception
*/
public static BrokerService createBroker(String brokerURI, boolean startBroker) throws Exception {
return createBroker(new URI(brokerURI), startBroker);
}
}

View File

@ -17,7 +17,8 @@
package org.apache.activemq.broker;
/**
* This exception is thrown by the broker when you try to use it after it has been stopped.
* This exception is thrown by the broker when you try to use it after it has
* been stopped.
*
* @author chirino
*/

View File

@ -24,7 +24,6 @@ import org.apache.activemq.command.Command;
import org.apache.activemq.command.Response;
/**
*
* @version $Revision: 1.5 $
*/
public interface Connection extends Service {
@ -37,8 +36,7 @@ public interface Connection extends Service {
/**
* Sends a message to the client.
*
* @param message
* the message to send to the client.
* @param message the message to send to the client.
*/
public void dispatchSync(Command message);

View File

@ -97,7 +97,8 @@ import org.apache.commons.logging.LogFactory;
public class TransportConnection implements Service, Connection, Task, CommandVisitor {
private static final Log LOG = LogFactory.getLog(TransportConnection.class);
private static final Log TRANSPORTLOG = LogFactory.getLog(TransportConnection.class.getName() + ".Transport");
private static final Log TRANSPORTLOG = LogFactory.getLog(TransportConnection.class.getName()
+ ".Transport");
private static final Log SERVICELOG = LogFactory.getLog(TransportConnection.class.getName() + ".Service");
// Keeps track of the broker and connector that created this connection.
protected final Broker broker;
@ -190,7 +191,8 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
* @param taskRunnerFactory - can be null if you want direct dispatch to the
* transport else commands are sent async.
*/
public TransportConnection(TransportConnector connector, final Transport transport, Broker broker, TaskRunnerFactory taskRunnerFactory) {
public TransportConnection(TransportConnector connector, final Transport transport, Broker broker,
TaskRunnerFactory taskRunnerFactory) {
this.connector = connector;
this.broker = broker;
RegionBroker rb = (RegionBroker)broker.getAdaptor(RegionBroker.class);
@ -270,7 +272,8 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
else if (e.getClass() == BrokerStoppedException.class) {
if (!disposed.get()) {
if (SERVICELOG.isDebugEnabled())
SERVICELOG.debug("Broker has been stopped. Notifying client and closing his connection.");
SERVICELOG
.debug("Broker has been stopped. Notifying client and closing his connection.");
ConnectionError ce = new ConnectionError();
ce.setException(e);
dispatchSync(ce);
@ -400,7 +403,8 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
}
TransactionState transactionState = cs.getTransactionState(info.getTransactionId());
if (transactionState == null)
throw new IllegalStateException("Cannot prepare a transaction that had not been started: " + info.getTransactionId());
throw new IllegalStateException("Cannot prepare a transaction that had not been started: "
+ info.getTransactionId());
// Avoid dups.
if (!transactionState.isPrepared()) {
transactionState.setPrepared(true);
@ -469,7 +473,8 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
return broker.messagePull(lookupConnectionState(pull.getConsumerId()).getContext(), pull);
}
public Response processMessageDispatchNotification(MessageDispatchNotification notification) throws Exception {
public Response processMessageDispatchNotification(MessageDispatchNotification notification)
throws Exception {
broker.processDispatchNotification(notification);
return null;
}
@ -498,7 +503,9 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
TransportConnectionState cs = lookupConnectionState(connectionId);
SessionState ss = cs.getSessionState(sessionId);
if (ss == null)
throw new IllegalStateException("Cannot add a producer to a session that had not been registered: " + sessionId);
throw new IllegalStateException(
"Cannot add a producer to a session that had not been registered: "
+ sessionId);
// Avoid replaying dup commands
if (!ss.getProducerIds().contains(info.getProducerId())) {
broker.addProducer(cs.getContext(), info);
@ -517,7 +524,9 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
TransportConnectionState cs = lookupConnectionState(connectionId);
SessionState ss = cs.getSessionState(sessionId);
if (ss == null)
throw new IllegalStateException("Cannot remove a producer from a session that had not been registered: " + sessionId);
throw new IllegalStateException(
"Cannot remove a producer from a session that had not been registered: "
+ sessionId);
ProducerState ps = ss.removeProducer(id);
if (ps == null)
throw new IllegalStateException("Cannot remove a producer that had not been registered: " + id);
@ -532,7 +541,9 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
TransportConnectionState cs = lookupConnectionState(connectionId);
SessionState ss = cs.getSessionState(sessionId);
if (ss == null)
throw new IllegalStateException("Cannot add a consumer to a session that had not been registered: " + sessionId);
throw new IllegalStateException(
"Cannot add a consumer to a session that had not been registered: "
+ sessionId);
// Avoid replaying dup commands
if (!ss.getConsumerIds().contains(info.getConsumerId())) {
broker.addConsumer(cs.getContext(), info);
@ -551,7 +562,9 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
TransportConnectionState cs = lookupConnectionState(connectionId);
SessionState ss = cs.getSessionState(sessionId);
if (ss == null)
throw new IllegalStateException("Cannot remove a consumer from a session that had not been registered: " + sessionId);
throw new IllegalStateException(
"Cannot remove a consumer from a session that had not been registered: "
+ sessionId);
ConsumerState consumerState = ss.removeConsumer(id);
if (consumerState == null)
throw new IllegalStateException("Cannot remove a consumer that had not been registered: " + id);
@ -628,7 +641,8 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
if (state.getConnection() != this) {
LOG.debug("Killing previous stale connection: " + state.getConnection().getRemoteAddress());
state.getConnection().stop();
LOG.debug("Connection " + getRemoteAddress() + " taking over previous connection: " + state.getConnection().getRemoteAddress());
LOG.debug("Connection " + getRemoteAddress() + " taking over previous connection: "
+ state.getConnection().getRemoteAddress());
state.setConnection(this);
state.reset(info);
}
@ -751,7 +765,8 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
}
protected void processDispatch(Command command) throws IOException {
final MessageDispatch messageDispatch = (MessageDispatch)(command.isMessageDispatch() ? command : null);
final MessageDispatch messageDispatch = (MessageDispatch)(command.isMessageDispatch()
? command : null);
try {
if (!disposed.get()) {
if (messageDispatch != null) {
@ -831,7 +846,8 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
transport.start();
if (taskRunnerFactory != null) {
taskRunner = taskRunnerFactory.createTaskRunner(this, "ActiveMQ Connection Dispatcher: " + getRemoteAddress());
taskRunner = taskRunnerFactory.createTaskRunner(this, "ActiveMQ Connection Dispatcher: "
+ getRemoteAddress());
} else {
taskRunner = null;
}
@ -1098,7 +1114,8 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
uri = URISupport.createURIWithQuery(uri, URISupport.createQueryString(map));
Transport localTransport = TransportFactory.connect(uri);
Transport remoteBridgeTransport = new ResponseCorrelator(transport);
duplexBridge = NetworkBridgeFactory.createBridge(config, localTransport, remoteBridgeTransport);
duplexBridge = NetworkBridgeFactory.createBridge(config, localTransport,
remoteBridgeTransport);
// now turn duplex off this side
info.setDuplexConnection(false);
duplexBridge.setCreatedByDuplex(true);
@ -1163,7 +1180,8 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
ProducerState producerState = ss.getProducerState(id);
if (producerState != null && producerState.getInfo() != null) {
ProducerInfo info = producerState.getInfo();
result.setMutable(info.getDestination() == null || info.getDestination().isComposite());
result.setMutable(info.getDestination() == null
|| info.getDestination().isComposite());
}
}
producerExchanges.put(id, result);
@ -1267,7 +1285,8 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
//
// /////////////////////////////////////////////////////////////////
protected TransportConnectionState registerConnectionState(ConnectionId connectionId, TransportConnectionState state) {
protected TransportConnectionState registerConnectionState(ConnectionId connectionId,
TransportConnectionState state) {
TransportConnectionState rc = connectionState;
connectionState = state;
return rc;
@ -1290,35 +1309,44 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
protected TransportConnectionState lookupConnectionState(String connectionId) {
TransportConnectionState cs = connectionState;
if (cs == null)
throw new IllegalStateException("Cannot lookup a connectionId for a connection that had not been registered: " + connectionId);
throw new IllegalStateException(
"Cannot lookup a connectionId for a connection that had not been registered: "
+ connectionId);
return cs;
}
protected TransportConnectionState lookupConnectionState(ConsumerId id) {
TransportConnectionState cs = connectionState;
if (cs == null)
throw new IllegalStateException("Cannot lookup a consumer from a connection that had not been registered: " + id.getParentId().getParentId());
throw new IllegalStateException(
"Cannot lookup a consumer from a connection that had not been registered: "
+ id.getParentId().getParentId());
return cs;
}
protected TransportConnectionState lookupConnectionState(ProducerId id) {
TransportConnectionState cs = connectionState;
if (cs == null)
throw new IllegalStateException("Cannot lookup a producer from a connection that had not been registered: " + id.getParentId().getParentId());
throw new IllegalStateException(
"Cannot lookup a producer from a connection that had not been registered: "
+ id.getParentId().getParentId());
return cs;
}
protected TransportConnectionState lookupConnectionState(SessionId id) {
TransportConnectionState cs = connectionState;
if (cs == null)
throw new IllegalStateException("Cannot lookup a session from a connection that had not been registered: " + id.getParentId());
throw new IllegalStateException(
"Cannot lookup a session from a connection that had not been registered: "
+ id.getParentId());
return cs;
}
protected TransportConnectionState lookupConnectionState(ConnectionId connectionId) {
TransportConnectionState cs = connectionState;
if (cs == null)
throw new IllegalStateException("Cannot lookup a connection that had not been registered: " + connectionId);
throw new IllegalStateException("Cannot lookup a connection that had not been registered: "
+ connectionId);
return cs;
}

View File

@ -64,15 +64,19 @@ public class BrokerView implements BrokerViewMBean {
public long getTotalEnqueueCount() {
return broker.getDestinationStatistics().getEnqueues().getCount();
}
public long getTotalDequeueCount() {
return broker.getDestinationStatistics().getDequeues().getCount();
}
public long getTotalConsumerCount() {
return broker.getDestinationStatistics().getConsumers().getCount();
}
public long getTotalMessageCount() {
return broker.getDestinationStatistics().getMessages().getCount();
}
public long getTotalMessagesCached() {
return broker.getDestinationStatistics().getMessagesCached().getCount();
}
@ -80,9 +84,11 @@ public class BrokerView implements BrokerViewMBean {
public int getMemoryPercentageUsed() {
return brokerService.getMemoryManager().getPercentUsage();
}
public long getMemoryLimit() {
return brokerService.getMemoryManager().getLimit();
}
public void setMemoryLimit(long limit) {
brokerService.getMemoryManager().setLimit(limit);
}
@ -103,7 +109,6 @@ public class BrokerView implements BrokerViewMBean {
return broker.getDestinationStatistics().isEnabled();
}
public void terminateJVM(int exitCode) {
System.exit(exitCode);
}
@ -157,14 +162,17 @@ public class BrokerView implements BrokerViewMBean {
}
public void removeTopic(String name) throws Exception {
broker.removeDestination(getConnectionContext(broker.getContextBroker()), new ActiveMQTopic(name), 1000);
broker.removeDestination(getConnectionContext(broker.getContextBroker()), new ActiveMQTopic(name),
1000);
}
public void removeQueue(String name) throws Exception {
broker.removeDestination(getConnectionContext(broker.getContextBroker()), new ActiveMQQueue(name), 1000);
broker.removeDestination(getConnectionContext(broker.getContextBroker()), new ActiveMQQueue(name),
1000);
}
public ObjectName createDurableSubscriber(String clientId, String subscriberName, String topicName, String selector) throws Exception {
public ObjectName createDurableSubscriber(String clientId, String subscriberName, String topicName,
String selector) throws Exception {
ConnectionContext context = new ConnectionContext();
context.setBroker(broker);
context.setClientId(clientId);
@ -195,10 +203,9 @@ public class BrokerView implements BrokerViewMBean {
broker.removeSubscription(context, info);
}
/**
* Returns the broker's administration connection context used for configuring the broker
* at startup
* Returns the broker's administration connection context used for
* configuring the broker at startup
*/
public static ConnectionContext getConnectionContext(Broker broker) {
ConnectionContext adminConnectionContext = broker.getAdminConnectionContext();
@ -210,9 +217,10 @@ public class BrokerView implements BrokerViewMBean {
}
/**
* Factory method to create the new administration connection context object.
* Note this method is here rather than inside a default broker implementation to
* ensure that the broker reference inside it is the outer most interceptor
* Factory method to create the new administration connection context
* object. Note this method is here rather than inside a default broker
* implementation to ensure that the broker reference inside it is the outer
* most interceptor
*/
protected static ConnectionContext createAdminConnectionContext(Broker broker) {
ConnectionContext context = new ConnectionContext();

View File

@ -48,7 +48,6 @@ public class ConnectionView implements ConnectionViewMBean {
return connection.isBlocked();
}
/**
* @return true if the Connection is connected
*/
@ -63,7 +62,6 @@ public class ConnectionView implements ConnectionViewMBean {
return connection.isActive();
}
/**
* Returns the number of messages to be dispatched to this connection
*/

View File

@ -49,8 +49,9 @@ public class ManagedTransportConnection extends TransportConnection {
private ObjectName byClientIdName;
private ObjectName byAddressName;
public ManagedTransportConnection(TransportConnector connector, Transport transport, Broker broker, TaskRunnerFactory factory, MBeanServer server,
ObjectName connectorName) throws IOException {
public ManagedTransportConnection(TransportConnector connector, Transport transport, Broker broker,
TaskRunnerFactory factory, MBeanServer server, ObjectName connectorName)
throws IOException {
super(connector, transport, broker, factory);
this.server = server;
this.connectorName = connectorName;
@ -110,8 +111,7 @@ public class ManagedTransportConnection extends TransportConnection {
if (name != null) {
try {
server.unregisterMBean(name);
}
catch (Throwable e) {
} catch (Throwable e) {
log.warn("Failed to unregister mbean: " + name);
log.debug("Failure reason: " + e, e);
}
@ -122,16 +122,13 @@ public class ManagedTransportConnection extends TransportConnection {
// Build the object name for the destination
Hashtable map = connectorName.getKeyPropertyList();
try {
return new ObjectName(
connectorName.getDomain()+":"+
"BrokerName="+JMXSupport.encodeObjectNamePart((String) map.get("BrokerName"))+","+
"Type=Connection,"+
"ConnectorName="+JMXSupport.encodeObjectNamePart((String) map.get("ConnectorName"))+","+
"ViewType="+JMXSupport.encodeObjectNamePart(type)+","+
"Name="+JMXSupport.encodeObjectNamePart(value)
);
}
catch (Throwable e) {
return new ObjectName(connectorName.getDomain() + ":" + "BrokerName="
+ JMXSupport.encodeObjectNamePart((String)map.get("BrokerName")) + ","
+ "Type=Connection," + "ConnectorName="
+ JMXSupport.encodeObjectNamePart((String)map.get("ConnectorName")) + ","
+ "ViewType=" + JMXSupport.encodeObjectNamePart(type) + "," + "Name="
+ JMXSupport.encodeObjectNamePart(value));
} catch (Throwable e) {
throw IOExceptionSupport.create(e);
}
}
@ -140,18 +137,14 @@ public class ManagedTransportConnection extends TransportConnection {
// Build the object name for the destination
Hashtable map = connectorName.getKeyPropertyList();
try {
return new ObjectName(
connectorName.getDomain()+":"+
"BrokerName="+JMXSupport.encodeObjectNamePart((String) map.get("BrokerName"))+","+
"Type=Connection,"+
"ConnectorName="+JMXSupport.encodeObjectNamePart((String) map.get("ConnectorName"))+","+
"Connection="+JMXSupport.encodeObjectNamePart(value)
);
}
catch (Throwable e) {
return new ObjectName(connectorName.getDomain() + ":" + "BrokerName="
+ JMXSupport.encodeObjectNamePart((String)map.get("BrokerName")) + ","
+ "Type=Connection," + "ConnectorName="
+ JMXSupport.encodeObjectNamePart((String)map.get("ConnectorName")) + ","
+ "Connection=" + JMXSupport.encodeObjectNamePart(value));
} catch (Throwable e) {
throw IOExceptionSupport.create(e);
}
}
}

View File

@ -21,23 +21,41 @@ import org.apache.activemq.Service;
public interface NetworkConnectorViewMBean extends Service {
public String getName();
public int getNetworkTTL();
public int getPrefetchSize();
public String getUserName();
public boolean isBridgeTempDestinations();
public boolean isConduitSubscriptions();
public boolean isDecreaseNetworkConsumerPriority();
public boolean isDispatchAsync();
public boolean isDynamicOnly();
public void setBridgeTempDestinations(boolean bridgeTempDestinations);
public void setConduitSubscriptions(boolean conduitSubscriptions);
public void setDispatchAsync(boolean dispatchAsync);
public void setDynamicOnly(boolean dynamicOnly);
public void setNetworkTTL(int networkTTL);
public void setPassword(String password);
public void setPrefetchSize(int prefetchSize);
public void setUserName(String userName);
public String getPassword();
public void setDecreaseNetworkConsumerPriority(boolean decreaseNetworkConsumerPriority);
}

View File

@ -22,20 +22,17 @@ import org.apache.activemq.command.ConsumerInfo;
import javax.jms.InvalidSelectorException;
/**
* @version $Revision: 1.5 $
*/
public class SubscriptionView implements SubscriptionViewMBean {
protected final Subscription subscription;
protected final String clientId;
/**
* Constructor
*
* @param subs
*/
public SubscriptionView(String clientId, Subscription subs) {
@ -105,8 +102,7 @@ public class SubscriptionView implements SubscriptionViewMBean {
public void setSelector(String selector) throws InvalidSelectorException, UnsupportedOperationException {
if (subscription != null) {
subscription.setSelector(selector);
}
else {
} else {
throw new UnsupportedOperationException("No subscription object");
}
}
@ -155,8 +151,8 @@ public class SubscriptionView implements SubscriptionViewMBean {
}
/**
* The subscription should release as may references as it can to help the garbage collector
* reclaim memory.
* The subscription should release as may references as it can to help the
* garbage collector reclaim memory.
*/
public void gc() {
if (subscription != null) {
@ -180,7 +176,6 @@ public class SubscriptionView implements SubscriptionViewMBean {
return info != null ? info.isExclusive() : false;
}
/**
* @return whether or not the subscriber is durable (persistent)
*/
@ -197,10 +192,11 @@ public class SubscriptionView implements SubscriptionViewMBean {
return info != null ? info.isNoLocal() : false;
}
/**
* @return the maximum number of pending messages allowed in addition to the prefetch size. If enabled
* to a non-zero value then this will perform eviction of messages for slow consumers on non-durable topics.
* @return the maximum number of pending messages allowed in addition to the
* prefetch size. If enabled to a non-zero value then this will
* perform eviction of messages for slow consumers on non-durable
* topics.
*/
public int getMaximumPendingMessageLimit() {
ConsumerInfo info = getConsumerInfo();
@ -216,7 +212,8 @@ public class SubscriptionView implements SubscriptionViewMBean {
}
/**
* @return the name of the consumer which is only used for durable consumers.
* @return the name of the consumer which is only used for durable
* consumers.
*/
public String getSubcriptionName() {
ConsumerInfo info = getConsumerInfo();

View File

@ -27,32 +27,37 @@ import org.apache.activemq.command.Message;
import org.apache.activemq.command.MessageAck;
import org.apache.activemq.memory.UsageManager;
import org.apache.activemq.store.MessageStore;
import org.apache.activemq.store.TopicMessageStore;
/**
*
* @version $Revision: 1.12 $
*/
public interface Destination extends Service {
void addSubscription(ConnectionContext context, Subscription sub) throws Exception;
void removeSubscription(ConnectionContext context, Subscription sub) throws Exception;
void send(ProducerBrokerExchange producerExchange, Message messageSend) throws Exception;
boolean lock(MessageReference node, LockOwner lockOwner);
void acknowledge(ConnectionContext context, Subscription sub, final MessageAck ack, final MessageReference node) throws IOException;
void gc();
ActiveMQDestination getActiveMQDestination();
UsageManager getUsageManager();
void dispose(ConnectionContext context) throws IOException;
DestinationStatistics getDestinationStatistics();
DeadLetterStrategy getDeadLetterStrategy();
public Message[] browse();
public String getName();
public MessageStore getMessageStore();
}

View File

@ -16,6 +16,10 @@
*/
package org.apache.activemq.broker.region;
import java.io.IOException;
import java.util.Iterator;
import java.util.Set;
import org.apache.activemq.broker.Broker;
import org.apache.activemq.broker.ConnectionContext;
import org.apache.activemq.broker.ProducerBrokerExchange;
@ -26,10 +30,6 @@ import org.apache.activemq.command.MessageAck;
import org.apache.activemq.memory.UsageManager;
import org.apache.activemq.store.MessageStore;
import java.io.IOException;
import java.util.Iterator;
import java.util.Set;
/**
*
* @version $Revision$
@ -42,7 +42,8 @@ public class DestinationFilter implements Destination {
this.next = next;
}
public void acknowledge(ConnectionContext context, Subscription sub, MessageAck ack, MessageReference node) throws IOException {
public void acknowledge(ConnectionContext context, Subscription sub, MessageAck ack, MessageReference node)
throws IOException {
next.acknowledge(context, sub, ack, node);
}
@ -105,7 +106,8 @@ public class DestinationFilter implements Destination {
/**
* Sends a message to the given destination which may be a wildcard
*/
protected void send(ProducerBrokerExchange context, Message message, ActiveMQDestination destination) throws Exception {
protected void send(ProducerBrokerExchange context, Message message, ActiveMQDestination destination)
throws Exception {
Broker broker = context.getConnectionContext().getBroker();
Set destinations = broker.getDestinations(destination);

View File

@ -26,8 +26,7 @@ import org.apache.activemq.command.MessageId;
/**
* Only used by the {@link QueueMessageReference#NULL_MESSAGE}
*/
final class NullMessageReference implements
QueueMessageReference {
final class NullMessageReference implements QueueMessageReference {
private ActiveMQMessage message = new ActiveMQMessage();
private volatile int references;

View File

@ -30,7 +30,8 @@ public class QueueBrowserSubscription extends QueueSubscription {
boolean browseDone;
public QueueBrowserSubscription(Broker broker,ConnectionContext context, ConsumerInfo info) throws InvalidSelectorException {
public QueueBrowserSubscription(Broker broker, ConnectionContext context, ConsumerInfo info)
throws InvalidSelectorException {
super(broker, context, info);
}
@ -39,13 +40,9 @@ public class QueueBrowserSubscription extends QueueSubscription {
}
public synchronized String toString() {
return
"QueueBrowserSubscription:" +
" consumer="+info.getConsumerId()+
", destinations="+destinations.size()+
", dispatched="+dispatched.size()+
", delivered="+this.prefetchExtension+
", pending="+getPendingQueueSize();
return "QueueBrowserSubscription:" + " consumer=" + info.getConsumerId() + ", destinations="
+ destinations.size() + ", dispatched=" + dispatched.size() + ", delivered="
+ this.prefetchExtension + ", pending=" + getPendingQueueSize();
}
public void browseDone() throws Exception {
@ -60,7 +57,8 @@ public class QueueBrowserSubscription extends QueueSubscription {
/**
* Since we are a browser we don't really remove the message from the queue.
*/
protected void acknowledge(ConnectionContext context, final MessageAck ack, final MessageReference n) throws IOException {
protected void acknowledge(ConnectionContext context, final MessageAck ack, final MessageReference n)
throws IOException {
}
}

View File

@ -33,23 +33,22 @@ import java.util.Set;
*/
public class QueueRegion extends AbstractRegion {
public QueueRegion(RegionBroker broker,DestinationStatistics destinationStatistics, UsageManager memoryManager, TaskRunnerFactory taskRunnerFactory,
public QueueRegion(RegionBroker broker, DestinationStatistics destinationStatistics,
UsageManager memoryManager, TaskRunnerFactory taskRunnerFactory,
DestinationFactory destinationFactory) {
super(broker, destinationStatistics, memoryManager, taskRunnerFactory, destinationFactory);
}
public String toString() {
return "QueueRegion: destinations=" + destinations.size() + ", subscriptions=" + subscriptions.size() + ", memory=" + memoryManager.getPercentUsage()
+ "%";
return "QueueRegion: destinations=" + destinations.size() + ", subscriptions=" + subscriptions.size()
+ ", memory=" + memoryManager.getPercentUsage() + "%";
}
protected Subscription createSubscription(ConnectionContext context, ConsumerInfo info) throws InvalidSelectorException {
protected Subscription createSubscription(ConnectionContext context, ConsumerInfo info)
throws InvalidSelectorException {
if (info.isBrowser()) {
return new QueueBrowserSubscription(broker, context, info);
}
else {
} else {
return new QueueSubscription(broker, context, info);
}
}

View File

@ -60,12 +60,12 @@ import org.apache.commons.logging.LogFactory;
* @version $Revision: 1.21 $
*/
public class Topic implements Destination {
private static final Log log = LogFactory.getLog(Topic.class);
private static final Log LOG = LogFactory.getLog(Topic.class);
protected final ActiveMQDestination destination;
protected final CopyOnWriteArrayList consumers = new CopyOnWriteArrayList();
protected final Valve dispatchValve = new Valve(true);
protected final TopicMessageStore store;// this could be NULL! (If an
// advsiory)
// this could be NULL! (If an advisory)
protected final TopicMessageStore store;
protected final UsageManager usageManager;
protected final DestinationStatistics destinationStatistics = new DestinationStatistics();
@ -349,8 +349,8 @@ public class Topic implements Destination {
// The usage manager could have delayed us by the time
// we unblock the message could have expired..
if (message.isExpired()) {
if (log.isDebugEnabled()) {
log.debug("Expired message: " + message);
if (LOG.isDebugEnabled()) {
LOG.debug("Expired message: " + message);
}
return;
}
@ -468,7 +468,7 @@ public class Topic implements Destination {
}
}
} catch (Throwable e) {
log.warn("Failed to browse Topic: " + getActiveMQDestination().getPhysicalName(), e);
LOG.warn("Failed to browse Topic: " + getActiveMQDestination().getPhysicalName(), e);
}
return (Message[])result.toArray(new Message[result.size()]);
}

View File

@ -19,11 +19,11 @@ import org.apache.activemq.broker.region.cursors.FilePendingMessageCursor;
import org.apache.activemq.broker.region.cursors.PendingMessageCursor;
import org.apache.activemq.kaha.Store;
/**
* Creates a FilePendingMessageCursor
* *
* @org.apache.xbean.XBean element="fileQueueCursor" description="Pending messages paged in from file"
* Creates a FilePendingMessageCursor *
*
* @org.apache.xbean.XBean element="fileQueueCursor" description="Pending
* messages paged in from file"
*
* @version $Revision$
*/
@ -33,11 +33,11 @@ public class FilePendingQueueMessageStoragePolicy implements PendingQueueMessage
* @param queue
* @param tmpStore
* @return the cursor
* @see org.apache.activemq.broker.region.policy.PendingQueueMessageStoragePolicy#getQueuePendingMessageCursor(org.apache.openjpa.lib.util.concurrent.Queue, org.apache.activemq.kaha.Store)
* @see org.apache.activemq.broker.region.policy.PendingQueueMessageStoragePolicy#getQueuePendingMessageCursor(org.apache.openjpa.lib.util.concurrent.Queue,
* org.apache.activemq.kaha.Store)
*/
public PendingMessageCursor getQueuePendingMessageCursor(Queue queue, Store tmpStore) {
return new FilePendingMessageCursor("PendingCursor:" + queue.getName(), tmpStore);
}
}

View File

@ -17,12 +17,11 @@ import org.apache.activemq.broker.region.cursors.FilePendingMessageCursor;
import org.apache.activemq.broker.region.cursors.PendingMessageCursor;
import org.apache.activemq.kaha.Store;
/**
* Creates a PendIngMessageCursor for Durable subscribers
* *
* @org.apache.xbean.XBean element="fileCursor" description="Pending messages for durable subscribers
* held in temporary files"
* Creates a PendIngMessageCursor for Durable subscribers *
*
* @org.apache.xbean.XBean element="fileCursor" description="Pending messages
* for durable subscribers held in temporary files"
*
* @version $Revision$
*/
@ -33,9 +32,11 @@ public class FilePendingSubscriberMessageStoragePolicy implements PendingSubscri
* @param tmpStorage
* @param maxBatchSize
* @return a Cursor
* @see org.apache.activemq.broker.region.policy.PendingSubscriberMessageStoragePolicy#getSubscriberPendingMessageCursor(java.lang.String, org.apache.activemq.kaha.Store, int)
* @see org.apache.activemq.broker.region.policy.PendingSubscriberMessageStoragePolicy#getSubscriberPendingMessageCursor(java.lang.String,
* org.apache.activemq.kaha.Store, int)
*/
public PendingMessageCursor getSubscriberPendingMessageCursor(String name,Store tmpStorage,int maxBatchSize){
public PendingMessageCursor getSubscriberPendingMessageCursor(String name, Store tmpStorage,
int maxBatchSize) {
return new FilePendingMessageCursor("PendingCursor:" + name, tmpStorage);
}
}

View File

@ -19,11 +19,11 @@ import org.apache.activemq.broker.region.cursors.PendingMessageCursor;
import org.apache.activemq.broker.region.cursors.StoreQueueCursor;
import org.apache.activemq.kaha.Store;
/**
* Creates a StoreQueueCursor
* *
* @org.apache.xbean.XBean element="storeCursor" description="Pending messages paged in from the Store"
* Creates a StoreQueueCursor *
*
* @org.apache.xbean.XBean element="storeCursor" description="Pending messages
* paged in from the Store"
*
* @version $Revision$
*/
@ -33,11 +33,11 @@ public class StorePendingQueueMessageStoragePolicy implements PendingQueueMessag
* @param queue
* @param tmpStore
* @return the cursor
* @see org.apache.activemq.broker.region.policy.PendingQueueMessageStoragePolicy#getQueuePendingMessageCursor(org.apache.openjpa.lib.util.concurrent.Queue, org.apache.activemq.kaha.Store)
* @see org.apache.activemq.broker.region.policy.PendingQueueMessageStoragePolicy#getQueuePendingMessageCursor(org.apache.openjpa.lib.util.concurrent.Queue,
* org.apache.activemq.kaha.Store)
*/
public PendingMessageCursor getQueuePendingMessageCursor(Queue queue, Store tmpStore) {
return new StoreQueueCursor(queue, tmpStore);
}
}

View File

@ -20,9 +20,10 @@ import org.apache.activemq.broker.region.cursors.VMPendingMessageCursor;
import org.apache.activemq.kaha.Store;
/**
* Creates a VMPendingMessageCursor
* *
* @org.apache.xbean.XBean element="vmQueueCursor" description="Pending messages held in the JVM"
* Creates a VMPendingMessageCursor *
*
* @org.apache.xbean.XBean element="vmQueueCursor" description="Pending messages
* held in the JVM"
*
* @version $Revision$
*/

View File

@ -17,11 +17,11 @@ import org.apache.activemq.broker.region.cursors.PendingMessageCursor;
import org.apache.activemq.broker.region.cursors.VMPendingMessageCursor;
import org.apache.activemq.kaha.Store;
/**
* Creates a VMPendingMessageCursor
* *
* @org.apache.xbean.XBean element="vmCursor" description="Pending messages held in the JVM"
* Creates a VMPendingMessageCursor *
*
* @org.apache.xbean.XBean element="vmCursor" description="Pending messages held
* in the JVM"
*
* @version $Revision$
*/
@ -32,9 +32,11 @@ public class VMPendingSubscriberMessageStoragePolicy implements PendingSubscribe
* @param tmpStorage
* @param maxBatchSize
* @return a Cursor
* @see org.apache.activemq.broker.region.policy.PendingSubscriberMessageStoragePolicy#getSubscriberPendingMessageCursor(java.lang.String, org.apache.activemq.kaha.Store, int)
* @see org.apache.activemq.broker.region.policy.PendingSubscriberMessageStoragePolicy#getSubscriberPendingMessageCursor(java.lang.String,
* org.apache.activemq.kaha.Store, int)
*/
public PendingMessageCursor getSubscriberPendingMessageCursor(String name,Store tmpStorage,int maxBatchSize){
public PendingMessageCursor getSubscriberPendingMessageCursor(String name, Store tmpStorage,
int maxBatchSize) {
return new VMPendingMessageCursor();
}
}

View File

@ -23,7 +23,8 @@ import java.net.URI;
import java.net.URISyntaxException;
/**
* A Broker interceptor which allows you to trace all operations to a Multicast socket.
* A Broker interceptor which allows you to trace all operations to a Multicast
* socket.
*
* @org.apache.xbean.XBean
*

View File

@ -20,16 +20,15 @@ import org.apache.activemq.broker.BrokerPluginSupport;
import org.apache.activemq.broker.ProducerBrokerExchange;
import org.apache.activemq.command.Message;
/**
* A Broker interceptor which updates a JMS Client's timestamp on the message
* with a broker timestamp. Useful when the clocks on client machines are known to
* not be correct and you can only trust the time set on the broker machines.
* with a broker timestamp. Useful when the clocks on client machines are known
* to not be correct and you can only trust the time set on the broker machines.
*
* Enabling this plugin will break JMS compliance since the timestamp that the producer
* sees on the messages after as send() will be different from the timestamp the consumer
* will observe when he receives the message. This plugin is not enabled in the default
* ActiveMQ configuration.
* Enabling this plugin will break JMS compliance since the timestamp that the
* producer sees on the messages after as send() will be different from the
* timestamp the consumer will observe when he receives the message. This plugin
* is not enabled in the default ActiveMQ configuration.
*
* @org.apache.xbean.XBean element="timeStampingBrokerPlugin"
*
@ -37,7 +36,8 @@ import org.apache.activemq.command.Message;
*/
public class TimeStampingBrokerPlugin extends BrokerPluginSupport {
public void send(ProducerBrokerExchange producerExchange, Message message) throws Exception {
if (message.getTimestamp() > 0 && (message.getBrokerPath() == null || message.getBrokerPath().length == 0)) {
if (message.getTimestamp() > 0
&& (message.getBrokerPath() == null || message.getBrokerPath().length == 0)) {
// timestamp not been disabled and has not passed through a network
message.setTimestamp(System.currentTimeMillis());
}

View File

@ -16,6 +16,10 @@
*/
package org.apache.activemq.broker.view;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Iterator;
import org.apache.activemq.broker.Broker;
import org.apache.activemq.broker.ConnectionContext;
import org.apache.activemq.broker.region.Destination;
@ -23,12 +27,7 @@ import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.filter.DestinationMap;
import org.apache.activemq.filter.DestinationMapNode;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Iterator;
/**
*
* @version $Revision: $
*/
public class DestinationDotFileInterceptor extends DotFileInterceptorSupport {
@ -45,13 +44,11 @@ public class DestinationDotFileInterceptor extends DotFileInterceptorSupport {
return answer;
}
public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout)
throws Exception {
public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception {
super.removeDestination(context, destination, timeout);
generateFile();
}
protected void generateFile(PrintWriter writer) throws Exception {
ActiveMQDestination[] destinations = getDestinations();
@ -106,8 +103,7 @@ public class DestinationDotFileInterceptor extends DotFileInterceptorSupport {
String label = path;
if (prefix.equals("topic")) {
label = "Topics";
}
else if (prefix.equals("queue")) {
} else if (prefix.equals("queue")) {
label = "Queues";
}
writer.print("[ label = \"");
@ -143,7 +139,6 @@ public class DestinationDotFileInterceptor extends DotFileInterceptorSupport {
}
}
protected String getPath(DestinationMapNode node) {
String path = node.getPath();
if (path.equals("*")) {

View File

@ -16,17 +16,17 @@
*/
package org.apache.activemq.camel;
import org.apache.activemq.ActiveMQSession;
import org.apache.camel.Endpoint;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Queue;
import javax.jms.QueueSender;
import org.apache.activemq.ActiveMQSession;
import org.apache.camel.Endpoint;
/**
* A JMS {@link javax.jms.QueueSender} which sends message exchanges to a
* Camel {@link org.apache.camel.Endpoint}
* A JMS {@link javax.jms.QueueSender} which sends message exchanges to a Camel
* {@link org.apache.camel.Endpoint}
*
* @version $Revision: $
*/
@ -36,7 +36,6 @@ public class CamelQueueSender extends CamelMessageProducer implements QueueSende
super(destination, endpoint, session);
}
/**
* Gets the queue associated with this <CODE>QueueSender</CODE>.
*
@ -50,19 +49,17 @@ public class CamelQueueSender extends CamelMessageProducer implements QueueSende
}
/**
* Sends a message to a queue for an unidentified message producer. Uses
* the <CODE>QueueSender</CODE>'s default delivery mode, priority, and
* time to live.
* <p/>
* <p/>
* Typically, a message producer is assigned a queue at creation time;
* however, the JMS API also supports unidentified message producers, which
* require that the queue be supplied every time a message is sent.
* Sends a message to a queue for an unidentified message producer. Uses the
* <CODE>QueueSender</CODE>'s default delivery mode, priority, and time
* to live. <p/> <p/> Typically, a message producer is assigned a queue at
* creation time; however, the JMS API also supports unidentified message
* producers, which require that the queue be supplied every time a message
* is sent.
*
* @param queue the queue to send this message to
* @param message the message to send
* @throws JMSException if the JMS provider fails to send the message due to some
* internal error.
* @throws JMSException if the JMS provider fails to send the message due to
* some internal error.
* @see javax.jms.MessageProducer#getDeliveryMode()
* @see javax.jms.MessageProducer#getTimeToLive()
* @see javax.jms.MessageProducer#getPriority()
@ -74,28 +71,21 @@ public class CamelQueueSender extends CamelMessageProducer implements QueueSende
/**
* Sends a message to a queue for an unidentified message producer,
* specifying delivery mode, priority and time to live.
* <p/>
* <p/>
* Typically, a message producer is assigned a queue at creation time;
* however, the JMS API also supports unidentified message producers, which
* require that the queue be supplied every time a message is sent.
* specifying delivery mode, priority and time to live. <p/> <p/> Typically,
* a message producer is assigned a queue at creation time; however, the JMS
* API also supports unidentified message producers, which require that the
* queue be supplied every time a message is sent.
*
* @param queue the queue to send this message to
* @param message the message to send
* @param deliveryMode the delivery mode to use
* @param priority the priority for this message
* @param timeToLive the message's lifetime (in milliseconds)
* @throws JMSException if the JMS provider fails to send the message due to some
* internal error.
* @throws JMSException if the JMS provider fails to send the message due to
* some internal error.
*/
public void send(Queue queue, Message message, int deliveryMode, int priority, long timeToLive)
throws JMSException {
super.send(queue,
message,
deliveryMode,
priority,
timeToLive);
public void send(Queue queue, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException {
super.send(queue, message, deliveryMode, priority, timeToLive);
}
}

View File

@ -41,7 +41,8 @@ import java.util.StringTokenizer;
* @openwire:marshaller
* @version $Revision: 1.10 $
*/
abstract public class ActiveMQDestination extends JNDIBaseStorable implements DataStructure, Destination, Externalizable, Comparable {
abstract public class ActiveMQDestination extends JNDIBaseStorable implements DataStructure, Destination,
Externalizable, Comparable {
private static final long serialVersionUID = -3885260014960795889L;
@ -196,7 +197,8 @@ abstract public class ActiveMQDestination extends JNDIBaseStorable implements Da
public void setPhysicalName(String physicalName) {
final int len = physicalName.length();
int p = -1;// options offset
// options offset
int p = -1;
boolean composite = false;
for (int i = 0; i < len; i++) {
char c = physicalName.charAt(i);
@ -219,7 +221,8 @@ abstract public class ActiveMQDestination extends JNDIBaseStorable implements Da
try {
options = URISupport.parseQuery(optstring);
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Invalid destination name: " + physicalName + ", it's options are not encoded properly: " + e);
throw new IllegalArgumentException("Invalid destination name: " + physicalName
+ ", it's options are not encoded properly: " + e);
}
}
this.physicalName = physicalName;

View File

@ -42,32 +42,50 @@ import org.apache.activemq.util.MarshallingSupport;
import org.apache.activemq.wireformat.WireFormat;
/**
* A <CODE>MapMessage</CODE> object is used to send a set of name-value pairs. The names are <CODE>String</CODE>
* objects, and the values are primitive data types in the Java programming language. The names must have a value that
* is not null, and not an empty string. The entries can be accessed sequentially or randomly by name. The order of the
* entries is undefined. <CODE>MapMessage</CODE> inherits from the <CODE>Message</CODE> interface and adds a message
* body that contains a Map. <P> The primitive types can be read or written explicitly using methods for each type. They
* may also be read or written generically as objects. For instance, a call to <CODE>MapMessage.setInt("foo", 6)</CODE>
* is equivalent to <CODE> MapMessage.setObject("foo", new Integer(6))</CODE>. Both forms are provided, because the
* explicit form is convenient for static programming, and the object form is needed when types are not known at compile
* time. <P> When a client receives a <CODE>MapMessage</CODE>, it is in read-only mode. If a client attempts to write to
* the message at this point, a <CODE>MessageNotWriteableException</CODE> is thrown. If <CODE>clearBody</CODE> is
* called, the message can now be both read from and written to. <P> <CODE>MapMessage</CODE> objects support the
* following conversion table. The marked cases must be supported. The unmarked cases must throw a
* <CODE>JMSException</CODE>. The <CODE>String</CODE> -to-primitive conversions may throw a runtime exception if the
* primitive's <CODE>valueOf()</CODE> method does not accept it as a valid <CODE> String</CODE> representation of the
* primitive. <P> A value written as the row type can be read as the column type.
* <p/>
* <PRE>| | boolean byte short char int long float double String byte[] |----------------------------------------------------------------------
* A <CODE>MapMessage</CODE> object is used to send a set of name-value pairs.
* The names are <CODE>String</CODE> objects, and the values are primitive
* data types in the Java programming language. The names must have a value that
* is not null, and not an empty string. The entries can be accessed
* sequentially or randomly by name. The order of the entries is undefined.
* <CODE>MapMessage</CODE> inherits from the <CODE>Message</CODE> interface
* and adds a message body that contains a Map.
* <P>
* The primitive types can be read or written explicitly using methods for each
* type. They may also be read or written generically as objects. For instance,
* a call to <CODE>MapMessage.setInt("foo", 6)</CODE> is equivalent to
* <CODE> MapMessage.setObject("foo", new Integer(6))</CODE>. Both forms are
* provided, because the explicit form is convenient for static programming, and
* the object form is needed when types are not known at compile time.
* <P>
* When a client receives a <CODE>MapMessage</CODE>, it is in read-only mode.
* If a client attempts to write to the message at this point, a
* <CODE>MessageNotWriteableException</CODE> is thrown. If
* <CODE>clearBody</CODE> is called, the message can now be both read from and
* written to.
* <P>
* <CODE>MapMessage</CODE> objects support the following conversion table. The
* marked cases must be supported. The unmarked cases must throw a
* <CODE>JMSException</CODE>. The <CODE>String</CODE> -to-primitive
* conversions may throw a runtime exception if the primitive's
* <CODE>valueOf()</CODE> method does not accept it as a valid
* <CODE> String</CODE> representation of the primitive.
* <P>
* A value written as the row type can be read as the column type. <p/>
*
* <PRE>
* | | boolean byte short char int long float double String byte[] |----------------------------------------------------------------------
* |boolean | X X |byte | X X X X X |short | X X X X |char | X X |int | X X X |long | X X |float | X X X |double | X X
* |String | X X X X X X X X |byte[] | X |----------------------------------------------------------------------
* <p/>
* &lt;p/&gt;
* </PRE>
*
* <p/>
* <P> Attempting to read a null value as a primitive type must be treated as calling the primitive's corresponding
* <code>valueOf(String)</code> conversion method with a null value. Since <code>char</code> does not support a
* <code>String</code> conversion, attempting to read a null value as a <code>char</code> must throw a
* <code>NullPointerException</code>.
* <P>
* Attempting to read a null value as a primitive type must be treated as
* calling the primitive's corresponding <code>valueOf(String)</code>
* conversion method with a null value. Since <code>char</code> does not
* support a <code>String</code> conversion, attempting to read a null value
* as a <code>char</code> must throw a <code>NullPointerException</code>.
*
* @openwire:marshaller code="25"
* @see javax.jms.Session#createMapMessage()
@ -122,6 +140,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
/**
* Builds the message body from data
*
* @throws JMSException
*
* @throws IOException
@ -151,11 +170,13 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
return "jms/map-message";
}
/**
* Clears out the message body. Clearing a message's body does not clear its header values or property entries. <P>
* If this message body was read-only, calling this method leaves the message body in the same state as an empty
* body in a newly created message.
* Clears out the message body. Clearing a message's body does not clear its
* header values or property entries.
* <P>
* If this message body was read-only, calling this method leaves the
* message body in the same state as an empty body in a newly created
* message.
*/
public void clearBody() throws JMSException {
super.clearBody();
@ -167,7 +188,8 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
*
* @param name the name of the <CODE>boolean</CODE>
* @return the <CODE>boolean</CODE> value with the specified name
* @throws JMSException if the JMS provider fails to read the message due to some internal error.
* @throws JMSException if the JMS provider fails to read the message due to
* some internal error.
* @throws MessageFormatException if this type conversion is invalid.
*/
public boolean getBoolean(String name) throws JMSException {
@ -191,7 +213,8 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
*
* @param name the name of the <CODE>byte</CODE>
* @return the <CODE>byte</CODE> value with the specified name
* @throws JMSException if the JMS provider fails to read the message due to some internal error.
* @throws JMSException if the JMS provider fails to read the message due to
* some internal error.
* @throws MessageFormatException if this type conversion is invalid.
*/
public byte getByte(String name) throws JMSException {
@ -215,7 +238,8 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
*
* @param name the name of the <CODE>short</CODE>
* @return the <CODE>short</CODE> value with the specified name
* @throws JMSException if the JMS provider fails to read the message due to some internal error.
* @throws JMSException if the JMS provider fails to read the message due to
* some internal error.
* @throws MessageFormatException if this type conversion is invalid.
*/
public short getShort(String name) throws JMSException {
@ -242,7 +266,8 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
*
* @param name the name of the Unicode character
* @return the Unicode character value with the specified name
* @throws JMSException if the JMS provider fails to read the message due to some internal error.
* @throws JMSException if the JMS provider fails to read the message due to
* some internal error.
* @throws MessageFormatException if this type conversion is invalid.
*/
public char getChar(String name) throws JMSException {
@ -263,7 +288,8 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
*
* @param name the name of the <CODE>int</CODE>
* @return the <CODE>int</CODE> value with the specified name
* @throws JMSException if the JMS provider fails to read the message due to some internal error.
* @throws JMSException if the JMS provider fails to read the message due to
* some internal error.
* @throws MessageFormatException if this type conversion is invalid.
*/
public int getInt(String name) throws JMSException {
@ -293,7 +319,8 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
*
* @param name the name of the <CODE>long</CODE>
* @return the <CODE>long</CODE> value with the specified name
* @throws JMSException if the JMS provider fails to read the message due to some internal error.
* @throws JMSException if the JMS provider fails to read the message due to
* some internal error.
* @throws MessageFormatException if this type conversion is invalid.
*/
public long getLong(String name) throws JMSException {
@ -326,7 +353,8 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
*
* @param name the name of the <CODE>float</CODE>
* @return the <CODE>float</CODE> value with the specified name
* @throws JMSException if the JMS provider fails to read the message due to some internal error.
* @throws JMSException if the JMS provider fails to read the message due to
* some internal error.
* @throws MessageFormatException if this type conversion is invalid.
*/
public float getFloat(String name) throws JMSException {
@ -350,7 +378,8 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
*
* @param name the name of the <CODE>double</CODE>
* @return the <CODE>double</CODE> value with the specified name
* @throws JMSException if the JMS provider fails to read the message due to some internal error.
* @throws JMSException if the JMS provider fails to read the message due to
* some internal error.
* @throws MessageFormatException if this type conversion is invalid.
*/
public double getDouble(String name) throws JMSException {
@ -376,9 +405,10 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
* Returns the <CODE>String</CODE> value with the specified name.
*
* @param name the name of the <CODE>String</CODE>
* @return the <CODE>String</CODE> value with the specified name; if there is no item by this name, a null value is
* returned
* @throws JMSException if the JMS provider fails to read the message due to some internal error.
* @return the <CODE>String</CODE> value with the specified name; if there
* is no item by this name, a null value is returned
* @throws JMSException if the JMS provider fails to read the message due to
* some internal error.
* @throws MessageFormatException if this type conversion is invalid.
*/
public String getString(String name) throws JMSException {
@ -398,9 +428,10 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
* Returns the byte array value with the specified name.
*
* @param name the name of the byte array
* @return a copy of the byte array value with the specified name; if there is no item by this name, a null value is
* returned.
* @throws JMSException if the JMS provider fails to read the message due to some internal error.
* @return a copy of the byte array value with the specified name; if there
* is no item by this name, a null value is returned.
* @throws JMSException if the JMS provider fails to read the message due to
* some internal error.
* @throws MessageFormatException if this type conversion is invalid.
*/
public byte[] getBytes(String name) throws JMSException {
@ -414,16 +445,23 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
}
/**
* Returns the value of the object with the specified name. <P> This method can be used to return, in objectified
* format, an object in the Java programming language ("Java object") that had been stored in the Map with the
* equivalent <CODE>setObject</CODE> method call, or its equivalent primitive <CODE>set <I>type </I></CODE> method.
* <P> Note that byte values are returned as <CODE>byte[]</CODE>, not <CODE>Byte[]</CODE>.
* Returns the value of the object with the specified name.
* <P>
* This method can be used to return, in objectified format, an object in
* the Java programming language ("Java object") that had been stored in the
* Map with the equivalent <CODE>setObject</CODE> method call, or its
* equivalent primitive <CODE>set <I>type </I></CODE> method.
* <P>
* Note that byte values are returned as <CODE>byte[]</CODE>, not
* <CODE>Byte[]</CODE>.
*
* @param name the name of the Java object
* @return a copy of the Java object value with the specified name, in objectified format (for example, if the
* object was set as an <CODE>int</CODE>, an <CODE>Integer</CODE> is returned); if there is no item by this
* name, a null value is returned
* @throws JMSException if the JMS provider fails to read the message due to some internal error.
* @return a copy of the Java object value with the specified name, in
* objectified format (for example, if the object was set as an
* <CODE>int</CODE>, an <CODE>Integer</CODE> is returned); if
* there is no item by this name, a null value is returned
* @throws JMSException if the JMS provider fails to read the message due to
* some internal error.
*/
public Object getObject(String name) throws JMSException {
initializeReading();
@ -431,7 +469,8 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
}
/**
* Returns an <CODE>Enumeration</CODE> of all the names in the <CODE>MapMessage</CODE> object.
* Returns an <CODE>Enumeration</CODE> of all the names in the
* <CODE>MapMessage</CODE> object.
*
* @return an enumeration of all the names in this <CODE>MapMessage</CODE>
* @throws JMSException
@ -456,8 +495,10 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
*
* @param name the name of the <CODE>boolean</CODE>
* @param value the <CODE>boolean</CODE> value to set in the Map
* @throws JMSException if the JMS provider fails to write the message due to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an empty string.
* @throws JMSException if the JMS provider fails to write the message due
* to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an
* empty string.
* @throws MessageNotWriteableException if the message is in read-only mode.
*/
public void setBoolean(String name, boolean value) throws JMSException {
@ -470,8 +511,10 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
*
* @param name the name of the <CODE>byte</CODE>
* @param value the <CODE>byte</CODE> value to set in the Map
* @throws JMSException if the JMS provider fails to write the message due to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an empty string.
* @throws JMSException if the JMS provider fails to write the message due
* to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an
* empty string.
* @throws MessageNotWriteableException if the message is in read-only mode.
*/
public void setByte(String name, byte value) throws JMSException {
@ -484,8 +527,10 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
*
* @param name the name of the <CODE>short</CODE>
* @param value the <CODE>short</CODE> value to set in the Map
* @throws JMSException if the JMS provider fails to write the message due to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an empty string.
* @throws JMSException if the JMS provider fails to write the message due
* to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an
* empty string.
* @throws MessageNotWriteableException if the message is in read-only mode.
*/
public void setShort(String name, short value) throws JMSException {
@ -498,8 +543,10 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
*
* @param name the name of the Unicode character
* @param value the Unicode character value to set in the Map
* @throws JMSException if the JMS provider fails to write the message due to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an empty string.
* @throws JMSException if the JMS provider fails to write the message due
* to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an
* empty string.
* @throws MessageNotWriteableException if the message is in read-only mode.
*/
public void setChar(String name, char value) throws JMSException {
@ -512,8 +559,10 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
*
* @param name the name of the <CODE>int</CODE>
* @param value the <CODE>int</CODE> value to set in the Map
* @throws JMSException if the JMS provider fails to write the message due to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an empty string.
* @throws JMSException if the JMS provider fails to write the message due
* to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an
* empty string.
* @throws MessageNotWriteableException if the message is in read-only mode.
*/
public void setInt(String name, int value) throws JMSException {
@ -526,8 +575,10 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
*
* @param name the name of the <CODE>long</CODE>
* @param value the <CODE>long</CODE> value to set in the Map
* @throws JMSException if the JMS provider fails to write the message due to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an empty string.
* @throws JMSException if the JMS provider fails to write the message due
* to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an
* empty string.
* @throws MessageNotWriteableException if the message is in read-only mode.
*/
public void setLong(String name, long value) throws JMSException {
@ -540,8 +591,10 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
*
* @param name the name of the <CODE>float</CODE>
* @param value the <CODE>float</CODE> value to set in the Map
* @throws JMSException if the JMS provider fails to write the message due to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an empty string.
* @throws JMSException if the JMS provider fails to write the message due
* to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an
* empty string.
* @throws MessageNotWriteableException if the message is in read-only mode.
*/
public void setFloat(String name, float value) throws JMSException {
@ -554,8 +607,10 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
*
* @param name the name of the <CODE>double</CODE>
* @param value the <CODE>double</CODE> value to set in the Map
* @throws JMSException if the JMS provider fails to write the message due to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an empty string.
* @throws JMSException if the JMS provider fails to write the message due
* to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an
* empty string.
* @throws MessageNotWriteableException if the message is in read-only mode.
*/
public void setDouble(String name, double value) throws JMSException {
@ -568,8 +623,10 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
*
* @param name the name of the <CODE>String</CODE>
* @param value the <CODE>String</CODE> value to set in the Map
* @throws JMSException if the JMS provider fails to write the message due to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an empty string.
* @throws JMSException if the JMS provider fails to write the message due
* to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an
* empty string.
* @throws MessageNotWriteableException if the message is in read-only mode.
*/
public void setString(String name, String value) throws JMSException {
@ -581,10 +638,13 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
* Sets a byte array value with the specified name into the Map.
*
* @param name the name of the byte array
* @param value the byte array value to set in the Map; the array is copied so that the value for <CODE>name </CODE>
* will not be altered by future modifications
* @throws JMSException if the JMS provider fails to write the message due to some internal error.
* @throws NullPointerException if the name is null, or if the name is an empty string.
* @param value the byte array value to set in the Map; the array is copied
* so that the value for <CODE>name </CODE> will not be
* altered by future modifications
* @throws JMSException if the JMS provider fails to write the message due
* to some internal error.
* @throws NullPointerException if the name is null, or if the name is an
* empty string.
* @throws MessageNotWriteableException if the message is in read-only mode.
*/
public void setBytes(String name, byte[] value) throws JMSException {
@ -597,14 +657,17 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
}
/**
* Sets a portion of the byte array value with the specified name into the Map.
* Sets a portion of the byte array value with the specified name into the
* Map.
*
* @param name the name of the byte array
* @param value the byte array value to set in the Map
* @param offset the initial offset within the byte array
* @param length the number of bytes to use
* @throws JMSException if the JMS provider fails to write the message due to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an empty string.
* @throws JMSException if the JMS provider fails to write the message due
* to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an
* empty string.
* @throws MessageNotWriteableException if the message is in read-only mode.
*/
public void setBytes(String name, byte[] value, int offset, int length) throws JMSException {
@ -615,14 +678,18 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
}
/**
* Sets an object value with the specified name into the Map. <P> This method works only for the objectified
* primitive object types (<code>Integer</code>,<code>Double</code>, <code>Long</code> &nbsp;...),
* <code>String</code> objects, and byte arrays.
* Sets an object value with the specified name into the Map.
* <P>
* This method works only for the objectified primitive object types (<code>Integer</code>,<code>Double</code>,
* <code>Long</code> &nbsp;...), <code>String</code> objects, and byte
* arrays.
*
* @param name the name of the Java object
* @param value the Java object value to set in the Map
* @throws JMSException if the JMS provider fails to write the message due to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an empty string.
* @throws JMSException if the JMS provider fails to write the message due
* to some internal error.
* @throws IllegalArgumentException if the name is null or if the name is an
* empty string.
* @throws MessageFormatException if the object is invalid.
* @throws MessageNotWriteableException if the message is in read-only mode.
*/
@ -640,11 +707,13 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
}
/**
* Indicates whether an item exists in this <CODE>MapMessage</CODE> object.
* Indicates whether an item exists in this <CODE>MapMessage</CODE>
* object.
*
* @param name the name of the item to test
* @return true if the item exists
* @throws JMSException if the JMS provider fails to determine if the item exists due to some internal error.
* @throws JMSException if the JMS provider fails to determine if the item
* exists due to some internal error.
*/
public boolean itemExists(String name) throws JMSException {
initializeReading();
@ -661,9 +730,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage {
}
public String toString() {
return super.toString() + " ActiveMQMapMessage{ " +
"theTable = " + map +
" }";
return super.toString() + " ActiveMQMapMessage{ " + "theTable = " + map + " }";
}
public Map getContentMap() throws JMSException {

View File

@ -17,9 +17,6 @@
package org.apache.activemq.command;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.util.ByteArrayInputStream;
import org.apache.activemq.util.ByteArrayOutputStream;
@ -40,16 +37,20 @@ import java.util.zip.DeflaterOutputStream;
import java.util.zip.InflaterInputStream;
/**
* An <CODE>ObjectMessage</CODE> object is used to send a message that contains a serializable object in the Java
* programming language ("Java object"). It inherits from the <CODE>Message</CODE> interface and adds a body containing
* a single reference to an object. Only <CODE>Serializable</CODE> Java objects can be used.
* <p/>
* <P>If a collection of Java objects must be sent, one of the <CODE>Collection</CODE> classes provided since JDK 1.2
* can be used.
* <p/>
* <P>When a client receives an <CODE>ObjectMessage</CODE>, it is in read-only mode. If a client attempts to write to
* the message at this point, a <CODE>MessageNotWriteableException</CODE> is thrown. If <CODE>clearBody</CODE> is
* called, the message can now be both read from and written to.
* An <CODE>ObjectMessage</CODE> object is used to send a message that
* contains a serializable object in the Java programming language ("Java
* object"). It inherits from the <CODE>Message</CODE> interface and adds a
* body containing a single reference to an object. Only
* <CODE>Serializable</CODE> Java objects can be used. <p/>
* <P>
* If a collection of Java objects must be sent, one of the
* <CODE>Collection</CODE> classes provided since JDK 1.2 can be used. <p/>
* <P>
* When a client receives an <CODE>ObjectMessage</CODE>, it is in read-only
* mode. If a client attempts to write to the message at this point, a
* <CODE>MessageNotWriteableException</CODE> is thrown. If
* <CODE>clearBody</CODE> is called, the message can now be both read from and
* written to.
*
* @openwire:marshaller code="26"
* @see javax.jms.Session#createObjectMessage()
@ -61,7 +62,9 @@ import java.util.zip.InflaterInputStream;
* @see javax.jms.TextMessage
*/
public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMessage {
static final ClassLoader ACTIVEMQ_CLASSLOADER = ActiveMQObjectMessage.class.getClassLoader(); //TODO verify classloader
static final ClassLoader ACTIVEMQ_CLASSLOADER = ActiveMQObjectMessage.class.getClassLoader(); // TODO
// verify
// classloader
public static final byte DATA_STRUCTURE_TYPE = CommandTypes.ACTIVEMQ_OBJECT_MESSAGE;
protected transient Serializable object;
@ -110,14 +113,16 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess
return "jms/object-message";
}
/**
* Clears out the message body. Clearing a message's body does not clear its header values or property entries.
* <p/>
* <P>If this message body was read-only, calling this method leaves the message body in the same state as an empty
* body in a newly created message.
* Clears out the message body. Clearing a message's body does not clear its
* header values or property entries. <p/>
* <P>
* If this message body was read-only, calling this method leaves the
* message body in the same state as an empty body in a newly created
* message.
*
* @throws JMSException if the JMS provider fails to clear the message body due to some internal error.
* @throws JMSException if the JMS provider fails to clear the message body
* due to some internal error.
*/
public void clearBody() throws JMSException {
@ -126,16 +131,18 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess
}
/**
* Sets the serializable object containing this message's data. It is important to note that an
* <CODE>ObjectMessage</CODE> contains a snapshot of the object at the time <CODE>setObject()</CODE> is called;
* subsequent modifications of the object will have no effect on the <CODE>ObjectMessage</CODE> body.
* Sets the serializable object containing this message's data. It is
* important to note that an <CODE>ObjectMessage</CODE> contains a
* snapshot of the object at the time <CODE>setObject()</CODE> is called;
* subsequent modifications of the object will have no effect on the
* <CODE>ObjectMessage</CODE> body.
*
* @param newObject the message's data
* @throws JMSException if the JMS provider fails to set the object due to some internal error.
* @throws javax.jms.MessageFormatException
* if object serialization fails.
* @throws javax.jms.MessageNotWriteableException
* if the message is in read-only mode.
* @throws JMSException if the JMS provider fails to set the object due to
* some internal error.
* @throws javax.jms.MessageFormatException if object serialization fails.
* @throws javax.jms.MessageNotWriteableException if the message is in
* read-only mode.
*/
public void setObject(Serializable newObject) throws JMSException {
@ -148,9 +155,9 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess
}
}
/**
* Gets the serializable object containing this message's data. The default value is null.
* Gets the serializable object containing this message's data. The default
* value is null.
*
* @return the serializable object containing this message's data
* @throws JMSException
@ -181,7 +188,8 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess
public void onMessageRolledBack() {
super.onMessageRolledBack();
// lets force the object to be deserialized again - as we could have changed the object
// lets force the object to be deserialized again - as we could have
// changed the object
object = null;
}

View File

@ -21,7 +21,8 @@ import javax.jms.Queue;
/**
*
* @org.apache.xbean.XBean element="queue" description="An ActiveMQ Queue Destination"
* @org.apache.xbean.XBean element="queue" description="An ActiveMQ Queue
* Destination"
*
* @openwire:marshaller code="100"
* @version $Revision: 1.5 $

View File

@ -1130,8 +1130,9 @@ public class ActiveMQStreamMessage extends ActiveMQMessage implements StreamMess
checkWriteOnlyBody();
if (this.dataIn == null) {
ByteSequence data = getContent();
if (data == null)
if (data == null) {
data = new ByteSequence(new byte[] {}, 0, 0);
}
InputStream is = new ByteArrayInputStream(data);
if (isCompressed()) {
is = new InflaterInputStream(is);

View File

@ -39,7 +39,6 @@ public class ActiveMQTempTopic extends ActiveMQTempDestination implements Tempor
super(connectionId.getValue(), sequenceId);
}
public byte getDataStructureType() {
return DATA_STRUCTURE_TYPE;
}

View File

@ -138,8 +138,9 @@ public class ActiveMQTextMessage extends ActiveMQMessage implements TextMessage
public int getSize() {
if (size == 0 && content == null && text != null) {
size = AVERAGE_MESSAGE_SIZE_OVERHEAD;
if (marshalledProperties != null)
if (marshalledProperties != null) {
size += marshalledProperties.getLength();
}
size = text.length() * 2;
}
return super.getSize();

View File

@ -37,10 +37,12 @@ public class BrokerId implements DataStructure {
}
public boolean equals(Object o) {
if (this == o)
if (this == o) {
return true;
if (o == null || o.getClass() != BrokerId.class)
}
if (o == null || o.getClass() != BrokerId.class) {
return false;
}
BrokerId id = (BrokerId)o;
return value.equals(id.value);
}

View File

@ -18,7 +18,6 @@ package org.apache.activemq.command;
import org.apache.activemq.state.CommandVisitor;
/**
*
* @openwire:marshaller code="16"
@ -56,6 +55,7 @@ public class ConnectionError extends BaseCommand {
public ConnectionId getConnectionId() {
return connectionId;
}
public void setConnectionId(ConnectionId connectionId) {
this.connectionId = connectionId;
}

View File

@ -18,7 +18,6 @@ package org.apache.activemq.command;
import org.apache.activemq.state.CommandVisitor;
/**
*
* @openwire:marshaller code="3"
@ -40,6 +39,7 @@ public class ConnectionInfo extends BaseCommand {
public ConnectionInfo() {
}
public ConnectionInfo(ConnectionId connectionId) {
this.connectionId = connectionId;
}
@ -64,6 +64,7 @@ public class ConnectionInfo extends BaseCommand {
public ConnectionId getConnectionId() {
return connectionId;
}
public void setConnectionId(ConnectionId connectionId) {
this.connectionId = connectionId;
}
@ -74,6 +75,7 @@ public class ConnectionInfo extends BaseCommand {
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
@ -90,6 +92,7 @@ public class ConnectionInfo extends BaseCommand {
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@ -100,6 +103,7 @@ public class ConnectionInfo extends BaseCommand {
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
@ -112,6 +116,7 @@ public class ConnectionInfo extends BaseCommand {
public BrokerId[] getBrokerPath() {
return brokerPath;
}
public void setBrokerPath(BrokerId[] brokerPath) {
this.brokerPath = brokerPath;
}
@ -119,24 +124,28 @@ public class ConnectionInfo extends BaseCommand {
public Response visit(CommandVisitor visitor) throws Exception {
return visitor.processAddConnection(this);
}
/**
* @openwire:property version=1
*/
public boolean isBrokerMasterConnector() {
return brokerMasterConnector;
}
/**
* @param brokerMasterConnector The brokerMasterConnector to set.
*/
public void setBrokerMasterConnector(boolean slaveBroker) {
this.brokerMasterConnector = slaveBroker;
}
/**
* @openwire:property version=1
*/
public boolean isManageable() {
return manageable;
}
/**
* @param manageable The manageable to set.
*/
@ -146,8 +155,8 @@ public class ConnectionInfo extends BaseCommand {
/**
* Transports may wish to associate additional data with the connection. For
* example, an SSL transport may use this field to attach the client certificates
* used when the conection was established.
* example, an SSL transport may use this field to attach the client
* certificates used when the conection was established.
*
* @return the transport context.
*/
@ -157,8 +166,8 @@ public class ConnectionInfo extends BaseCommand {
/**
* Transports may wish to associate additional data with the connection. For
* example, an SSL transport may use this field to attach the client certificates
* used when the conection was established.
* example, an SSL transport may use this field to attach the client
* certificates used when the conection was established.
*
* @param transportContext value used to set the transport context
*/

View File

@ -46,12 +46,15 @@ public class ConsumerInfo extends BaseCommand {
protected byte priority;
protected BrokerId[] brokerPath;
protected boolean optimizedAcknowledge;
protected transient int currentPrefetchSize;// used by the broker
protected boolean noRangeAcks; // if true, the consumer will not send range
// used by the broker
protected transient int currentPrefetchSize;
// if true, the consumer will not send range
protected boolean noRangeAcks;
// acks.
protected BooleanExpression additionalPredicate;
protected transient boolean networkSubscription; // this subscription
// originated from a
// network connection

View File

@ -29,6 +29,7 @@ public class DataResponse extends Response {
public DataResponse() {
}
public DataResponse(DataStructure data) {
this.data = data;
}
@ -43,6 +44,7 @@ public class DataResponse extends Response {
public DataStructure getData() {
return data;
}
public void setData(DataStructure data) {
this.data = data;
}

View File

@ -18,7 +18,6 @@ package org.apache.activemq.command;
import org.apache.activemq.state.CommandVisitor;
/**
*
* @openwire:marshaller code="21"
@ -51,6 +50,7 @@ public class MessageDispatch extends BaseCommand {
public ConsumerId getConsumerId() {
return consumerId;
}
public void setConsumerId(ConsumerId consumerId) {
this.consumerId = consumerId;
}
@ -61,6 +61,7 @@ public class MessageDispatch extends BaseCommand {
public ActiveMQDestination getDestination() {
return destination;
}
public void setDestination(ActiveMQDestination destination) {
this.destination = destination;
}
@ -71,6 +72,7 @@ public class MessageDispatch extends BaseCommand {
public Message getMessage() {
return message;
}
public void setMessage(Message message) {
this.message = message;
}
@ -78,6 +80,7 @@ public class MessageDispatch extends BaseCommand {
public long getDeliverySequenceId() {
return deliverySequenceId;
}
public void setDeliverySequenceId(long deliverySequenceId) {
this.deliverySequenceId = deliverySequenceId;
}
@ -88,6 +91,7 @@ public class MessageDispatch extends BaseCommand {
public int getRedeliveryCounter() {
return redeliveryCounter;
}
public void setRedeliveryCounter(int deliveryCounter) {
this.redeliveryCounter = deliveryCounter;
}

View File

@ -66,6 +66,7 @@ public class ProducerInfo extends BaseCommand {
public ProducerId getProducerId() {
return producerId;
}
public void setProducerId(ProducerId producerId) {
this.producerId = producerId;
}
@ -76,6 +77,7 @@ public class ProducerInfo extends BaseCommand {
public ActiveMQDestination getDestination() {
return destination;
}
public void setDestination(ActiveMQDestination destination) {
this.destination = destination;
}
@ -94,6 +96,7 @@ public class ProducerInfo extends BaseCommand {
public BrokerId[] getBrokerPath() {
return brokerPath;
}
public void setBrokerPath(BrokerId[] brokerPath) {
this.brokerPath = brokerPath;
}
@ -103,9 +106,9 @@ public class ProducerInfo extends BaseCommand {
}
/**
* If the broker should dispatch messages from this producer async. Since sync
* dispatch could potentally block the producer thread, this could be an important
* setting for the producer.
* If the broker should dispatch messages from this producer async. Since
* sync dispatch could potentally block the producer thread, this could be
* an important setting for the producer.
*
* @openwire:property version=2
*/
@ -118,9 +121,9 @@ public class ProducerInfo extends BaseCommand {
}
/**
* Used to configure the producer window size. A producer will
* send up to the configured window size worth of payload data to
* the broker before waiting for an Ack that allows him to send more.
* Used to configure the producer window size. A producer will send up to
* the configured window size worth of payload data to the broker before
* waiting for an Ack that allows him to send more.
*
* @openwire:property version=3
*/

View File

@ -38,6 +38,7 @@ public class RemoveInfo extends BaseCommand {
public RemoveInfo() {
}
public RemoveInfo(DataStructure objectId) {
this.objectId = objectId;
}

View File

@ -75,8 +75,7 @@ public class SessionId implements DataStructure {
if (o == null || o.getClass() != SessionId.class)
return false;
SessionId id = (SessionId)o;
return value==id.value
&& connectionId.equals(id.connectionId);
return value == id.value && connectionId.equals(id.connectionId);
}
public byte getDataStructureType() {
@ -89,6 +88,7 @@ public class SessionId implements DataStructure {
public String getConnectionId() {
return connectionId;
}
public void setConnectionId(String connectionId) {
this.connectionId = connectionId;
}
@ -99,6 +99,7 @@ public class SessionId implements DataStructure {
public long getValue() {
return value;
}
public void setValue(long sessionId) {
this.value = sessionId;
}

View File

@ -51,6 +51,7 @@ public class SessionInfo extends BaseCommand {
public SessionId getSessionId() {
return sessionId;
}
public void setSessionId(SessionId sessionId) {
this.sessionId = sessionId;
}

View File

@ -39,5 +39,4 @@ public class ShutdownInfo extends BaseCommand {
return true;
}
}

View File

@ -18,7 +18,6 @@ package org.apache.activemq.command;
import org.apache.activemq.util.IntrospectionSupport;
/**
* Used to represent a durable subscription.
*
@ -51,8 +50,8 @@ public class SubscriptionInfo implements DataStructure {
}
/**
* This is the a resolved destination that the subscription is receiving messages from.
* This will never be a pattern or a composite destination.
* This is the a resolved destination that the subscription is receiving
* messages from. This will never be a pattern or a composite destination.
*
* @openwire:property version=1 cache=true
*/
@ -84,8 +83,8 @@ public class SubscriptionInfo implements DataStructure {
}
/**
* @param subscriptionName
* * @deprecated
* @param subscriptionName *
* @deprecated
*/
public void setSubcriptionName(String subscriptionName) {
this.subscriptionName = subscriptionName;
@ -117,19 +116,24 @@ public class SubscriptionInfo implements DataStructure {
boolean result = false;
if (obj instanceof SubscriptionInfo) {
SubscriptionInfo other = (SubscriptionInfo)obj;
result=(clientId==null&&other.clientId==null||clientId!=null&&other.clientId!=null
result = (clientId == null && other.clientId == null || clientId != null
&& other.clientId != null
&& clientId.equals(other.clientId))
&& (subscriptionName == null && other.subscriptionName == null || subscriptionName != null
&&other.subscriptionName!=null&&subscriptionName.equals(other.subscriptionName));
&& other.subscriptionName != null
&& subscriptionName
.equals(other.subscriptionName));
}
return result;
}
/**
* The destination the client originally subscribed to.. This may not match the {@see getDestination} method
* if the subscribed destination uses patterns or composites.
* The destination the client originally subscribed to.. This may not match
* the {@see getDestination} method if the subscribed destination uses
* patterns or composites.
*
* If the subscribed destinationis not set, this just ruturns the desitination.
* If the subscribed destinationis not set, this just ruturns the
* desitination.
*
* @openwire:property version=3
*/

View File

@ -29,7 +29,6 @@ public class TransactionInfo extends BaseCommand {
public static final byte DATA_STRUCTURE_TYPE = CommandTypes.TRANSACTION_INFO;
public static final byte BEGIN = 0;
public static final byte PREPARE = 1;
public static final byte COMMIT_ONE_PHASE = 2;
@ -62,6 +61,7 @@ public class TransactionInfo extends BaseCommand {
public ConnectionId getConnectionId() {
return connectionId;
}
public void setConnectionId(ConnectionId connectionId) {
this.connectionId = connectionId;
}
@ -72,6 +72,7 @@ public class TransactionInfo extends BaseCommand {
public TransactionId getTransactionId() {
return transactionId;
}
public void setTransactionId(TransactionId transactionId) {
this.transactionId = transactionId;
}
@ -82,6 +83,7 @@ public class TransactionInfo extends BaseCommand {
public byte getType() {
return type;
}
public void setType(byte type) {
this.type = type;
}

View File

@ -68,6 +68,7 @@ public class WireFormatInfo implements Command, MarshallAware {
public byte[] getMagic() {
return magic;
}
public void setMagic(byte[] magic) {
this.magic = magic;
}
@ -78,6 +79,7 @@ public class WireFormatInfo implements Command, MarshallAware {
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
@ -88,6 +90,7 @@ public class WireFormatInfo implements Command, MarshallAware {
public ByteSequence getMarshalledProperties() {
return marshalledProperties;
}
public void setMarshalledProperties(ByteSequence marshalledProperties) {
this.marshalledProperties = marshalledProperties;
}
@ -104,7 +107,8 @@ public class WireFormatInfo implements Command, MarshallAware {
}
/**
* The endpoint within the transport where this message is going to - null means all endpoints.
* The endpoint within the transport where this message is going to - null
* means all endpoints.
*/
public Endpoint getTo() {
return to;
@ -160,7 +164,9 @@ public class WireFormatInfo implements Command, MarshallAware {
}
private Map unmarsallProperties(ByteSequence marshalledProperties) throws IOException {
return MarshallingSupport.unmarshalPrimitiveMap(new DataInputStream(new ByteArrayInputStream(marshalledProperties)), MAX_PROPERTY_SIZE);
return MarshallingSupport
.unmarshalPrimitiveMap(new DataInputStream(new ByteArrayInputStream(marshalledProperties)),
MAX_PROPERTY_SIZE);
}
public void beforeMarshall(WireFormat wireFormat) throws IOException {
@ -183,7 +189,6 @@ public class WireFormatInfo implements Command, MarshallAware {
public void afterUnmarshall(WireFormat wireFormat) throws IOException {
}
public boolean isValid() {
return magic != null && Arrays.equals(magic, MAGIC);
}
@ -197,6 +202,7 @@ public class WireFormatInfo implements Command, MarshallAware {
public boolean isCacheEnabled() throws IOException {
return Boolean.TRUE == getProperty("CacheEnabled");
}
public void setCacheEnabled(boolean cacheEnabled) throws IOException {
setProperty("CacheEnabled", cacheEnabled ? Boolean.TRUE : Boolean.FALSE);
}
@ -207,6 +213,7 @@ public class WireFormatInfo implements Command, MarshallAware {
public boolean isStackTraceEnabled() throws IOException {
return Boolean.TRUE == getProperty("StackTraceEnabled");
}
public void setStackTraceEnabled(boolean stackTraceEnabled) throws IOException {
setProperty("StackTraceEnabled", stackTraceEnabled ? Boolean.TRUE : Boolean.FALSE);
}
@ -217,6 +224,7 @@ public class WireFormatInfo implements Command, MarshallAware {
public boolean isTcpNoDelayEnabled() throws IOException {
return Boolean.TRUE == getProperty("TcpNoDelayEnabled");
}
public void setTcpNoDelayEnabled(boolean tcpNoDelayEnabled) throws IOException {
setProperty("TcpNoDelayEnabled", tcpNoDelayEnabled ? Boolean.TRUE : Boolean.FALSE);
}
@ -227,6 +235,7 @@ public class WireFormatInfo implements Command, MarshallAware {
public boolean isSizePrefixDisabled() throws IOException {
return Boolean.TRUE == getProperty("SizePrefixDisabled");
}
public void setSizePrefixDisabled(boolean prefixPacketSize) throws IOException {
setProperty("SizePrefixDisabled", prefixPacketSize ? Boolean.TRUE : Boolean.FALSE);
}
@ -237,6 +246,7 @@ public class WireFormatInfo implements Command, MarshallAware {
public boolean isTightEncodingEnabled() throws IOException {
return Boolean.TRUE == getProperty("TightEncodingEnabled");
}
public void setTightEncodingEnabled(boolean tightEncodingEnabled) throws IOException {
setProperty("TightEncodingEnabled", tightEncodingEnabled ? Boolean.TRUE : Boolean.FALSE);
}
@ -248,6 +258,7 @@ public class WireFormatInfo implements Command, MarshallAware {
Long l = (Long)getProperty("MaxInactivityDuration");
return l == null ? 0 : l.longValue();
}
public void seMaxInactivityDuration(long maxInactivityDuration) throws IOException {
setProperty("MaxInactivityDuration", new Long(maxInactivityDuration));
}
@ -259,11 +270,11 @@ public class WireFormatInfo implements Command, MarshallAware {
Integer i = (Integer)getProperty("CacheSize");
return i == null ? 0 : i.intValue();
}
public void setCacheSize(int cacheSize) throws IOException {
setProperty("CacheSize", new Integer(cacheSize));
}
public Response visit(CommandVisitor visitor) throws Exception {
return visitor.processWireFormat(this);
}
@ -274,7 +285,8 @@ public class WireFormatInfo implements Command, MarshallAware {
p = getProperties();
} catch (IOException e) {
}
return "WireFormatInfo { version="+version+", properties="+p+", magic="+toString(magic)+"}";
return "WireFormatInfo { version=" + version + ", properties=" + p + ", magic=" + toString(magic)
+ "}";
}
private String toString(byte[] data) {
@ -298,35 +310,46 @@ public class WireFormatInfo implements Command, MarshallAware {
public void setCommandId(int value) {
}
public int getCommandId() {
return 0;
}
public boolean isResponseRequired() {
return false;
}
public boolean isResponse() {
return false;
}
public boolean isBrokerInfo() {
return false;
}
public boolean isMessageDispatch() {
return false;
}
public boolean isMessage() {
return false;
}
public boolean isMessageAck() {
return false;
}
public boolean isMessageDispatchNotification() {
return false;
}
public boolean isShutdownInfo() {
return false;
}
public void setCachedMarshalledForm(WireFormat wireFormat, ByteSequence data) {
}
public ByteSequence getCachedMarshalledForm(WireFormat wireFormat) {
return null;
}

View File

@ -20,7 +20,6 @@ import java.util.Arrays;
import javax.transaction.xa.Xid;
import org.apache.activemq.util.HexSupport;
/**
* @openwire:marshaller code="112"
* @version $Revision: 1.6 $

View File

@ -44,8 +44,7 @@ public abstract class ArithmeticExpression extends BinaryExpression {
String text = (String)lvalue;
String answer = text + rvalue;
return answer;
}
else if (lvalue instanceof Number) {
} else if (lvalue instanceof Number) {
return plus((Number)lvalue, asNumber(rvalue));
}
throw new RuntimeException("Cannot call plus operation on: " + lvalue + " and: " + rvalue);
@ -164,11 +163,9 @@ public abstract class ArithmeticExpression extends BinaryExpression {
private int numberType(Number left, Number right) {
if (isDouble(left) || isDouble(right)) {
return DOUBLE;
}
else if (left instanceof Long || right instanceof Long) {
} else if (left instanceof Long || right instanceof Long) {
return LONG;
}
else {
} else {
return INTEGER;
}
}
@ -180,8 +177,7 @@ public abstract class ArithmeticExpression extends BinaryExpression {
protected Number asNumber(Object value) {
if (value instanceof Number) {
return (Number)value;
}
else {
} else {
throw new RuntimeException("Cannot convert value: " + value + " into a number");
}
}
@ -198,7 +194,6 @@ public abstract class ArithmeticExpression extends BinaryExpression {
return evaluate(lvalue, rvalue);
}
/**
* @param lvalue
* @param rvalue

View File

@ -30,7 +30,8 @@ import javax.jms.JMSException;
public abstract class ComparisonExpression extends BinaryExpression implements BooleanExpression {
public static BooleanExpression createBetween(Expression value, Expression left, Expression right) {
return LogicExpression.createAND(createGreaterThanEqual(value, left), createLessThanEqual(value, right));
return LogicExpression.createAND(createGreaterThanEqual(value, left), createLessThanEqual(value,
right));
}
public static BooleanExpression createNotBetween(Expression value, Expression left, Expression right) {
@ -86,18 +87,14 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
char t = like.charAt(i);
regexp.append("\\x");
regexp.append(Integer.toHexString(0xFFFF & t));
}
else if (c == '%') {
} else if (c == '%') {
regexp.append(".*?"); // Do a non-greedy match
}
else if (c == '_') {
} else if (c == '_') {
regexp.append("."); // match one
}
else if (REGEXP_CONTROL_CHARS.contains(new Character(c))) {
} else if (REGEXP_CONTROL_CHARS.contains(new Character(c))) {
regexp.append("\\x");
regexp.append(Integer.toHexString(0xFFFF & c));
}
else {
} else {
regexp.append(c);
}
}
@ -126,7 +123,8 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
if (!(rv instanceof String)) {
return Boolean.FALSE;
//throw new RuntimeException("LIKE can only operate on String identifiers. LIKE attemped on: '" + rv.getClass());
// throw new RuntimeException("LIKE can only operate on String
// identifiers. LIKE attemped on: '" + rv.getClass());
}
return likePattern.matcher((String)rv).matches() ? Boolean.TRUE : Boolean.FALSE;
@ -140,7 +138,9 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
public static BooleanExpression createLike(Expression left, String right, String escape) {
if (escape != null && escape.length() != 1) {
throw new RuntimeException("The ESCAPE string litteral is invalid. It can only be one character. Litteral used: " + escape);
throw new RuntimeException(
"The ESCAPE string litteral is invalid. It can only be one character. Litteral used: "
+ escape);
}
int c = -1;
if (escape != null) {
@ -298,8 +298,8 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
}
/**
* Validates that the expression can be used in == or <> expression.
* Cannot not be NULL TRUE or FALSE litterals.
* Validates that the expression can be used in == or <> expression. Cannot
* not be NULL TRUE or FALSE litterals.
*
* @param expr
*/
@ -323,8 +323,6 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
}
}
/**
* @param left
* @param right
@ -354,95 +352,70 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
if (lc == Byte.class) {
if (rc == Short.class) {
lv = Short.valueOf(((Number)lv).shortValue());
}
else if (rc == Integer.class) {
} else if (rc == Integer.class) {
lv = Integer.valueOf(((Number)lv).intValue());
}
else if (rc == Long.class) {
} else if (rc == Long.class) {
lv = Long.valueOf(((Number)lv).longValue());
}
else if (rc == Float.class) {
} else if (rc == Float.class) {
lv = new Float(((Number)lv).floatValue());
}
else if (rc == Double.class) {
} else if (rc == Double.class) {
lv = new Double(((Number)lv).doubleValue());
}
else {
} else {
return Boolean.FALSE;
}
} else if (lc == Short.class) {
if (rc == Integer.class) {
lv = Integer.valueOf(((Number)lv).intValue());
}
else if (rc == Long.class) {
} else if (rc == Long.class) {
lv = Long.valueOf(((Number)lv).longValue());
}
else if (rc == Float.class) {
} else if (rc == Float.class) {
lv = new Float(((Number)lv).floatValue());
}
else if (rc == Double.class) {
} else if (rc == Double.class) {
lv = new Double(((Number)lv).doubleValue());
}
else {
} else {
return Boolean.FALSE;
}
} else if (lc == Integer.class) {
if (rc == Long.class) {
lv = Long.valueOf(((Number)lv).longValue());
}
else if (rc == Float.class) {
} else if (rc == Float.class) {
lv = new Float(((Number)lv).floatValue());
}
else if (rc == Double.class) {
} else if (rc == Double.class) {
lv = new Double(((Number)lv).doubleValue());
}
else {
} else {
return Boolean.FALSE;
}
}
else if (lc == Long.class) {
} else if (lc == Long.class) {
if (rc == Integer.class) {
rv = Long.valueOf(((Number)rv).longValue());
}
else if (rc == Float.class) {
} else if (rc == Float.class) {
lv = new Float(((Number)lv).floatValue());
}
else if (rc == Double.class) {
} else if (rc == Double.class) {
lv = new Double(((Number)lv).doubleValue());
}
else {
} else {
return Boolean.FALSE;
}
}
else if (lc == Float.class) {
} else if (lc == Float.class) {
if (rc == Integer.class) {
rv = new Float(((Number)rv).floatValue());
}
else if (rc == Long.class) {
} else if (rc == Long.class) {
rv = new Float(((Number)rv).floatValue());
}
else if (rc == Double.class) {
} else if (rc == Double.class) {
lv = new Double(((Number)lv).doubleValue());
}
else {
} else {
return Boolean.FALSE;
}
}
else if (lc == Double.class) {
} else if (lc == Double.class) {
if (rc == Integer.class) {
rv = new Double(((Number)rv).doubleValue());
}
else if (rc == Long.class) {
} else if (rc == Long.class) {
rv = new Double(((Number)rv).doubleValue());
}
else if (rc == Float.class) {
} else if (rc == Float.class) {
rv = new Float(((Number)rv).doubleValue());
}
else {
} else {
return Boolean.FALSE;
}
}
else
} else
return Boolean.FALSE;
}
return asBoolean(lv.compareTo(rv)) ? Boolean.TRUE : Boolean.FALSE;

View File

@ -31,6 +31,7 @@ public class ConstantExpression implements Expression {
public BooleanConstantExpression(Object value) {
super(value);
}
public boolean matches(MessageEvaluationContext message) throws JMSException {
Object object = evaluate(message);
return object != null && object == Boolean.TRUE;
@ -138,10 +139,9 @@ public class ConstantExpression implements Expression {
}
/**
* Encodes the value of string so that it looks like it would look like
* when it was provided in a selector.
* Encodes the value of string so that it looks like it would look like when
* it was provided in a selector.
*
* @param string
* @return

View File

@ -24,7 +24,6 @@ import javax.jms.JMSException;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.util.JMSExceptionSupport;
/**
* Represents a filter which only operates on Destinations
*
@ -61,8 +60,7 @@ public abstract class DestinationFilter implements BooleanExpression {
String lastPath = paths[idx];
if (lastPath.equals(ANY_DESCENDENT)) {
return new PrefixDestinationFilter(paths);
}
else {
} else {
while (idx >= 0) {
lastPath = paths[idx--];
if (lastPath.equals(ANY_CHILD)) {

View File

@ -46,8 +46,7 @@ public class DestinationMapNode implements DestinationNode {
this.parent = parent;
if (parent == null) {
pathLength = 0;
}
else {
} else {
pathLength = parent.pathLength + 1;
}
}
@ -94,7 +93,6 @@ public class DestinationMapNode implements DestinationNode {
// }
// return anyChild;
// }
/**
* Returns a mutable List of the values available at this node in the tree
*/
@ -113,7 +111,6 @@ public class DestinationMapNode implements DestinationNode {
return v;
}
public Set removeDesendentValues() {
Set answer = new HashSet();
removeDesendentValues(answer);
@ -139,8 +136,7 @@ public class DestinationMapNode implements DestinationNode {
public void add(String[] paths, int idx, Object value) {
if (idx >= paths.length) {
values.add(value);
}
else {
} else {
// if (idx == paths.length - 1) {
// getAnyChildNode().getValues().add(value);
// }
@ -155,8 +151,7 @@ public class DestinationMapNode implements DestinationNode {
if (idx >= paths.length) {
values.remove(value);
pruneIfEmpty();
}
else {
} else {
// if (idx == paths.length - 1) {
// getAnyChildNode().getValues().remove(value);
// }
@ -181,8 +176,7 @@ public class DestinationMapNode implements DestinationNode {
if (path.equals(ANY_CHILD)) {
// node = node.getAnyChildNode();
node = new AnyChildDestinationNode(node);
}
else {
} else {
node = node.getChild(path);
}
}
@ -191,7 +185,6 @@ public class DestinationMapNode implements DestinationNode {
answer.addAll(node.removeValues());
}
}
public void appendDescendantValues(Set answer) {
@ -247,11 +240,9 @@ public class DestinationMapNode implements DestinationNode {
node.appendMatchingWildcards(answer, paths, i);
if (path.equals(ANY_CHILD)) {
node = new AnyChildDestinationNode(node);
}
else {
} else {
node = node.getChild(path);
}
}

View File

@ -69,7 +69,8 @@ public class PropertyExpression implements Expression {
JMS_PROPERTY_EXPRESSIONS.put("JMSDeliveryMode", new SubExpression() {
public Object evaluate(Message message) {
return Integer.valueOf(message.isPersistent()?DeliveryMode.PERSISTENT:DeliveryMode.NON_PERSISTENT);
return Integer.valueOf(message.isPersistent()
? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
}
});
JMS_PROPERTY_EXPRESSIONS.put("JMSPriority", new SubExpression() {
@ -171,7 +172,8 @@ public class PropertyExpression implements Expression {
try {
return message.getMessage().getProperty(name);
} catch (IOException ioe) {
throw JMSExceptionSupport.create("Could not get property: "+name+" reason: "+ioe.getMessage(), ioe);
throw JMSExceptionSupport.create("Could not get property: " + name + " reason: "
+ ioe.getMessage(), ioe);
}
} catch (IOException e) {
throw JMSExceptionSupport.create(e);
@ -193,7 +195,6 @@ public class PropertyExpression implements Expression {
return name;
}
/**
* @see java.lang.Object#toString()
*/

View File

@ -53,7 +53,8 @@ public abstract class UnaryExpression implements Expression {
};
}
public static BooleanExpression createInExpression(PropertyExpression right, List elements, final boolean not) {
public static BooleanExpression createInExpression(PropertyExpression right, List elements,
final boolean not) {
// Use a HashSet if there are many elements.
Collection t;
@ -125,7 +126,6 @@ public abstract class UnaryExpression implements Expression {
}
};
public static BooleanExpression createNOT(BooleanExpression left) {
return new BooleanUnaryExpression(left) {
public Object evaluate(MessageEvaluationContext message) throws JMSException {
@ -175,20 +175,19 @@ public abstract class UnaryExpression implements Expression {
Class clazz = left.getClass();
if (clazz == Integer.class) {
return new Integer(-left.intValue());
}
else if (clazz == Long.class) {
} else if (clazz == Long.class) {
return new Long(-left.longValue());
}
else if (clazz == Float.class) {
} else if (clazz == Float.class) {
return new Float(-left.floatValue());
}
else if (clazz == Double.class) {
} else if (clazz == Double.class) {
return new Double(-left.doubleValue());
}
else if (clazz == BigDecimal.class) {
// We ussually get a big deciamal when we have Long.MIN_VALUE constant in the
// Selector. Long.MIN_VALUE is too big to store in a Long as a positive so we store it
// as a Big decimal. But it gets Negated right away.. to here we try to covert it back
} else if (clazz == BigDecimal.class) {
// We ussually get a big deciamal when we have Long.MIN_VALUE
// constant in the
// Selector. Long.MIN_VALUE is too big to store in a Long as a
// positive so we store it
// as a Big decimal. But it gets Negated right away.. to here we try
// to covert it back
// to a Long.
BigDecimal bd = (BigDecimal)left;
bd = bd.negate();
@ -197,8 +196,7 @@ public abstract class UnaryExpression implements Expression {
return Long.valueOf(Long.MIN_VALUE);
}
return bd;
}
else {
} else {
throw new RuntimeException("Don't know how to negate: " + left);
}
}
@ -246,8 +244,8 @@ public abstract class UnaryExpression implements Expression {
}
/**
* Returns the symbol that represents this binary expression. For example, addition is
* represented by "+"
* Returns the symbol that represents this binary expression. For example,
* addition is represented by "+"
*
* @return
*/

View File

@ -45,7 +45,8 @@ public final class XPathExpression implements BooleanExpression {
try {
m = getXPathEvaluatorConstructor(cn);
} catch (Throwable e) {
log.warn("Invalid "+XPathEvaluator.class.getName()+" implementation: "+cn+", reason: "+e,e);
log.warn("Invalid " + XPathEvaluator.class.getName() + " implementation: " + cn
+ ", reason: " + e, e);
cn = DEFAULT_EVALUATOR_CLASS_NAME;
try {
m = getXPathEvaluatorConstructor(cn);
@ -58,7 +59,8 @@ public final class XPathExpression implements BooleanExpression {
}
}
private static Constructor getXPathEvaluatorConstructor(String cn) throws ClassNotFoundException, SecurityException, NoSuchMethodException {
private static Constructor getXPathEvaluatorConstructor(String cn) throws ClassNotFoundException,
SecurityException, NoSuchMethodException {
Class c = XPathExpression.class.getClassLoader().loadClass(cn);
if (!XPathEvaluator.class.isAssignableFrom(c)) {
throw new ClassCastException("" + c + " is not an instance of " + XPathEvaluator.class);

View File

@ -81,7 +81,8 @@ public class XalanXPathEvaluator implements XPathExpression.XPathEvaluator {
DocumentBuilder dbuilder = factory.newDocumentBuilder();
Document doc = dbuilder.parse(inputSource);
// We should associated the cachedXPathAPI object with the message being evaluated
// We should associated the cachedXPathAPI object with the message
// being evaluated
// since that should speedup subsequent xpath expressions.
CachedXPathAPI cachedXPathAPI = new CachedXPathAPI();
NodeIterator iterator = cachedXPathAPI.selectNodeIterator(doc, xpath);

View File

@ -40,18 +40,19 @@ import org.apache.activemq.command.ActiveMQTopic;
import java.util.concurrent.ConcurrentHashMap;
/**
* A factory of the ActiveMQ InitialContext which contains {@link ConnectionFactory}
* instances as well as a child context called <i>destinations</i> which contain all of the
* current active destinations, in child context depending on the QoS such as
* transient or durable and queue or topic.
* A factory of the ActiveMQ InitialContext which contains
* {@link ConnectionFactory} instances as well as a child context called
* <i>destinations</i> which contain all of the current active destinations, in
* child context depending on the QoS such as transient or durable and queue or
* topic.
*
* @version $Revision: 1.2 $
*/
public class ActiveMQInitialContextFactory implements InitialContextFactory {
private static final String[] defaultConnectionFactoryNames = {
"ConnectionFactory", "QueueConnectionFactory", "TopicConnectionFactory"
};
private static final String[] defaultConnectionFactoryNames = {"ConnectionFactory",
"QueueConnectionFactory",
"TopicConnectionFactory"};
private String connectionPrefix = "connection.";
private String queuePrefix = "queue.";
@ -71,14 +72,10 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory {
throw new NamingException("Invalid broker URL");
}
/* if( broker==null ) {
try {
broker = factory.getEmbeddedBroker();
}
catch (JMSException e) {
log.warn("Failed to get embedded broker", e);
}
}
/*
* if( broker==null ) { try { broker = factory.getEmbeddedBroker(); }
* catch (JMSException e) { log.warn("Failed to get embedded
* broker", e); } }
*/
data.put(name, factory);
}
@ -86,9 +83,8 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory {
createQueues(data, environment);
createTopics(data, environment);
/*
if (broker != null) {
data.put("destinations", broker.getDestinationContext(environment));
}
* if (broker != null) { data.put("destinations",
* broker.getDestinationContext(environment)); }
*/
data.put("dynamicQueues", new LazyCreateContext() {
private static final long serialVersionUID = 6503881346214855588L;
@ -133,7 +129,8 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory {
return new ReadOnlyContext(environment, data);
}
protected ActiveMQConnectionFactory createConnectionFactory(String name, Hashtable environment) throws URISyntaxException {
protected ActiveMQConnectionFactory createConnectionFactory(String name, Hashtable environment)
throws URISyntaxException {
Hashtable temp = new Hashtable(environment);
String prefix = connectionPrefix + name + ".";
for (Iterator iter = environment.entrySet().iterator(); iter.hasNext();) {
@ -153,7 +150,8 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory {
String factoryNames = (String)environment.get("connectionFactoryNames");
if (factoryNames != null) {
List list = new ArrayList();
for (StringTokenizer enumeration = new StringTokenizer(factoryNames, ","); enumeration.hasMoreTokens();) {
for (StringTokenizer enumeration = new StringTokenizer(factoryNames, ","); enumeration
.hasMoreTokens();) {
list.add(enumeration.nextToken().trim());
}
int size = list.size();
@ -203,9 +201,11 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory {
}
/**
* Factory method to create a new connection factory from the given environment
* Factory method to create a new connection factory from the given
* environment
*/
protected ActiveMQConnectionFactory createConnectionFactory(Hashtable environment) throws URISyntaxException {
protected ActiveMQConnectionFactory createConnectionFactory(Hashtable environment)
throws URISyntaxException {
ActiveMQConnectionFactory answer = new ActiveMQConnectionFactory();
Properties properties = new Properties();
properties.putAll(environment);
@ -217,7 +217,6 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory {
return connectionPrefix;
}
public void setConnectionPrefix(String connectionPrefix) {
this.connectionPrefix = connectionPrefix;
}

View File

@ -19,6 +19,7 @@ package org.apache.activemq.kaha;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
/**
* Implementation of a Marshaller for byte arrays
*

View File

@ -20,6 +20,7 @@ import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
/**
* Used by RootContainers
*
@ -38,7 +39,6 @@ public class ContainerId implements Externalizable{
this.dataContainerName = dataContainerName;
}
/**
* @return Returns the dataContainerPrefix.
*/

View File

@ -18,16 +18,17 @@ import java.util.List;
import java.util.NoSuchElementException;
/**
* Represents a container of persistent objects in the store Acts as a map, but values can be retrieved in insertion
* order
* Represents a container of persistent objects in the store Acts as a map, but
* values can be retrieved in insertion order
*
* @version $Revision: 1.2 $
*/
public interface ListContainer<V> extends List<V> {
/**
* The container is created or retrieved in an unloaded state. load populates the container will all the indexes
* used etc and should be called before any operations on the container
* The container is created or retrieved in an unloaded state. load
* populates the container will all the indexes used etc and should be
* called before any operations on the container
*/
public void load();
@ -43,7 +44,8 @@ public interface ListContainer<V> extends List<V>{
public boolean isLoaded();
/**
* For homogenous containers can set a custom marshaller for loading values The default uses Object serialization
* For homogenous containers can set a custom marshaller for loading values
* The default uses Object serialization
*
* @param marshaller
*/
@ -67,8 +69,8 @@ public interface ListContainer<V> extends List<V>{
public void addFirst(V o);
/**
* Appends the given element to the end of this list. (Identical in function to the <tt>add</tt> method; included
* only for consistency.)
* Appends the given element to the end of this list. (Identical in function
* to the <tt>add</tt> method; included only for consistency.)
*
* @param o the element to be inserted at the end of this list.
*/
@ -91,7 +93,8 @@ public interface ListContainer<V> extends List<V>{
public V removeLast();
/**
* remove an objecr from the list without retrieving the old value from the store
* remove an objecr from the list without retrieving the old value from the
* store
*
* @param position
* @return true if successful
@ -107,7 +110,8 @@ public interface ListContainer<V> extends List<V>{
public StoreEntry placeLast(V object);
/**
* insert an Object in first position int the list but get a StoreEntry of its position
* insert an Object in first position int the list but get a StoreEntry of
* its position
*
* @param object
* @return the location in the Store
@ -115,7 +119,8 @@ public interface ListContainer<V> extends List<V>{
public StoreEntry placeFirst(V object);
/**
* Advanced feature = must ensure the object written doesn't overwrite other objects in the container
* Advanced feature = must ensure the object written doesn't overwrite other
* objects in the container
*
* @param entry
* @param object
@ -169,8 +174,9 @@ public interface ListContainer<V> extends List<V>{
public boolean remove(StoreEntry entry);
/**
* It's possible that a StoreEntry could be come stale
* this will return an upto date entry for the StoreEntry position
* It's possible that a StoreEntry could be come stale this will return an
* upto date entry for the StoreEntry position
*
* @param entry old entry
* @return a refreshed StoreEntry
*/

View File

@ -21,19 +21,17 @@ import java.util.Map;
import java.util.Set;
/**
*Represents a container of persistent objects in the store
*Acts as a map, but values can be retrieved in insertion order
* Represents a container of persistent objects in the store Acts as a map, but
* values can be retrieved in insertion order
*
* @version $Revision: 1.2 $
*/
public interface MapContainer<K, V> extends Map<K, V> {
/**
* The container is created or retrieved in
* an unloaded state.
* load populates the container will all the indexes used etc
* and should be called before any operations on the container
* The container is created or retrieved in an unloaded state. load
* populates the container will all the indexes used etc and should be
* called before any operations on the container
*/
public void load();
@ -51,6 +49,7 @@ public interface MapContainer<K, V> extends Map<K, V>{
/**
* For homogenous containers can set a custom marshaller for loading keys
* The default uses Object serialization
*
* @param keyMarshaller
*/
public void setKeyMarshaller(Marshaller<K> keyMarshaller);
@ -58,10 +57,12 @@ public interface MapContainer<K, V> extends Map<K, V>{
/**
* For homogenous containers can set a custom marshaller for loading values
* The default uses Object serialization
*
* @param valueMarshaller
*
*/
public void setValueMarshaller(Marshaller<V> valueMarshaller);
/**
* @return the id the MapContainer was create with
*/
@ -85,12 +86,12 @@ public interface MapContainer<K, V> extends Map<K, V>{
/**
* Get the value associated with the key
*
* @param key
* @return the value associated with the key from the store
*/
public V get(K key);
/**
* @param o
* @return true if the MapContainer contains the value o
@ -99,6 +100,7 @@ public interface MapContainer<K, V> extends Map<K, V>{
/**
* Add add entries in the supplied Map
*
* @param map
*/
public void putAll(Map<K, V> map);
@ -109,29 +111,29 @@ public interface MapContainer<K, V> extends Map<K, V>{
public Set<K> keySet();
/**
* @return a collection of all the values - the values will be lazily pulled out of the
* store if iterated etc.
* @return a collection of all the values - the values will be lazily pulled
* out of the store if iterated etc.
*/
public Collection<V> values();
/**
* @return a Set of all the Map.Entry instances - the values will be lazily pulled out of the
* store if iterated etc.
* @return a Set of all the Map.Entry instances - the values will be lazily
* pulled out of the store if iterated etc.
*/
public Set<Map.Entry<K, V>> entrySet();
/**
* Add an entry
*
* @param key
* @param value
* @return the old value for the key
*/
public V put(K key, V value);
/**
* remove an entry associated with the key
*
* @param key
* @return the old value assocaited with the key or null
*/
@ -144,6 +146,7 @@ public interface MapContainer<K, V> extends Map<K, V>{
/**
* Add an entry to the Store Map
*
* @param key
* @param Value
* @return the StoreEntry associated with the entry
@ -152,12 +155,14 @@ public interface MapContainer<K, V> extends Map<K, V>{
/**
* Remove an Entry from ther Map
*
* @param entry
*/
public void remove(StoreEntry entry);
/**
* Get the Key object from it's location
*
* @param keyLocation
* @return the key for the entry
*/
@ -165,12 +170,14 @@ public interface MapContainer<K, V> extends Map<K, V>{
/**
* Get the value from it's location
*
* @param Valuelocation
* @return the Object
*/
public V getValue(StoreEntry Valuelocation);
/** Get the StoreEntry for the first value in the Map
/**
* Get the StoreEntry for the first value in the Map
*
* @return the first StoreEntry or null if the map is empty
*/
@ -199,10 +206,10 @@ public interface MapContainer<K, V> extends Map<K, V>{
*/
public StoreEntry getPrevious(StoreEntry entry);
/**
* It's possible that a StoreEntry could be come stale
* this will return an upto date entry for the StoreEntry position
* It's possible that a StoreEntry could be come stale this will return an
* upto date entry for the StoreEntry position
*
* @param entry old entry
* @return a refreshed StoreEntry
*/
@ -210,6 +217,7 @@ public interface MapContainer<K, V> extends Map<K, V>{
/**
* Get the StoreEntry associated with the key
*
* @param key
* @return the StoreEntry
*/

View File

@ -20,6 +20,7 @@ import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import org.apache.activemq.command.MessageId;
/**
* Implementation of a Marshaller for MessageIds
*

View File

@ -16,7 +16,6 @@
*/
package org.apache.activemq.kaha;
/**
* Runtime exception for the Store
*
@ -25,7 +24,6 @@ package org.apache.activemq.kaha;
public class RuntimeStoreException extends RuntimeException {
private static final long serialVersionUID = 8807084681372365173L;
/**
@ -37,6 +35,7 @@ public class RuntimeStoreException extends RuntimeException{
/**
* Constructor
*
* @param message
*/
public RuntimeStoreException(String message) {
@ -45,6 +44,7 @@ public class RuntimeStoreException extends RuntimeException{
/**
* Constructor
*
* @param message
* @param cause
*/
@ -54,6 +54,7 @@ public class RuntimeStoreException extends RuntimeException{
/**
* Constructor
*
* @param cause
*/
public RuntimeStoreException(Throwable cause) {

View File

@ -18,6 +18,7 @@ package org.apache.activemq.kaha;
import java.io.IOException;
import java.util.Set;
/**
* A Store is holds persistent containers
*
@ -44,11 +45,11 @@ public interface Store{
*/
public final static Marshaller StringMarshaller = new StringMarshaller();
/**
* Command Marshaller
*/
public final static Marshaller CommandMarshaller = new CommandMarshaller();
/**
* close the store
*
@ -98,7 +99,8 @@ public interface Store{
public boolean doesMapContainerExist(Object id, String containerName) throws IOException;
/**
* Get a MapContainer with the given id - the MapContainer is created if needed
* Get a MapContainer with the given id - the MapContainer is created if
* needed
*
* @param id
* @return container for the associated id or null if it doesn't exist
@ -107,7 +109,8 @@ public interface Store{
public MapContainer getMapContainer(Object id) throws IOException;
/**
* Get a MapContainer with the given id - the MapContainer is created if needed
* Get a MapContainer with the given id - the MapContainer is created if
* needed
*
* @param id
* @param containerName
@ -117,7 +120,8 @@ public interface Store{
public MapContainer getMapContainer(Object id, String containerName) throws IOException;
/**
* Get a MapContainer with the given id - the MapContainer is created if needed
* Get a MapContainer with the given id - the MapContainer is created if
* needed
*
* @param id
* @param containerName
@ -125,7 +129,8 @@ public interface Store{
* @return container for the associated id or null if it doesn't exist
* @throws IOException
*/
public MapContainer getMapContainer(Object id,String containerName,boolean persistentIndex) throws IOException;
public MapContainer getMapContainer(Object id, String containerName, boolean persistentIndex)
throws IOException;
/**
* delete a container from the default container
@ -146,6 +151,7 @@ public interface Store{
/**
* Delete Map container
*
* @param id
* @throws IOException
*/
@ -206,7 +212,8 @@ public interface Store{
* @return container for the associated id or null if it doesn't exist
* @throws IOException
*/
public ListContainer getListContainer(Object id,String containerName,boolean persistentIndex) throws IOException;
public ListContainer getListContainer(Object id, String containerName, boolean persistentIndex)
throws IOException;
/**
* delete a ListContainer from the default container
@ -227,6 +234,7 @@ public interface Store{
/**
* delete a list container
*
* @param id
* @throws IOException
*/
@ -258,6 +266,7 @@ public interface Store{
/**
* Set the default index type
*
* @param type
* @see org.apache.activemq.kaha.IndexTypes
*/

View File

@ -27,9 +27,9 @@ import org.apache.activemq.kaha.impl.KahaStore;
*/
public class StoreFactory {
/**
* open or create a Store
*
* @param name
* @param mode
* @return the opened/created store
@ -41,6 +41,7 @@ public class StoreFactory{
/**
* Delete a database
*
* @param name of the database
* @return true if successful
* @throws IOException

View File

@ -19,6 +19,7 @@ package org.apache.activemq.kaha;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
/**
* Implementation of a Marshaller for Strings
*

View File

@ -10,16 +10,13 @@ public interface DataManager {
String getName();
Object readItem(Marshaller marshaller, StoreLocation item)
throws IOException;
Object readItem(Marshaller marshaller, StoreLocation item) throws IOException;
StoreLocation storeDataItem(Marshaller marshaller, Object payload)
throws IOException;
StoreLocation storeDataItem(Marshaller marshaller, Object payload) throws IOException;
StoreLocation storeRedoItem(Object payload) throws IOException;
void updateItem(StoreLocation location, Marshaller marshaller,
Object payload) throws IOException;
void updateItem(StoreLocation location, Marshaller marshaller, Object payload) throws IOException;
void recoverRedoItems(RedoListener listener) throws IOException;

View File

@ -49,7 +49,6 @@ class IndexRootContainer {
protected Map map = new ConcurrentHashMap();
protected LinkedList list = new LinkedList();
IndexRootContainer(IndexItem root, IndexManager im, DataManager dfm) throws IOException {
this.root = root;
this.indexManager = im;
@ -70,8 +69,6 @@ class IndexRootContainer {
return map.keySet();
}
IndexItem addRoot(IndexManager containerIndexManager, ContainerId key) throws IOException {
if (map.containsKey(key)) {
removeRoot(containerIndexManager, key);
@ -134,6 +131,4 @@ class IndexRootContainer {
return map.containsKey(key);
}
}

View File

@ -18,8 +18,6 @@ package org.apache.activemq.kaha.impl;
import java.io.IOException;
/**
* Exception thrown if the store is in use by another application
*

View File

@ -23,9 +23,10 @@ import java.util.concurrent.ConcurrentHashMap;
import org.apache.activemq.kaha.impl.async.DataFileAppender.WriteCommand;
import org.apache.activemq.kaha.impl.async.DataFileAppender.WriteKey;
import org.apache.activemq.util.ByteSequence;
/**
* Optimized Store reader and updater. Single threaded and synchronous. Use in conjunction
* with the DataFileAccessorPool of concurrent use.
* Optimized Store reader and updater. Single threaded and synchronous. Use in
* conjunction with the DataFileAccessorPool of concurrent use.
*
* @version $Revision: 1.1.1.1 $
*/
@ -118,16 +119,16 @@ final class DataFileAccessor {
byte data[] = new byte[3];
file.seek(location.getOffset() + AsyncDataManager.ITEM_HEAD_OFFSET_TO_SOR);
file.readFully(data);
if( data[0] != AsyncDataManager.ITEM_HEAD_SOR[0] ||
data[1] != AsyncDataManager.ITEM_HEAD_SOR[1] ||
data[2] != AsyncDataManager.ITEM_HEAD_SOR[2] ) {
if (data[0] != AsyncDataManager.ITEM_HEAD_SOR[0]
|| data[1] != AsyncDataManager.ITEM_HEAD_SOR[1]
|| data[2] != AsyncDataManager.ITEM_HEAD_SOR[2]) {
return false;
}
file.seek(location.getOffset() + location.getSize() - AsyncDataManager.ITEM_FOOT_SPACE);
file.readFully(data);
if( data[0] != AsyncDataManager.ITEM_HEAD_EOR[0] ||
data[1] != AsyncDataManager.ITEM_HEAD_EOR[1] ||
data[2] != AsyncDataManager.ITEM_HEAD_EOR[2] ) {
if (data[0] != AsyncDataManager.ITEM_HEAD_EOR[0]
|| data[1] != AsyncDataManager.ITEM_HEAD_EOR[1]
|| data[2] != AsyncDataManager.ITEM_HEAD_EOR[2]) {
return false;
}
}

View File

@ -27,8 +27,9 @@ import org.apache.activemq.util.DataByteArrayOutputStream;
import org.apache.activemq.util.LinkedNode;
/**
* An optimized writer to do batch appends to a data file. This object is thread safe
* and gains throughput as you increase the number of concurrent writes it does.
* An optimized writer to do batch appends to a data file. This object is thread
* safe and gains throughput as you increase the number of concurrent writes it
* does.
*
* @version $Revision: 1.1.1.1 $
*/
@ -148,8 +149,10 @@ class DataFileAppender {
WriteBatch batch;
WriteCommand write = new WriteCommand(location, data, sync);
// Locate datafile and enqueue into the executor in sychronized block so that
// writes get equeued onto the executor in order that they were assigned by
// Locate datafile and enqueue into the executor in sychronized block so
// that
// writes get equeued onto the executor in order that they were assigned
// by
// the data manager (which is basically just appending)
synchronized (this) {
@ -246,13 +249,13 @@ class DataFileAppender {
}
/**
* The async processing loop that writes to the data files and
* does the force calls.
* The async processing loop that writes to the data files and does the
* force calls.
*
* Since the file sync() call is the slowest of all the operations,
* this algorithm tries to 'batch' or group together several file sync() requests
* into a single file sync() call. The batching is accomplished attaching the
* same CountDownLatch instance to every force request in a group.
* Since the file sync() call is the slowest of all the operations, this
* algorithm tries to 'batch' or group together several file sync() requests
* into a single file sync() call. The batching is accomplished attaching
* the same CountDownLatch instance to every force request in a group.
*
*/
protected void processQueue() {
@ -282,7 +285,6 @@ class DataFileAppender {
enqueueMutex.notify();
}
if (o == SHUTDOWN_COMMAND) {
break;
}
@ -344,7 +346,8 @@ class DataFileAppender {
// Signal any waiting threads that the write is on disk.
wb.latch.countDown();
// Now that the data is on disk, remove the writes from the in flight
// Now that the data is on disk, remove the writes from the in
// flight
// cache.
write = wb.first;
while (write != null) {

View File

@ -83,7 +83,6 @@ public final class DataManagerFacade implements org.apache.activemq.kaha.impl.Da
private final String name;
private Marshaller redoMarshaller;
public DataManagerFacade(AsyncDataManager dataManager, String name) {
this.dataManager = dataManager;
this.name = name;
@ -95,7 +94,6 @@ public final class DataManagerFacade implements org.apache.activemq.kaha.impl.Da
return marshaller.readPayload(dataIn);
}
public StoreLocation storeDataItem(Marshaller marshaller, Object payload) throws IOException {
final DataByteArrayOutputStream buffer = new DataByteArrayOutputStream();
marshaller.writePayload(payload, buffer);
@ -103,7 +101,6 @@ public final class DataManagerFacade implements org.apache.activemq.kaha.impl.Da
return convertToStoreLocation(dataManager.write(data, (byte)1, false));
}
public void force() throws IOException {
dataManager.write(FORCE_COMMAND, (byte)2, true);
}
@ -130,6 +127,7 @@ public final class DataManagerFacade implements org.apache.activemq.kaha.impl.Da
public void addInterestInFile(int file) throws IOException {
dataManager.addInterestInFile(file);
}
public void removeInterestInFile(int file) throws IOException {
dataManager.removeInterestInFile(file);
}
@ -137,6 +135,7 @@ public final class DataManagerFacade implements org.apache.activemq.kaha.impl.Da
public void recoverRedoItems(RedoListener listener) throws IOException {
throw new RuntimeException("Not Implemented..");
}
public StoreLocation storeRedoItem(Object payload) throws IOException {
throw new RuntimeException("Not Implemented..");
}
@ -144,6 +143,7 @@ public final class DataManagerFacade implements org.apache.activemq.kaha.impl.Da
public Marshaller getRedoMarshaller() {
return redoMarshaller;
}
public void setRedoMarshaller(Marshaller redoMarshaller) {
this.redoMarshaller = redoMarshaller;
}
@ -152,5 +152,4 @@ public final class DataManagerFacade implements org.apache.activemq.kaha.impl.Da
return name;
}
}

View File

@ -33,7 +33,6 @@ import org.apache.activemq.util.ByteSequence;
*/
public final class JournalFacade implements Journal {
public static class RecordLocationFacade implements RecordLocation {
private final Location location;
@ -80,11 +79,13 @@ public final class JournalFacade implements Journal {
return convertToRecordLocation(dataManager.getMark());
}
public RecordLocation getNextRecordLocation(RecordLocation location) throws InvalidRecordLocationException, IOException, IllegalStateException {
public RecordLocation getNextRecordLocation(RecordLocation location)
throws InvalidRecordLocationException, IOException, IllegalStateException {
return convertToRecordLocation(dataManager.getNextLocation(convertFromRecordLocation(location)));
}
public Packet read(RecordLocation location) throws InvalidRecordLocationException, IOException, IllegalStateException {
public Packet read(RecordLocation location) throws InvalidRecordLocationException, IOException,
IllegalStateException {
ByteSequence rc = dataManager.read(convertFromRecordLocation(location));
if (rc == null)
return null;
@ -94,7 +95,8 @@ public final class JournalFacade implements Journal {
public void setJournalEventListener(JournalEventListener listener) throws IllegalStateException {
}
public void setMark(RecordLocation location, boolean sync) throws InvalidRecordLocationException, IOException, IllegalStateException {
public void setMark(RecordLocation location, boolean sync) throws InvalidRecordLocationException,
IOException, IllegalStateException {
dataManager.setMark(convertFromRecordLocation(location), sync);
}

View File

@ -39,7 +39,8 @@ public final class Location implements Comparable<Location> {
private byte type = NOT_SET_TYPE;
private CountDownLatch latch;
public Location(){}
public Location() {
}
Location(Location item) {
this.dataFileId = item.dataFileId;
@ -76,6 +77,7 @@ public final class Location implements Comparable<Location> {
public int getOffset() {
return offset;
}
public void setOffset(int offset) {
this.offset = offset;
}
@ -97,7 +99,8 @@ public final class Location implements Comparable<Location> {
}
public String toString() {
String result="offset = "+offset+", file = " + dataFileId + ", size = "+size + ", type = "+type;
String result = "offset = " + offset + ", file = " + dataFileId + ", size = " + size + ", type = "
+ type;
return result;
}
@ -118,6 +121,7 @@ public final class Location implements Comparable<Location> {
public CountDownLatch getLatch() {
return latch;
}
public void setLatch(CountDownLatch latch) {
this.latch = latch;
}
@ -143,5 +147,4 @@ public final class Location implements Comparable<Location> {
return dataFileId ^ offset;
}
}

View File

@ -22,8 +22,8 @@ import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
/**
* An AsyncDataFileAppender that uses NIO ByteBuffers and File chanels to more efficently
* copy data to files.
* An AsyncDataFileAppender that uses NIO ByteBuffers and File chanels to more
* efficently copy data to files.
*
* @version $Revision: 1.1.1.1 $
*/
@ -34,13 +34,13 @@ class NIODataFileAppender extends DataFileAppender {
}
/**
* The async processing loop that writes to the data files and
* does the force calls.
* The async processing loop that writes to the data files and does the
* force calls.
*
* Since the file sync() call is the slowest of all the operations,
* this algorithm tries to 'batch' or group together several file sync() requests
* into a single file sync() call. The batching is accomplished attaching the
* same CountDownLatch instance to every force request in a group.
* Since the file sync() call is the slowest of all the operations, this
* algorithm tries to 'batch' or group together several file sync() requests
* into a single file sync() call. The batching is accomplished attaching
* the same CountDownLatch instance to every force request in a group.
*
*/
protected void processQueue() {
@ -82,7 +82,6 @@ class NIODataFileAppender extends DataFileAppender {
enqueueMutex.notify();
}
if (o == SHUTDOWN_COMMAND) {
break;
}
@ -113,7 +112,8 @@ class NIODataFileAppender extends DataFileAppender {
header.put(write.location.getType());
header.clear();
transfer(header, channel);
ByteBuffer source = ByteBuffer.wrap(write.data.getData(), write.data.getOffset(), write.data.getLength());
ByteBuffer source = ByteBuffer.wrap(write.data.getData(), write.data.getOffset(),
write.data.getLength());
transfer(source, channel);
footer.clear();
transfer(footer, channel);
@ -130,7 +130,8 @@ class NIODataFileAppender extends DataFileAppender {
copy(header, buffer);
assert !header.hasRemaining();
ByteBuffer source = ByteBuffer.wrap(write.data.getData(), write.data.getOffset(), write.data.getLength());
ByteBuffer source = ByteBuffer.wrap(write.data.getData(), write.data.getOffset(),
write.data.getLength());
copy(source, buffer);
assert !source.hasRemaining();
@ -157,7 +158,8 @@ class NIODataFileAppender extends DataFileAppender {
wb.latch.countDown();
}
// Now that the data is on disk, remove the writes from the in flight
// Now that the data is on disk, remove the writes from the in
// flight
// cache.
write = wb.first;
while (write != null) {
@ -186,6 +188,7 @@ class NIODataFileAppender extends DataFileAppender {
/**
* Copy the bytes in header to the channel.
*
* @param header - source of data
* @param channel - destination where the data will be written.
* @throws IOException

View File

@ -18,7 +18,6 @@ package org.apache.activemq.kaha.impl.container;
import java.util.Iterator;
/**
* An Iterator for a container entry Set
*
@ -28,6 +27,7 @@ public class ContainerEntrySetIterator implements Iterator{
private MapContainerImpl container;
private Iterator iter;
private ContainerMapEntry currentEntry;
ContainerEntrySetIterator(MapContainerImpl container, Iterator iter) {
this.container = container;
this.iter = iter;

View File

@ -31,12 +31,10 @@ import org.apache.activemq.kaha.impl.index.IndexLinkedList;
*/
public class ContainerKeySet extends ContainerCollectionSupport implements Set {
ContainerKeySet(MapContainerImpl container) {
super(container);
}
public boolean contains(Object o) {
return container.containsKey(o);
}

View File

@ -20,7 +20,6 @@ import java.util.Iterator;
import org.apache.activemq.kaha.impl.index.IndexItem;
import org.apache.activemq.kaha.impl.index.IndexLinkedList;
/**
* Iterator for the set of keys for a container
*

View File

@ -35,7 +35,6 @@ class ContainerMapEntry implements Map.Entry {
}
public Object getKey() {
return key;
}
@ -48,6 +47,3 @@ class ContainerMapEntry implements Map.Entry {
return container.put(key, value);
}
}

View File

@ -32,24 +32,19 @@ import org.apache.activemq.kaha.impl.index.IndexLinkedList;
*/
class ContainerValueCollection extends ContainerCollectionSupport implements Collection {
ContainerValueCollection(MapContainerImpl container) {
super(container);
}
public boolean contains(Object o) {
return container.containsValue(o);
}
public Iterator iterator() {
IndexLinkedList list = container.getItemList();
return new ContainerValueCollectionIterator(container, list, list.getRoot());
}
public Object[] toArray() {
Object[] result = null;
IndexLinkedList list = container.getItemList();
@ -64,7 +59,6 @@ class ContainerValueCollection extends ContainerCollectionSupport implements Col
item = list.getNextEntry(item);
}
}
return result;
}
@ -86,17 +80,14 @@ class ContainerValueCollection extends ContainerCollectionSupport implements Col
return result;
}
public boolean add(Object o) {
throw new UnsupportedOperationException("Can't add an object here");
}
public boolean remove(Object o) {
return container.removeValue(o);
}
public boolean containsAll(Collection c) {
boolean result = !c.isEmpty();
for (Iterator i = c.iterator(); i.hasNext();) {
@ -108,12 +99,10 @@ class ContainerValueCollection extends ContainerCollectionSupport implements Col
return result;
}
public boolean addAll(Collection c) {
throw new UnsupportedOperationException("Can't add everything here!");
}
public boolean removeAll(Collection c) {
boolean result = true;
for (Iterator i = c.iterator(); i.hasNext();) {
@ -123,7 +112,6 @@ class ContainerValueCollection extends ContainerCollectionSupport implements Col
return result;
}
public boolean retainAll(Collection c) {
List tmpList = new ArrayList();
for (Iterator i = c.iterator(); i.hasNext();) {
@ -138,7 +126,6 @@ class ContainerValueCollection extends ContainerCollectionSupport implements Col
return !tmpList.isEmpty();
}
public void clear() {
container.clear();
}

View File

@ -45,9 +45,8 @@ public class ListContainerImpl extends BaseContainerImpl implements ListContaine
private static final Log log = LogFactory.getLog(ListContainerImpl.class);
protected Marshaller marshaller = Store.ObjectMarshaller;
public ListContainerImpl(ContainerId id,IndexItem root,IndexManager indexManager,DataManager dataManager,
boolean persistentIndex) throws IOException{
public ListContainerImpl(ContainerId id, IndexItem root, IndexManager indexManager,
DataManager dataManager, boolean persistentIndex) throws IOException {
super(id, root, indexManager, dataManager, persistentIndex);
}
@ -436,8 +435,10 @@ public class ListContainerImpl extends BaseContainerImpl implements ListContaine
load();
Object result = null;
IndexItem replace = indexList.isEmpty() ? null : (IndexItem)indexList.get(index);
IndexItem prev=(indexList.isEmpty()||(index-1)<0)?null:(IndexItem)indexList.get(index-1);
IndexItem next=(indexList.isEmpty()||(index+1)>=size())?null:(IndexItem)indexList.get(index+1);
IndexItem prev = (indexList.isEmpty() || (index - 1) < 0) ? null : (IndexItem)indexList
.get(index - 1);
IndexItem next = (indexList.isEmpty() || (index + 1) >= size()) ? null : (IndexItem)indexList
.get(index + 1);
result = getValue(replace);
indexList.remove(index);
delete(replace, prev, next);
@ -448,8 +449,10 @@ public class ListContainerImpl extends BaseContainerImpl implements ListContaine
protected synchronized IndexItem internalSet(int index, Object element) {
IndexItem replace = indexList.isEmpty() ? null : (IndexItem)indexList.get(index);
IndexItem prev=(indexList.isEmpty()||(index-1)<0)?null:(IndexItem)indexList.get(index-1);
IndexItem next=(indexList.isEmpty()||(index+1)>=size())?null:(IndexItem)indexList.get(index+1);
IndexItem prev = (indexList.isEmpty() || (index - 1) < 0) ? null : (IndexItem)indexList
.get(index - 1);
IndexItem next = (indexList.isEmpty() || (index + 1) >= size()) ? null : (IndexItem)indexList
.get(index + 1);
indexList.remove(index);
delete(replace, prev, next);
itemRemoved(index);
@ -640,7 +643,8 @@ public class ListContainerImpl extends BaseContainerImpl implements ListContaine
}
/**
* insert an Object in first position int the list but get a StoreEntry of its position
* insert an Object in first position int the list but get a StoreEntry of
* its position
*
* @param object
* @return the location in the Store
@ -653,7 +657,8 @@ public class ListContainerImpl extends BaseContainerImpl implements ListContaine
/**
* @param entry
* @param object
* @see org.apache.activemq.kaha.ListContainer#update(org.apache.activemq.kaha.StoreEntry, java.lang.Object)
* @see org.apache.activemq.kaha.ListContainer#update(org.apache.activemq.kaha.StoreEntry,
* java.lang.Object)
*/
public synchronized void update(StoreEntry entry, Object object) {
try {
@ -738,8 +743,9 @@ public class ListContainerImpl extends BaseContainerImpl implements ListContaine
}
/**
* It's possible that a StoreEntry could be come stale
* this will return an upto date entry for the StoreEntry position
* It's possible that a StoreEntry could be come stale this will return an
* upto date entry for the StoreEntry position
*
* @param entry old entry
* @return a refreshed StoreEntry
*/

View File

@ -197,6 +197,7 @@ public final class MapContainerImpl extends BaseContainerImpl implements MapCont
/**
* Get the StoreEntry associated with the key
*
* @param key
* @return the StoreEntry
*/
@ -282,7 +283,8 @@ public final class MapContainerImpl extends BaseContainerImpl implements MapCont
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.MapContainer#put(java.lang.Object, java.lang.Object)
* @see org.apache.activemq.kaha.MapContainer#put(java.lang.Object,
* java.lang.Object)
*/
public synchronized Object put(Object key, Object value) {
load();

View File

@ -18,7 +18,6 @@ package org.apache.activemq.kaha.impl.data;
import org.apache.activemq.kaha.StoreLocation;
/**
* A a wrapper for a data in the store
*
@ -30,7 +29,8 @@ public final class DataItem implements Item, StoreLocation{
private long offset = POSITION_NOT_SET;
private int size;
public DataItem(){}
public DataItem() {
}
DataItem(DataItem item) {
this.file = item.file;

View File

@ -32,6 +32,7 @@ import org.apache.activemq.kaha.impl.index.RedoStoreIndexItem;
import org.apache.activemq.util.IOExceptionSupport;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Manages DataFiles
*
@ -91,7 +92,9 @@ public final class DataManagerImpl implements DataManager {
return result;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.impl.data.IDataManager#getName()
*/
public String getName() {
@ -122,35 +125,49 @@ public final class DataManagerImpl implements DataManager {
return dataFile;
}
/* (non-Javadoc)
* @see org.apache.activemq.kaha.impl.data.IDataManager#readItem(org.apache.activemq.kaha.Marshaller, org.apache.activemq.kaha.StoreLocation)
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.impl.data.IDataManager#readItem(org.apache.activemq.kaha.Marshaller,
* org.apache.activemq.kaha.StoreLocation)
*/
public synchronized Object readItem(Marshaller marshaller, StoreLocation item) throws IOException {
return getReader().readItem(marshaller, item);
}
/* (non-Javadoc)
* @see org.apache.activemq.kaha.impl.data.IDataManager#storeDataItem(org.apache.activemq.kaha.Marshaller, java.lang.Object)
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.impl.data.IDataManager#storeDataItem(org.apache.activemq.kaha.Marshaller,
* java.lang.Object)
*/
public synchronized StoreLocation storeDataItem(Marshaller marshaller, Object payload) throws IOException {
return getWriter().storeItem(marshaller, payload, DATA_ITEM_TYPE);
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.impl.data.IDataManager#storeRedoItem(java.lang.Object)
*/
public synchronized StoreLocation storeRedoItem(Object payload) throws IOException {
return getWriter().storeItem(redoMarshaller, payload, REDO_ITEM_TYPE);
}
/* (non-Javadoc)
* @see org.apache.activemq.kaha.impl.data.IDataManager#updateItem(org.apache.activemq.kaha.StoreLocation, org.apache.activemq.kaha.Marshaller, java.lang.Object)
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.impl.data.IDataManager#updateItem(org.apache.activemq.kaha.StoreLocation,
* org.apache.activemq.kaha.Marshaller, java.lang.Object)
*/
public synchronized void updateItem(StoreLocation location,Marshaller marshaller, Object payload) throws IOException {
public synchronized void updateItem(StoreLocation location, Marshaller marshaller, Object payload)
throws IOException {
getWriter().updateItem((DataItem)location, marshaller, payload, DATA_ITEM_TYPE);
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.impl.data.IDataManager#recoverRedoItems(org.apache.activemq.kaha.impl.data.RedoListener)
*/
public synchronized void recoverRedoItems(RedoListener listener) throws IOException {
@ -182,7 +199,8 @@ public final class DataManagerImpl implements DataManager {
try {
listener.onRedoItem(item, object);
// in case the listener is holding on to item references, copy it
// in case the listener is holding on to item references,
// copy it
// so we don't change it behind the listener's back.
item = item.copy();
@ -195,7 +213,9 @@ public final class DataManagerImpl implements DataManager {
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.impl.data.IDataManager#close()
*/
public synchronized void close() throws IOException {
@ -208,7 +228,9 @@ public final class DataManagerImpl implements DataManager {
fileMap.clear();
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.impl.data.IDataManager#force()
*/
public synchronized void force() throws IOException {
@ -218,8 +240,9 @@ public final class DataManagerImpl implements DataManager {
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.impl.data.IDataManager#delete()
*/
public synchronized boolean delete() throws IOException {
@ -232,8 +255,9 @@ public final class DataManagerImpl implements DataManager {
return result;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.impl.data.IDataManager#addInterestInFile(int)
*/
public synchronized void addInterestInFile(int file) throws IOException {
@ -253,7 +277,9 @@ public final class DataManagerImpl implements DataManager {
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.impl.data.IDataManager#removeInterestInFile(int)
*/
public synchronized void removeInterestInFile(int file) throws IOException {
@ -274,7 +300,9 @@ public final class DataManagerImpl implements DataManager {
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.impl.data.IDataManager#consolidateDataFiles()
*/
public synchronized void consolidateDataFiles() throws IOException {
@ -300,14 +328,18 @@ public final class DataManagerImpl implements DataManager {
log.debug("discarding data file " + dataFile + (result ? "successful " : "failed"));
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.impl.data.IDataManager#getRedoMarshaller()
*/
public Marshaller getRedoMarshaller() {
return redoMarshaller;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.impl.data.IDataManager#setRedoMarshaller(org.apache.activemq.kaha.Marshaller)
*/
public void setRedoMarshaller(Marshaller redoMarshaller) {
@ -338,9 +370,11 @@ public final class DataManagerImpl implements DataManager {
}
return reader;
}
protected synchronized SyncDataFileReader createReader() {
return new SyncDataFileReader(this);
}
public synchronized void setReader(SyncDataFileReader reader) {
this.reader = reader;
}
@ -351,9 +385,11 @@ public final class DataManagerImpl implements DataManager {
}
return writer;
}
private SyncDataFileWriter createWriter() {
return new SyncDataFileWriter(this);
}
public synchronized void setWriter(SyncDataFileWriter writer) {
this.writer = writer;
}

View File

@ -21,6 +21,7 @@ import java.io.RandomAccessFile;
import org.apache.activemq.kaha.Marshaller;
import org.apache.activemq.kaha.StoreLocation;
import org.apache.activemq.util.DataByteArrayInputStream;
/**
* Optimized Store reader
*
@ -41,7 +42,9 @@ public final class SyncDataFileReader {
this.dataIn = new DataByteArrayInputStream();
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.impl.data.DataFileReader#readDataItemSize(org.apache.activemq.kaha.impl.data.DataItem)
*/
public synchronized byte readDataItemSize(DataItem item) throws IOException {
@ -52,8 +55,11 @@ public final class SyncDataFileReader {
return rc;
}
/* (non-Javadoc)
* @see org.apache.activemq.kaha.impl.data.DataFileReader#readItem(org.apache.activemq.kaha.Marshaller, org.apache.activemq.kaha.StoreLocation)
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.impl.data.DataFileReader#readItem(org.apache.activemq.kaha.Marshaller,
* org.apache.activemq.kaha.StoreLocation)
*/
public synchronized Object readItem(Marshaller marshaller, StoreLocation item) throws IOException {
RandomAccessFile file = dataManager.getDataFile(item).getRandomAccessFile();

View File

@ -21,9 +21,10 @@ import java.io.RandomAccessFile;
import org.apache.activemq.kaha.Marshaller;
import org.apache.activemq.util.DataByteArrayOutputStream;
/**
* Optimized Store writer. Synchronously marshalls and writes to the data file. Simple but
* may introduce a bit of contention when put under load.
* Optimized Store writer. Synchronously marshalls and writes to the data file.
* Simple but may introduce a bit of contention when put under load.
*
* @version $Revision: 1.1.1.1 $
*/
@ -32,7 +33,6 @@ final public class SyncDataFileWriter {
private DataByteArrayOutputStream buffer;
private DataManagerImpl dataManager;
/**
* Construct a Store writer
*
@ -43,10 +43,14 @@ final public class SyncDataFileWriter {
this.buffer = new DataByteArrayOutputStream();
}
/* (non-Javadoc)
* @see org.apache.activemq.kaha.impl.data.DataFileWriter#storeItem(org.apache.activemq.kaha.Marshaller, java.lang.Object, byte)
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.impl.data.DataFileWriter#storeItem(org.apache.activemq.kaha.Marshaller,
* java.lang.Object, byte)
*/
public synchronized DataItem storeItem(Marshaller marshaller, Object payload, byte type) throws IOException {
public synchronized DataItem storeItem(Marshaller marshaller, Object payload, byte type)
throws IOException {
// Write the packet our internal buffer.
buffer.reset();
@ -72,10 +76,14 @@ final public class SyncDataFileWriter {
return item;
}
/* (non-Javadoc)
* @see org.apache.activemq.kaha.impl.data.DataFileWriter#updateItem(org.apache.activemq.kaha.StoreLocation, org.apache.activemq.kaha.Marshaller, java.lang.Object, byte)
/*
* (non-Javadoc)
*
* @see org.apache.activemq.kaha.impl.data.DataFileWriter#updateItem(org.apache.activemq.kaha.StoreLocation,
* org.apache.activemq.kaha.Marshaller, java.lang.Object, byte)
*/
public synchronized void updateItem(DataItem item,Marshaller marshaller, Object payload, byte type) throws IOException {
public synchronized void updateItem(DataItem item, Marshaller marshaller, Object payload, byte type)
throws IOException {
// Write the packet our internal buffer.
buffer.reset();
buffer.position(DataManagerImpl.ITEM_HEAD_SIZE);

View File

@ -39,6 +39,7 @@ public class BadMagicException extends IOException{
/**
* Construct an Exception with a reason
*
* @param s
*/
public BadMagicException(String s) {

View File

@ -27,6 +27,7 @@ public interface Index{
/**
* clear the index
*
* @throws IOException
*
*/
@ -57,7 +58,6 @@ public interface Index{
*/
public void store(Object key, StoreEntry entry) throws IOException;
/**
* @param key
* @return the entry
@ -77,14 +77,14 @@ public interface Index{
/**
* unload indexes
*
* @throws IOException
*/
public void unload() throws IOException;
/**
* Set the marshaller for key objects
*
* @param marshaller
*/
public void setKeyMarshaller(Marshaller marshaller);

View File

@ -60,13 +60,15 @@ public interface IndexLinkedList{
/**
* Inserts the given element at the beginning of this list.
*
* @param item
*/
public void addFirst(IndexItem item);
/**
* Appends the given element to the end of this list. (Identical in function to the <tt>add</tt> method; included
* only for consistency.)
* Appends the given element to the end of this list. (Identical in function
* to the <tt>add</tt> method; included only for consistency.)
*
* @param item
*/
public void addLast(IndexItem item);
@ -87,9 +89,11 @@ public interface IndexLinkedList{
/**
* Appends the specified element to the end of this list.
*
* @param item
*
* @return <tt>true</tt> (as per the general contract of <tt>Collection.add</tt>).
* @return <tt>true</tt> (as per the general contract of
* <tt>Collection.add</tt>).
*/
public boolean add(IndexItem item);
@ -105,13 +109,15 @@ public interface IndexLinkedList{
* @param index index of element to return.
* @return the element at the specified position in this list.
*
* @throws IndexOutOfBoundsException if the specified index is is out of range (<tt>index &lt; 0 || index &gt;= size()</tt>).
* @throws IndexOutOfBoundsException if the specified index is is out of
* range (<tt>index &lt; 0 || index &gt;= size()</tt>).
*/
public IndexItem get(int index);
/**
* Inserts the specified element at the specified position in this list. Shifts the element currently at that
* position (if any) and any subsequent elements to the right (adds one to their indices).
* Inserts the specified element at the specified position in this list.
* Shifts the element currently at that position (if any) and any subsequent
* elements to the right (adds one to their indices).
*
* @param index index at which the specified element is to be inserted.
* @param element element to be inserted.
@ -121,8 +127,9 @@ public interface IndexLinkedList{
public void add(int index, IndexItem element);
/**
* Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts
* one from their indices). Returns the element that was removed from the list.
* Removes the element at the specified position in this list. Shifts any
* subsequent elements to the left (subtracts one from their indices).
* Returns the element that was removed from the list.
*
* @param index the index of the element to removed.
* @return the element previously at the specified position.
@ -133,13 +140,15 @@ public interface IndexLinkedList{
// Search Operations
/**
* Returns the index in this list of the first occurrence of the specified element, or -1 if the List does not
* contain this element. More formally, returns the lowest index i such that
* <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>, or -1 if there is no such index.
* Returns the index in this list of the first occurrence of the specified
* element, or -1 if the List does not contain this element. More formally,
* returns the lowest index i such that
* <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>, or -1 if there
* is no such index.
*
* @param o element to search for.
* @return the index in this list of the first occurrence of the specified element, or -1 if the list does not
* contain this element.
* @return the index in this list of the first occurrence of the specified
* element, or -1 if the list does not contain this element.
*/
public int indexOf(StoreEntry o);
@ -159,15 +168,16 @@ public interface IndexLinkedList{
*/
public IndexItem getPrevEntry(IndexItem entry);
/**
* remove an entry
*
* @param e
*/
public void remove(IndexItem e);
/**
* Ensure we have the up to date entry
*
* @param entry
* @return the entry
*/
@ -175,6 +185,7 @@ public interface IndexLinkedList{
/**
* Update the indexes of a StoreEntry
*
* @param current
* @return update StoreEntry
*/

View File

@ -47,6 +47,7 @@ public class RedoStoreIndexItem implements Externalizable {
public RedoStoreIndexItem() {
}
public RedoStoreIndexItem(String indexName, long offset, IndexItem item) {
this.indexName = indexName;
this.offset = offset;
@ -56,6 +57,7 @@ public class RedoStoreIndexItem implements Externalizable {
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
readExternal((DataInput)in);
}
public void readExternal(DataInput in) throws IOException {
// indexName = in.readUTF();
offset = in.readLong();
@ -66,6 +68,7 @@ public class RedoStoreIndexItem implements Externalizable {
public void writeExternal(ObjectOutput out) throws IOException {
writeExternal((DataOutput)out);
}
public void writeExternal(DataOutput out) throws IOException {
// out.writeUTF(indexName);
out.writeLong(offset);
@ -75,6 +78,7 @@ public class RedoStoreIndexItem implements Externalizable {
public String getIndexName() {
return indexName;
}
public void setIndexName(String indexName) {
this.indexName = indexName;
}
@ -82,12 +86,15 @@ public class RedoStoreIndexItem implements Externalizable {
public IndexItem getIndexItem() {
return indexItem;
}
public void setIndexItem(IndexItem item) {
this.indexItem = item;
}
public long getOffset() {
return offset;
}
public void setOffset(long offset) {
this.offset = offset;
}

View File

@ -20,6 +20,7 @@ import java.io.IOException;
import java.io.RandomAccessFile;
import org.apache.activemq.util.DataByteArrayInputStream;
/**
* Optimized Store reader
*

View File

@ -21,6 +21,7 @@ import java.io.RandomAccessFile;
import org.apache.activemq.kaha.impl.DataManager;
import org.apache.activemq.util.DataByteArrayOutputStream;
/**
* Optimized Store writer
*

Some files were not shown because too many files have changed in this diff Show More