[jboss-cvs] JBoss Messaging SVN: r2319 - in trunk/src/main/org/jboss: jms/server and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Feb 15 02:16:11 EST 2007
Author: ovidiu.feodorov at jboss.com
Date: 2007-02-15 02:16:11 -0500 (Thu, 15 Feb 2007)
New Revision: 2319
Added:
trunk/src/main/org/jboss/jms/server/MessagingTimeoutFactory.java
Removed:
trunk/src/main/org/jboss/jms/server/MyTimeoutFactory.java
Modified:
trunk/src/main/org/jboss/jms/client/JBossSession.java
trunk/src/main/org/jboss/jms/server/ServerPeer.java
trunk/src/main/org/jboss/jms/server/destination/QueueService.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
trunk/src/main/org/jboss/messaging/core/ChannelSupport.java
trunk/src/main/org/jboss/messaging/core/plugin/contract/ClusteredPostOffice.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/Binding.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultPostOffice.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultRouter.java
Log:
minor reformatting, name changing
Modified: trunk/src/main/org/jboss/jms/client/JBossSession.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/JBossSession.java 2007-02-15 02:11:43 UTC (rev 2318)
+++ trunk/src/main/org/jboss/jms/client/JBossSession.java 2007-02-15 07:16:11 UTC (rev 2319)
@@ -401,10 +401,10 @@
public TemporaryQueue createTemporaryQueue() throws JMSException
{
- //As per spec. section 4.11
+ // As per spec. section 4.11
if (sessionType == TYPE_TOPIC_SESSION)
{
- throw new IllegalStateException("Cannot create a temp. queue using a TopicSession");
+ throw new IllegalStateException("Cannot create a temporary queue using a TopicSession");
}
JBossTemporaryQueue queue = new JBossTemporaryQueue(delegate);
delegate.addTemporaryDestination(queue);
@@ -413,7 +413,7 @@
public TemporaryTopic createTemporaryTopic() throws JMSException
{
- //As per spec. section 4.11
+ // As per spec. section 4.11
if (sessionType == TYPE_QUEUE_SESSION)
{
throw new IllegalStateException("Cannot create a temporary topic on a QueueSession");
@@ -425,7 +425,7 @@
public void unsubscribe(String name) throws JMSException
{
- //As per spec. section 4.11
+ // As per spec. section 4.11
if (sessionType == TYPE_QUEUE_SESSION)
{
throw new IllegalStateException("Cannot unsubscribe using a QueueSession");
Copied: trunk/src/main/org/jboss/jms/server/MessagingTimeoutFactory.java (from rev 2314, trunk/src/main/org/jboss/jms/server/MyTimeoutFactory.java)
===================================================================
--- trunk/src/main/org/jboss/jms/server/MessagingTimeoutFactory.java (rev 0)
+++ trunk/src/main/org/jboss/jms/server/MessagingTimeoutFactory.java 2007-02-15 07:16:11 UTC (rev 2319)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jms.server;
+
+import org.jboss.util.threadpool.BasicThreadPool;
+import org.jboss.util.threadpool.ThreadPool;
+import org.jboss.util.timeout.TimeoutFactory;
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ *
+ */
+public class MessagingTimeoutFactory
+{
+ // Constants ------------------------------------------------------------------------------------
+
+ // Static ---------------------------------------------------------------------------------------
+
+ public static MessagingTimeoutFactory instance = new MessagingTimeoutFactory();
+
+ // Attributes -----------------------------------------------------------------------------------
+
+ private TimeoutFactory factory;
+
+ // Constructors ---------------------------------------------------------------------------------
+
+ private MessagingTimeoutFactory()
+ {
+ createFactory();
+ }
+
+ // Public ---------------------------------------------------------------------------------------
+
+ public TimeoutFactory getFactory()
+ {
+ return factory;
+ }
+
+ public synchronized void reset()
+ {
+ factory.cancel();
+ createFactory();
+ }
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ private void createFactory()
+ {
+ ThreadPool threadPool = new BasicThreadPool("Messaging Timeout");
+ factory = new TimeoutFactory(threadPool);
+ }
+
+ // Inner classes --------------------------------------------------------------------------------
+
+}
Property changes on: trunk/src/main/org/jboss/jms/server/MessagingTimeoutFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id LastChangedDate Author Revision
Deleted: trunk/src/main/org/jboss/jms/server/MyTimeoutFactory.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/MyTimeoutFactory.java 2007-02-15 02:11:43 UTC (rev 2318)
+++ trunk/src/main/org/jboss/jms/server/MyTimeoutFactory.java 2007-02-15 07:16:11 UTC (rev 2319)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jms.server;
-
-import org.jboss.util.threadpool.BasicThreadPool;
-import org.jboss.util.threadpool.ThreadPool;
-import org.jboss.util.timeout.TimeoutFactory;
-
-/**
- * A TimeoutFactory
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- *
- */
-public class MyTimeoutFactory
-{
- public static MyTimeoutFactory instance = new MyTimeoutFactory();
-
- private ThreadPool threadPool;
-
- private TimeoutFactory factory;
-
- private MyTimeoutFactory()
- {
- createFactory();
- }
-
- public TimeoutFactory getFactory()
- {
- return factory;
- }
-
- public synchronized void reset()
- {
- factory.cancel();
-
- createFactory();
- }
-
- private void createFactory()
- {
- threadPool = new BasicThreadPool();
-
- factory = new TimeoutFactory(threadPool);
- }
-}
Modified: trunk/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/ServerPeer.java 2007-02-15 02:11:43 UTC (rev 2318)
+++ trunk/src/main/org/jboss/jms/server/ServerPeer.java 2007-02-15 07:16:11 UTC (rev 2319)
@@ -331,7 +331,7 @@
queuedExecutorPool.shutdown();
- MyTimeoutFactory.instance.reset();
+ MessagingTimeoutFactory.instance.reset();
log.info("JMS " + this + " stopped");
}
Modified: trunk/src/main/org/jboss/jms/server/destination/QueueService.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/destination/QueueService.java 2007-02-15 02:11:43 UTC (rev 2318)
+++ trunk/src/main/org/jboss/jms/server/destination/QueueService.java 2007-02-15 07:16:11 UTC (rev 2319)
@@ -36,15 +36,15 @@
*/
public class QueueService extends DestinationServiceSupport implements QueueMBean
{
- // Constants -----------------------------------------------------
+ // Constants ------------------------------------------------------------------------------------
private static final String QUEUE_MESSAGECOUNTER_PREFIX = "Queue.";
- // Static --------------------------------------------------------
+ // Static ---------------------------------------------------------------------------------------
- // Attributes ----------------------------------------------------
+ // Attributes -----------------------------------------------------------------------------------
- // Constructors --------------------------------------------------
+ // Constructors ---------------------------------------------------------------------------------
public QueueService()
{
@@ -58,7 +58,7 @@
destination = new ManagedQueue();
}
- // ServiceMBeanSupport overrides --------------------------------
+ // ServiceMBeanSupport overrides ----------------------------------------------------------------
public synchronized void startService() throws Exception
{
@@ -70,11 +70,9 @@
destination.setServerPeer(serverPeer);
- //Binding must be added before destination is registered in JNDI
- //otherwise the user could get a reference to the destination and use it
- //while it is still being loaded
-
- //Binding might already exist
+ // Binding must be added before destination is registered in JNDI otherwise the user could
+ // get a reference to the destination and use it while it is still being loaded. Also,
+ // binding might already exist.
Binding binding = postOffice.getBindingForQueueName(destination.getName());
@@ -84,37 +82,39 @@
{
queue = (PagingFilteredQueue)binding.getQueue();
- queue.setPagingParams(destination.getFullSize(), destination.getPageSize(), destination.getDownCacheSize());
+ queue.setPagingParams(destination.getFullSize(),
+ destination.getPageSize(),
+ destination.getDownCacheSize());
queue.load();
- //Must be done after load
+ // Must be done after load
queue.setMaxSize(destination.getMaxSize());
-
queue.activate();
}
else
{
QueuedExecutor executor = (QueuedExecutor)pool.get();
- //Create a new queue
+ // Create a new queue
JMSCondition queueCond = new JMSCondition(true, destination.getName());
if (postOffice.isLocal())
{
- queue = new PagingFilteredQueue(destination.getName(), idm.getID(), ms, pm, true, true,
- executor, destination.getMaxSize(), null,
- destination.getFullSize(), destination.getPageSize(), destination.getDownCacheSize());
-
-
-
+ queue = new PagingFilteredQueue(destination.getName(),
+ idm.getID(), ms, pm, true, true, executor,
+ destination.getMaxSize(), null,
+ destination.getFullSize(), destination.getPageSize(),
+ destination.getDownCacheSize());
postOffice.bindQueue(queueCond, queue);
}
else
{
- queue = new LocalClusteredQueue(postOffice, nodeId, destination.getName(), idm.getID(), ms, pm, true, true,
- executor, destination.getMaxSize(), null, tr,
- destination.getFullSize(), destination.getPageSize(), destination.getDownCacheSize());
+ queue = new LocalClusteredQueue(postOffice, nodeId, destination.getName(),
+ idm.getID(), ms, pm, true, true, executor,
+ destination.getMaxSize(), null, tr,
+ destination.getFullSize(), destination.getPageSize(),
+ destination.getDownCacheSize());
ClusteredPostOffice cpo = (ClusteredPostOffice)postOffice;
@@ -193,10 +193,9 @@
ExceptionUtil.handleJMXInvocation(t, this + " stopService");
}
}
+
+ // JMX managed attributes -----------------------------------------------------------------------
-
- // JMX managed attributes ----------------------------------------
-
public int getMessageCount() throws Exception
{
try
@@ -258,7 +257,7 @@
return ((ManagedQueue)destination).getConsumersCount();
}
- // JMX managed operations ----------------------------------------
+ // JMX managed operations -----------------------------------------------------------------------
public void removeAllMessages() throws Exception
{
@@ -401,18 +400,18 @@
((ManagedQueue)destination).getMessageCounter().resetHistory();
}
- // Public --------------------------------------------------------
+ // Public ---------------------------------------------------------------------------------------
- // Package protected ---------------------------------------------
+ // Package protected ----------------------------------------------------------------------------
- // Protected -----------------------------------------------------
+ // Protected ------------------------------------------------------------------------------------
protected boolean isQueue()
{
return true;
}
- // Private -------------------------------------------------------
+ // Private --------------------------------------------------------------------------------------
- // Inner classes -------------------------------------------------
+ // Inner classes --------------------------------------------------------------------------------
}
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2007-02-15 02:11:43 UTC (rev 2318)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2007-02-15 07:16:11 UTC (rev 2319)
@@ -528,9 +528,10 @@
throw new InvalidDestinationException("Destination:" + dest +
" is not a temporary destination");
}
+
connectionEndpoint.addTemporaryDestination(dest);
- //Register with the destination manager
+ // Register with the destination manager
ManagedDestination mDest;
@@ -553,20 +554,20 @@
{
QueuedExecutor executor = (QueuedExecutor)pool.get();
- PagingFilteredQueue q =
+ PagingFilteredQueue coreQueue =
new PagingFilteredQueue(dest.getName(), idm.getID(), ms, pm, true, false,
executor, -1, null, fullSize, pageSize, downCacheSize);
String counterName = TEMP_QUEUE_MESSAGECOUNTER_PREFIX + dest.getName();
MessageCounter counter =
- new MessageCounter(counterName, null, q, false, false,
+ new MessageCounter(counterName, null, coreQueue, false, false,
sp.getDefaultMessageCounterHistoryDayLimit());
sp.getMessageCounterManager().registerMessageCounter(counterName, counter);
- //Make a binding for this queue
- postOffice.bindQueue(new JMSCondition(true, dest.getName()), q);
+ // Make a binding for this queue
+ postOffice.bindQueue(new JMSCondition(true, dest.getName()), coreQueue);
}
}
catch (Throwable t)
Modified: trunk/src/main/org/jboss/messaging/core/ChannelSupport.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/ChannelSupport.java 2007-02-15 02:11:43 UTC (rev 2318)
+++ trunk/src/main/org/jboss/messaging/core/ChannelSupport.java 2007-02-15 07:16:11 UTC (rev 2319)
@@ -28,7 +28,7 @@
import java.util.ListIterator;
import java.util.Set;
-import org.jboss.jms.server.MyTimeoutFactory;
+import org.jboss.jms.server.MessagingTimeoutFactory;
import org.jboss.logging.Logger;
import org.jboss.messaging.core.message.MessageReference;
import org.jboss.messaging.core.plugin.contract.MessageStore;
@@ -845,14 +845,13 @@
{
if (trace) { log.trace("Scheduling delivery for " + ref + " to occur at " + ref.getScheduledDeliveryTime()); }
- //Schedule the cancel to actually occur at the specified time
-
- //Need to synchronize to prevent timeout being removed before it is added
+ // Schedule the cancel to actually occur at the specified time. Need to synchronize to
+ // prevent timeout being removed before it is added.
synchronized (scheduledDeliveries)
{
Timeout timeout =
- MyTimeoutFactory.instance.getFactory().schedule(ref.getScheduledDeliveryTime(),
- new DeliverRefTimeoutTarget(ref));
+ MessagingTimeoutFactory.instance.getFactory().
+ schedule(ref.getScheduledDeliveryTime(), new DeliverRefTimeoutTarget(ref));
scheduledDeliveries.add(timeout);
}
Modified: trunk/src/main/org/jboss/messaging/core/plugin/contract/ClusteredPostOffice.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/contract/ClusteredPostOffice.java 2007-02-15 02:11:43 UTC (rev 2318)
+++ trunk/src/main/org/jboss/messaging/core/plugin/contract/ClusteredPostOffice.java 2007-02-15 07:16:11 UTC (rev 2319)
@@ -28,9 +28,6 @@
import org.jboss.messaging.core.plugin.postoffice.cluster.Peer;
/**
- *
- * A ClusteredPostOffice
- *
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
* @version <tt>$Revision$</tt>
@@ -44,20 +41,17 @@
public static final String FAILOVER_COMPLETED_NOTIFICATION = "FAILOVER_COMPLETED";
/**
- * Bind a queue to the post office under a specific condition
- * such that it is available across the cluster
- * @param condition The condition to be used when routing references
- * @param queue
- * @return
- * @throws Exception
+ * Bind a queue to the post office under a specific condition such that it is available across
+ * the cluster.
+ *
+ * @param condition - the condition to be used when routing references.
*/
Binding bindClusteredQueue(Condition condition, LocalClusteredQueue queue) throws Exception;
/**
- * Unbind a clustered queue from the post office
- * @param queueName The unique name of the queue
- * @return
- * @throws Throwable
+ * Unbind a clustered queue from the post office.
+ *
+ * @param queueName - the unique name of the queue.
*/
Binding unbindClusteredQueue(String queueName) throws Throwable;
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/Binding.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/Binding.java 2007-02-15 02:11:43 UTC (rev 2318)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/Binding.java 2007-02-15 07:16:11 UTC (rev 2319)
@@ -25,8 +25,6 @@
import org.jboss.messaging.core.plugin.contract.Condition;
/**
- * A Binding
- *
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
*
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultPostOffice.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultPostOffice.java 2007-02-15 02:11:43 UTC (rev 2318)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultPostOffice.java 2007-02-15 07:16:11 UTC (rev 2319)
@@ -187,7 +187,7 @@
try
{
- //We currently only allow one binding per name per node
+ // We currently only allow one binding per name per node
Map nameMap = (Map)nameMaps.get(new Integer(currentNodeId));
Binding binding = null;
@@ -208,7 +208,7 @@
if (queue.isRecoverable())
{
- //Need to write the binding to the db
+ // Need to write the binding to the database
insertBinding(binding);
}
@@ -808,7 +808,6 @@
if (bindings == null)
{
bindings = new DefaultBindings();
-
conditionMap.put(condition, bindings);
}
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java 2007-02-15 02:11:43 UTC (rev 2318)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java 2007-02-15 07:16:11 UTC (rev 2319)
@@ -434,15 +434,16 @@
// ClusteredPostOffice implementation -----------------------------------------------------------
- public Binding bindClusteredQueue(Condition condition, LocalClusteredQueue queue) throws Exception
+ public Binding bindClusteredQueue(Condition condition, LocalClusteredQueue queue)
+ throws Exception
{
- if (trace) { log.trace(this.currentNodeId + " binding clustered queue: " + queue + " with condition: " + condition); }
+ if (trace) { log.trace(this.currentNodeId + " binding clustered queue " + queue + " with condition " + condition); }
if (queue.getNodeId() != this.currentNodeId)
{
log.warn("queue.getNodeId is not this node");
//throw new IllegalArgumentException("Queue node id does not match office node id");
- // todo what to do when HA failing?
+ // TODO what to do when HA failing?
}
Binding binding = (Binding)super.bindQueue(condition, queue);
@@ -1523,14 +1524,13 @@
if (router == null)
{
router = routerFactory.createRouter();
-
routerMap.put(queueName, router);
-
bindings.addRouter(queueName, router);
}
- // todo: Maybe we should have isFailed as a property of Queue instead of Binding, so we won't need to change this signature.
- router.add(binding.getQueue(),binding.isFailed());
+ // TODO Maybe we should have isFailed as a property of Queue instead of Binding, so we won't
+ // need to change this signature.
+ router.add(binding.getQueue(), binding.isFailed());
}
protected void removeFromConditionMap(Binding binding)
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultRouter.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultRouter.java 2007-02-15 02:11:43 UTC (rev 2318)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultRouter.java 2007-02-15 07:16:11 UTC (rev 2319)
@@ -187,7 +187,7 @@
public boolean add(Receiver receiver)
{
- return add(receiver,false);
+ return add(receiver, false);
}
public boolean remove(Receiver queue)
@@ -195,7 +195,6 @@
if (localQueue == queue)
{
localQueue = null;
-
return true;
}
else
@@ -227,7 +226,6 @@
return nonLocalQueues.size() + (localQueue != null ? 1 : 0);
}
-
// ClusterRouter implementation -----------------------------------------------------------------
public List getQueues()
@@ -268,7 +266,7 @@
{
if (localQueue != null)
{
- throw new IllegalStateException("Already has local queue");
+ throw new IllegalStateException(this + " already has local queue");
}
localQueue = queue;
}
More information about the jboss-cvs-commits
mailing list