Author: borges
Date: 2011-11-02 12:16:50 -0400 (Wed, 02 Nov 2011)
New Revision: 11633
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java
trunk/hornetq-core/src/main/java/org/hornetq/core/paging/impl/PageTransactionInfoImpl.java
trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompFrame.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompProtocolManager.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompSession.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/v11/StompFrameV11.java
trunk/hornetq-core/src/main/javacc/FilterParser.jj
trunk/hornetq-jms/src/main/java/org/hornetq/jms/client/HornetQSession.java
trunk/hornetq-jms/src/main/java/org/hornetq/jms/client/HornetQTopic.java
trunk/hornetq-jms/src/main/java/org/hornetq/jms/management/impl/JMSServerControlImpl.java
trunk/hornetq-jms/src/main/java/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java
Log:
clean up
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
---
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-11-02
16:16:14 UTC (rev 11632)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-11-02
16:16:50 UTC (rev 11633)
@@ -1689,23 +1689,21 @@
super.finalize();
}
- class Connector
+ private class Connector
{
private final TransportConfiguration initialConnector;
private volatile ClientSessionFactoryInternal factory;
- private boolean interrupted = false;
-
private Exception e;
- public Connector(TransportConfiguration initialConnector,
ClientSessionFactoryInternal factory)
+ Connector(TransportConfiguration initialConnector, ClientSessionFactoryInternal
factory)
{
this.initialConnector = initialConnector;
this.factory = factory;
}
- public ClientSessionFactory tryConnect() throws HornetQException
+ private ClientSessionFactory tryConnect() throws HornetQException
{
if (log.isDebugEnabled())
{
@@ -1738,8 +1736,6 @@
public void disconnect()
{
- interrupted = true;
-
if (factory != null)
{
factory.causeExit();
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/paging/impl/PageTransactionInfoImpl.java
===================================================================
---
trunk/hornetq-core/src/main/java/org/hornetq/core/paging/impl/PageTransactionInfoImpl.java 2011-11-02
16:16:14 UTC (rev 11632)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/paging/impl/PageTransactionInfoImpl.java 2011-11-02
16:16:50 UTC (rev 11633)
@@ -28,7 +28,6 @@
import org.hornetq.core.paging.cursor.PagePosition;
import org.hornetq.core.paging.cursor.PageSubscription;
import org.hornetq.core.persistence.StorageManager;
-import org.hornetq.core.server.MessageReference;
import org.hornetq.core.transaction.Transaction;
import org.hornetq.core.transaction.TransactionOperationAbstract;
import org.hornetq.core.transaction.TransactionPropertyIndexes;
@@ -57,9 +56,9 @@
private volatile boolean rolledback = false;
- private AtomicInteger numberOfMessages = new AtomicInteger(0);
+ private final AtomicInteger numberOfMessages = new AtomicInteger(0);
- private AtomicInteger numberOfPersistentMessages = new AtomicInteger(0);
+ private final AtomicInteger numberOfPersistentMessages = new AtomicInteger(0);
private List<Pair<PageSubscription, PagePosition>> lateDeliveries;
@@ -228,11 +227,6 @@
{
PageTransactionInfoImpl.this.onUpdate(1, storageManager, pagingManager);
}
-
- public List<MessageReference> getRelatedMessageReferences()
- {
- return null;
- }
});
}
@@ -268,6 +262,7 @@
}
}
+ @Override
public String toString()
{
return "PageTransactionInfoImpl(transactionID=" + transactionID +
@@ -324,7 +319,7 @@
static class UpdatePageTXOperation extends TransactionOperationAbstract
{
- private HashMap<PageTransactionInfo, AtomicInteger> countsToUpdate = new
HashMap<PageTransactionInfo, AtomicInteger>();
+ private final HashMap<PageTransactionInfo, AtomicInteger> countsToUpdate =
new HashMap<PageTransactionInfo, AtomicInteger>();
private boolean stored = false;
@@ -356,16 +351,19 @@
counter.addAndGet(increment);
}
+ @Override
public void beforePrepare(Transaction tx) throws Exception
{
storeUpdates(tx);
}
+ @Override
public void beforeCommit(Transaction tx) throws Exception
{
storeUpdates(tx);
}
+ @Override
public void afterCommit(Transaction tx)
{
for (Map.Entry<PageTransactionInfo, AtomicInteger> entry :
countsToUpdate.entrySet())
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
---
trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2011-11-02
16:16:14 UTC (rev 11632)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2011-11-02
16:16:50 UTC (rev 11633)
@@ -1215,26 +1215,26 @@
{
// no need to store if it's the same value
// otherwise the journal will get OME in case of lots of redeliveries
- if (ref.getDeliveryCount() != ref.getPersistedCount())
+ if (ref.getDeliveryCount() == ref.getPersistedCount())
{
- ref.setPersistedCount(ref.getDeliveryCount());
- DeliveryCountUpdateEncoding updateInfo =
- new DeliveryCountUpdateEncoding(ref.getQueue().getID(),
ref.getDeliveryCount());
+ return;
+ }
+ ref.setPersistedCount(ref.getDeliveryCount());
+ DeliveryCountUpdateEncoding updateInfo =
+ new DeliveryCountUpdateEncoding(ref.getQueue().getID(),
ref.getDeliveryCount());
+
readLock();
try
{
messageJournal.appendUpdateRecord(ref.getMessage().getMessageID(),
JournalStorageManager.UPDATE_DELIVERY_COUNT, updateInfo,
-
syncNonTransactional,
getContext(syncNonTransactional));
}
-
finally
{
readUnLock();
}
- }
}
public void storeAddressSetting(PersistedAddressSetting addressSetting) throws
Exception
@@ -2581,13 +2581,6 @@
}
/* (non-Javadoc)
- * @see org.hornetq.core.persistence.OperationContext#complete()
- */
- public void complete()
- {
- }
-
- /* (non-Javadoc)
* @see
org.hornetq.core.persistence.OperationContext#executeOnCompletion(org.hornetq.core.journal.IOAsyncTask)
*/
public void executeOnCompletion(final IOAsyncTask runnable)
@@ -3039,11 +3032,6 @@
public long id;
- public DeleteEncoding()
- {
- super();
- }
-
public DeleteEncoding(final byte recordType, final long id)
{
this.recordType = recordType;
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompFrame.java
===================================================================
---
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompFrame.java 2011-11-02
16:16:14 UTC (rev 11632)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompFrame.java 2011-11-02
16:16:50 UTC (rev 11633)
@@ -18,10 +18,7 @@
package org.hornetq.core.protocol.stomp;
import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompProtocolManager.java
===================================================================
---
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompProtocolManager.java 2011-11-02
16:16:14 UTC (rev 11632)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompProtocolManager.java 2011-11-02
16:16:50 UTC (rev 11633)
@@ -18,13 +18,11 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.Set;
import java.util.concurrent.Executor;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.Interceptor;
-import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.core.journal.IOAsyncTask;
import org.hornetq.core.logging.Logger;
@@ -253,7 +251,7 @@
Iterator<Entry<String, StompSession>> iterator =
transactedSessions.entrySet().iterator();
while (iterator.hasNext())
{
- Map.Entry<String, StompSession> entry = (Map.Entry<String,
StompSession>)iterator.next();
+ Map.Entry<String, StompSession> entry = iterator.next();
if (entry.getValue().getConnection() == connection)
{
ServerSession serverSession = entry.getValue().getSession();
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompSession.java
===================================================================
---
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompSession.java 2011-11-02
16:16:14 UTC (rev 11632)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompSession.java 2011-11-02
16:16:50 UTC (rev 11633)
@@ -12,21 +12,14 @@
*/
package org.hornetq.core.protocol.stomp;
-import java.io.UnsupportedEncodingException;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.Message;
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.message.impl.MessageImpl;
import org.hornetq.core.persistence.OperationContext;
-import org.hornetq.core.protocol.stomp.Stomp.Headers;
import org.hornetq.core.remoting.impl.netty.TransportConstants;
import org.hornetq.core.server.QueueQueryResult;
import org.hornetq.core.server.ServerMessage;
@@ -35,7 +28,6 @@
import org.hornetq.spi.core.protocol.SessionCallback;
import org.hornetq.spi.core.remoting.ReadyListener;
import org.hornetq.utils.ConfigurationHelper;
-import org.hornetq.utils.DataConstants;
import org.hornetq.utils.UUIDGenerator;
/**
@@ -45,8 +37,6 @@
*/
public class StompSession implements SessionCallback
{
- private static final Logger log = Logger.getLogger(StompSession.class);
-
private final StompProtocolManager manager;
private final StompConnection connection;
@@ -239,7 +229,7 @@
Iterator<Entry<Long, StompSubscription>> iterator =
subscriptions.entrySet().iterator();
while (iterator.hasNext())
{
- Map.Entry<Long, StompSubscription> entry = (Map.Entry<Long,
StompSubscription>)iterator.next();
+ Map.Entry<Long, StompSubscription> entry = iterator.next();
long consumerID = entry.getKey();
StompSubscription sub = entry.getValue();
if (id != null && id.equals(sub.getID()))
@@ -257,7 +247,7 @@
Iterator<Entry<Long, StompSubscription>> iterator =
subscriptions.entrySet().iterator();
while (iterator.hasNext())
{
- Map.Entry<Long, StompSubscription> entry = (Map.Entry<Long,
StompSubscription>)iterator.next();
+ Map.Entry<Long, StompSubscription> entry = iterator.next();
StompSubscription sub = entry.getValue();
if (sub.getID().equals(subscriptionID))
{
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/v11/StompFrameV11.java
===================================================================
---
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/v11/StompFrameV11.java 2011-11-02
16:16:14 UTC (rev 11632)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/v11/StompFrameV11.java 2011-11-02
16:16:50 UTC (rev 11633)
@@ -18,11 +18,8 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQBuffers;
-import org.hornetq.core.protocol.stomp.HornetQStompException;
-import org.hornetq.core.protocol.stomp.SimpleBytes;
import org.hornetq.core.protocol.stomp.Stomp;
import org.hornetq.core.protocol.stomp.StompFrame;
-import org.hornetq.core.protocol.stomp.StompFrame.Header;
/**
*
@@ -31,7 +28,7 @@
public class StompFrameV11 extends StompFrame
{
//stomp 1.1 talks about repetitive headers.
- private List<Header> allHeaders = new ArrayList<Header>();
+ private final List<Header> allHeaders = new ArrayList<Header>();
private String contentType;
public StompFrameV11(String command, Map<String, String> headers, byte[]
content)
Modified: trunk/hornetq-core/src/main/javacc/FilterParser.jj
===================================================================
--- trunk/hornetq-core/src/main/javacc/FilterParser.jj 2011-11-02 16:16:14 UTC (rev
11632)
+++ trunk/hornetq-core/src/main/javacc/FilterParser.jj 2011-11-02 16:16:50 UTC (rev
11633)
@@ -35,6 +35,7 @@
import org.hornetq.core.filter.impl.SimpleStringReader;
// CHECKSTYLE:OFF
+// NO_UCD
/**
* A JavaCC 2.0 grammar for HornetQ filters
*
Modified: trunk/hornetq-jms/src/main/java/org/hornetq/jms/client/HornetQSession.java
===================================================================
--- trunk/hornetq-jms/src/main/java/org/hornetq/jms/client/HornetQSession.java 2011-11-02
16:16:14 UTC (rev 11632)
+++ trunk/hornetq-jms/src/main/java/org/hornetq/jms/client/HornetQSession.java 2011-11-02
16:16:50 UTC (rev 11633)
@@ -45,9 +45,6 @@
import javax.jms.TopicSession;
import javax.jms.TopicSubscriber;
import javax.jms.TransactionInProgressException;
-import javax.jms.XAQueueSession;
-import javax.jms.XASession;
-import javax.jms.XATopicSession;
import javax.transaction.xa.XAResource;
import org.hornetq.api.core.HornetQException;
Modified: trunk/hornetq-jms/src/main/java/org/hornetq/jms/client/HornetQTopic.java
===================================================================
--- trunk/hornetq-jms/src/main/java/org/hornetq/jms/client/HornetQTopic.java 2011-11-02
16:16:14 UTC (rev 11632)
+++ trunk/hornetq-jms/src/main/java/org/hornetq/jms/client/HornetQTopic.java 2011-11-02
16:16:50 UTC (rev 11633)
@@ -13,12 +13,9 @@
package org.hornetq.jms.client;
-import javax.jms.JMSException;
import javax.jms.Topic;
-import org.hornetq.api.core.Pair;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.jms.client.HornetQDestination;
/**
* HornetQ implementation of a JMS Topic.
@@ -40,7 +37,7 @@
public static SimpleString createAddressFromName(final String name)
{
- return new SimpleString(HornetQTopic.JMS_TOPIC_ADDRESS_PREFIX + name);
+ return new SimpleString(HornetQDestination.JMS_TOPIC_ADDRESS_PREFIX + name);
}
// Attributes ----------------------------------------------------
@@ -49,7 +46,7 @@
public HornetQTopic(final String name)
{
- super(HornetQQueue.JMS_TOPIC_ADDRESS_PREFIX + name, name, false, false, null);
+ super(HornetQDestination.JMS_TOPIC_ADDRESS_PREFIX + name, name, false, false,
null);
}
Modified:
trunk/hornetq-jms/src/main/java/org/hornetq/jms/management/impl/JMSServerControlImpl.java
===================================================================
---
trunk/hornetq-jms/src/main/java/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2011-11-02
16:16:14 UTC (rev 11632)
+++
trunk/hornetq-jms/src/main/java/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2011-11-02
16:16:50 UTC (rev 11633)
@@ -44,7 +44,6 @@
import org.hornetq.core.server.ServerConsumer;
import org.hornetq.core.server.ServerSession;
import org.hornetq.jms.client.HornetQDestination;
-import org.hornetq.jms.client.HornetQQueue;
import org.hornetq.jms.server.JMSServerManager;
import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
import org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
@@ -105,24 +104,24 @@
private static String[] determineJMSDestination(String coreAddress)
{
String[] result = new String[2]; // destination name & type
- if (coreAddress.startsWith(HornetQQueue.JMS_QUEUE_ADDRESS_PREFIX))
+ if (coreAddress.startsWith(HornetQDestination.JMS_QUEUE_ADDRESS_PREFIX))
{
- result[0] =
coreAddress.substring(HornetQQueue.JMS_QUEUE_ADDRESS_PREFIX.length());
+ result[0] =
coreAddress.substring(HornetQDestination.JMS_QUEUE_ADDRESS_PREFIX.length());
result[1] = "queue";
}
- else if (coreAddress.startsWith(HornetQQueue.JMS_TEMP_QUEUE_ADDRESS_PREFIX))
+ else if (coreAddress.startsWith(HornetQDestination.JMS_TEMP_QUEUE_ADDRESS_PREFIX))
{
- result[0] =
coreAddress.substring(HornetQQueue.JMS_TEMP_QUEUE_ADDRESS_PREFIX.length());
+ result[0] =
coreAddress.substring(HornetQDestination.JMS_TEMP_QUEUE_ADDRESS_PREFIX.length());
result[1] = "tempqueue";
}
- else if (coreAddress.startsWith(HornetQQueue.JMS_TOPIC_ADDRESS_PREFIX))
+ else if (coreAddress.startsWith(HornetQDestination.JMS_TOPIC_ADDRESS_PREFIX))
{
- result[0] =
coreAddress.substring(HornetQQueue.JMS_TOPIC_ADDRESS_PREFIX.length());
+ result[0] =
coreAddress.substring(HornetQDestination.JMS_TOPIC_ADDRESS_PREFIX.length());
result[1] = "topic";
}
- else if (coreAddress.startsWith(HornetQQueue.JMS_TEMP_TOPIC_ADDRESS_PREFIX))
+ else if (coreAddress.startsWith(HornetQDestination.JMS_TEMP_TOPIC_ADDRESS_PREFIX))
{
- result[0] =
coreAddress.substring(HornetQQueue.JMS_TEMP_TOPIC_ADDRESS_PREFIX.length());
+ result[0] =
coreAddress.substring(HornetQDestination.JMS_TEMP_TOPIC_ADDRESS_PREFIX.length());
result[1] = "temptopic";
}
else
@@ -914,44 +913,29 @@
CONNECTION_FACTORY_DESTROYED;
}
- private static List<String> toList(final String commaSeparatedString)
- {
- List<String> list = new ArrayList<String>();
- if (commaSeparatedString == null || commaSeparatedString.trim().length() == 0)
- {
- return list;
- }
- String[] values = commaSeparatedString.split(",");
- for (int i = 0; i < values.length; i++)
- {
- list.add(values[i].trim());
- }
- return list;
- }
-
public String[] listTargetDestinations(String sessionID) throws Exception
{
String[] addresses =
server.getHornetQServer().getHornetQServerControl().listTargetAddresses(sessionID);
Map<String, DestinationControl> allDests = new HashMap<String,
DestinationControl>();
Object[] queueControls =
server.getHornetQServer().getManagementService().getResources(JMSQueueControl.class);
- for (int i = 0; i < queueControls.length; i++)
+ for (Object queueControl2 : queueControls)
{
- JMSQueueControl queueControl = (JMSQueueControl)queueControls[i];
+ JMSQueueControl queueControl = (JMSQueueControl)queueControl2;
allDests.put(queueControl.getAddress(), queueControl);
}
Object[] topicControls =
server.getHornetQServer().getManagementService().getResources(TopicControl.class);
- for (int i = 0; i < topicControls.length; i++)
+ for (Object topicControl2 : topicControls)
{
- TopicControl topicControl = (TopicControl)topicControls[i];
+ TopicControl topicControl = (TopicControl)topicControl2;
allDests.put(topicControl.getAddress(), topicControl);
}
List<String> destinations = new ArrayList<String>();
- for (int i = 0; i < addresses.length; i++)
+ for (String addresse : addresses)
{
- DestinationControl control = allDests.get(addresses[i]);
+ DestinationControl control = allDests.get(addresse);
if (control != null)
{
destinations.add(control.getAddress());
Modified:
trunk/hornetq-jms/src/main/java/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java
===================================================================
---
trunk/hornetq-jms/src/main/java/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java 2011-11-02
16:16:14 UTC (rev 11632)
+++
trunk/hornetq-jms/src/main/java/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java 2011-11-02
16:16:50 UTC (rev 11633)
@@ -19,12 +19,9 @@
import java.util.ArrayList;
import java.util.List;
-import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.HornetQException;
-import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.jms.JMSFactoryType;
-import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.config.impl.Validators;
import org.hornetq.core.logging.Logger;