[jboss-cvs] JBoss Messaging SVN: r4832 - in branches/Branch_JBMESSAGING-1314: src/main/org/jboss/messaging/core/paging and 8 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Aug 18 12:13:23 EDT 2008
Author: clebert.suconic at jboss.com
Date: 2008-08-18 12:13:23 -0400 (Mon, 18 Aug 2008)
New Revision: 4832
Added:
branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/PagingStoreFactory.java
branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingManagerFactoryNIO.java
Removed:
branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingManagerNIOSPI.java
branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingManagerSPI.java
Modified:
branches/Branch_JBMESSAGING-1314/native/bin/libJBMLibAIO64.so
branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/PagingManager.java
branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/PagingStore.java
branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingManagerImpl.java
branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingStoreImpl.java
branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/postoffice/PostOffice.java
branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
branches/Branch_JBMESSAGING-1314/tests/jms-tests/src/org/jboss/test/messaging/jms/QueueRequestorTest.java
branches/Branch_JBMESSAGING-1314/tests/src/org/jboss/messaging/tests/integration/paging/PagingManagerIntegrationTest.java
branches/Branch_JBMESSAGING-1314/tests/src/org/jboss/messaging/tests/performance/persistence/FakePostOffice.java
branches/Branch_JBMESSAGING-1314/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PageManagerImplTest.java
branches/Branch_JBMESSAGING-1314/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PagingStoreImplTest.java
Log:
first commit integrating Paging on PostOffice
Modified: branches/Branch_JBMESSAGING-1314/native/bin/libJBMLibAIO64.so
===================================================================
(Binary files differ)
Modified: branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/PagingManager.java
===================================================================
--- branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/PagingManager.java 2008-08-18 15:34:13 UTC (rev 4831)
+++ branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/PagingManager.java 2008-08-18 16:13:23 UTC (rev 4832)
@@ -23,6 +23,7 @@
package org.jboss.messaging.core.paging;
import org.jboss.messaging.core.server.MessagingComponent;
+import org.jboss.messaging.util.SimpleString;
/**
*
@@ -33,5 +34,5 @@
*/
public interface PagingManager extends MessagingComponent
{
- public PagingStore getPageStore(String storeName) throws Exception;
+ public PagingStore getPageStore(SimpleString storeName) throws Exception;
}
Modified: branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/PagingStore.java
===================================================================
--- branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/PagingStore.java 2008-08-18 15:34:13 UTC (rev 4831)
+++ branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/PagingStore.java 2008-08-18 16:13:23 UTC (rev 4832)
@@ -44,6 +44,8 @@
void startPaging() throws Exception;
+ boolean isPaging();
+
void sync() throws Exception;
boolean writeOnCurrentPage(ServerMessage message) throws Exception;
Added: branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/PagingStoreFactory.java
===================================================================
--- branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/PagingStoreFactory.java (rev 0)
+++ branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/PagingStoreFactory.java 2008-08-18 16:13:23 UTC (rev 4832)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.core.paging;
+
+
+/**
+ * The integration point between the PagingManger and the File System (aka SequentialFiles)
+ *
+ * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
+ *
+ */
+public interface PagingStoreFactory
+{
+
+ PagingStore newStore(String destinationName);
+
+}
Copied: branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingManagerFactoryNIO.java (from rev 4803, branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingManagerNIOSPI.java)
===================================================================
--- branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingManagerFactoryNIO.java (rev 0)
+++ branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingManagerFactoryNIO.java 2008-08-18 16:13:23 UTC (rev 4832)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.core.paging.impl;
+
+import java.io.File;
+
+import org.jboss.messaging.core.journal.impl.NIOSequentialFileFactory;
+import org.jboss.messaging.core.paging.PagingStore;
+import org.jboss.messaging.core.paging.PagingStoreFactory;
+
+/**
+ *
+ * Integration point between Paging and NIO
+ * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
+ *
+ */
+public class PagingManagerFactoryNIO implements PagingStoreFactory
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private final String directory;
+ private final int pageSize;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public PagingManagerFactoryNIO(final String directory, final int pageSize)
+ {
+ this.directory = directory;
+ this.pageSize = pageSize;
+ }
+
+ // Public --------------------------------------------------------
+
+ public PagingStore newStore(String destinationName)
+ {
+ final String destinationDirectory = directory + "/" + destinationName;
+ File destinationFile = new File(destinationDirectory);
+ destinationFile.mkdirs();
+
+ return new PagingStoreImpl(new NIOSequentialFileFactory(destinationDirectory), destinationName, pageSize);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingManagerImpl.java
===================================================================
--- branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingManagerImpl.java 2008-08-18 15:34:13 UTC (rev 4831)
+++ branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingManagerImpl.java 2008-08-18 16:13:23 UTC (rev 4832)
@@ -28,6 +28,8 @@
import org.jboss.messaging.core.paging.PagingManager;
import org.jboss.messaging.core.paging.PagingStore;
+import org.jboss.messaging.core.paging.PagingStoreFactory;
+import org.jboss.messaging.util.SimpleString;
/**
*
@@ -42,22 +44,22 @@
private volatile boolean started = false;
- private final ConcurrentMap<String, PagingStore> stores = new ConcurrentHashMap<String, PagingStore>();
+ private final ConcurrentMap<SimpleString, PagingStore> stores = new ConcurrentHashMap<SimpleString, PagingStore>();
- private final PagingManagerSPI pagingSPI;
+ private final PagingStoreFactory pagingSPI;
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
- public PagingManagerImpl(final PagingManagerSPI pagingSPI)
+ public PagingManagerImpl(final PagingStoreFactory pagingSPI)
{
this.pagingSPI = pagingSPI;
}
// Public --------------------------------------------------------
- public PagingStore getPageStore(String storeName) throws Exception
+ public PagingStore getPageStore(SimpleString storeName) throws Exception
{
validateStarted();
@@ -65,11 +67,14 @@
if (store == null)
{
- store = newStore(storeName);
+ store = newStore(storeName.toString());
- stores.putIfAbsent(storeName, store);
+ PagingStore oldStore = stores.putIfAbsent(storeName, store);
- store = stores.get(storeName);
+ if (oldStore != null)
+ {
+ store = oldStore;
+ }
store.start();
}
Deleted: branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingManagerNIOSPI.java
===================================================================
--- branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingManagerNIOSPI.java 2008-08-18 15:34:13 UTC (rev 4831)
+++ branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingManagerNIOSPI.java 2008-08-18 16:13:23 UTC (rev 4832)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.core.paging.impl;
-
-import java.io.File;
-
-import org.jboss.messaging.core.journal.impl.NIOSequentialFileFactory;
-import org.jboss.messaging.core.paging.PagingStore;
-
-/**
- *
- * Integration point between Paging and NIO
- * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
- *
- */
-public class PagingManagerNIOSPI implements PagingManagerSPI
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private final String directory;
- private final int pageSize;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public PagingManagerNIOSPI(final String directory, final int pageSize)
- {
- this.directory = directory;
- this.pageSize = pageSize;
- }
-
- // Public --------------------------------------------------------
-
- public PagingStore newStore(String destinationName)
- {
- final String destinationDirectory = directory + "/" + destinationName;
- File destinationFile = new File(destinationDirectory);
- destinationFile.mkdirs();
-
- return new PagingStoreImpl(new NIOSequentialFileFactory(destinationDirectory), destinationName, pageSize);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Deleted: branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingManagerSPI.java
===================================================================
--- branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingManagerSPI.java 2008-08-18 15:34:13 UTC (rev 4831)
+++ branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingManagerSPI.java 2008-08-18 16:13:23 UTC (rev 4832)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.core.paging.impl;
-
-import org.jboss.messaging.core.paging.PagingStore;
-
-/**
- * The integration point between the PagingManger and the File System (aka SequentialFiles)
- *
- * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
- *
- */
-public interface PagingManagerSPI
-{
-
- PagingStore newStore(String destinationName);
-
-}
Modified: branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingStoreImpl.java
===================================================================
--- branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingStoreImpl.java 2008-08-18 15:34:13 UTC (rev 4831)
+++ branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/paging/impl/PagingStoreImpl.java 2008-08-18 16:13:23 UTC (rev 4832)
@@ -88,6 +88,19 @@
// PagingStore implementation ------------------------------------
+ public boolean isPaging()
+ {
+ lock.readLock().lock();
+ try
+ {
+ return currentPage != null;
+ }
+ finally
+ {
+ lock.readLock().unlock();
+ }
+ }
+
public int getNumberOfPages()
{
return numberOfPages;
@@ -157,6 +170,9 @@
int bytesToWrite = factory.calculateBlockSize(message.getEncodeSize() + PageImpl.SIZE_RECORD);
+
+ // This would be a synchronized block... (but using a Semaphore)
+
globalLock.acquire();
try
@@ -190,6 +206,8 @@
globalLock.release();
}
+ // End of a synchronized block..
+
try
{
if (currentPage != null)
Modified: branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/postoffice/PostOffice.java
===================================================================
--- branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/postoffice/PostOffice.java 2008-08-18 15:34:13 UTC (rev 4831)
+++ branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/postoffice/PostOffice.java 2008-08-18 16:13:23 UTC (rev 4832)
@@ -80,4 +80,27 @@
Map<SimpleString, List<Binding>> getMappings();
Set<SimpleString> listAllDestinations();
+
+ /**
+ * To be used by transactions only.
+ * If you're sure you will page if isPaging, just call the method page and look at its return.
+ * @param destination
+ * @return
+ */
+ boolean isPaging(SimpleString destination) throws Exception;
+
+ /**
+ * If the destination is not being paged, this method will return false
+ * @param message
+ * @return
+ */
+ boolean page(ServerMessage message) throws Exception;
+
+ /**
+ *
+ * To be called whenever message is being deleted. (i.e. no references)
+ * @param message
+ */
+ void messageRemoved(ServerMessage message) throws Exception;
+
}
Modified: branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java 2008-08-18 15:34:13 UTC (rev 4831)
+++ branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java 2008-08-18 16:13:23 UTC (rev 4832)
@@ -22,9 +22,22 @@
package org.jboss.messaging.core.postoffice.impl;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.atomic.AtomicLong;
+
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.filter.Filter;
import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.paging.PagingManager;
import org.jboss.messaging.core.persistence.StorageManager;
import org.jboss.messaging.core.postoffice.Binding;
import org.jboss.messaging.core.postoffice.FlowController;
@@ -37,11 +50,6 @@
import org.jboss.messaging.util.ConcurrentSet;
import org.jboss.messaging.util.SimpleString;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-
/**
*
* A PostOfficeImpl
@@ -63,15 +71,22 @@
private final ConcurrentMap<SimpleString, FlowController> flowControllers = new ConcurrentHashMap<SimpleString, FlowController>();
+ private final ConcurrentMap<SimpleString, AtomicLong> queueSize = new ConcurrentHashMap<SimpleString, AtomicLong>();
+
+ private final AtomicLong totalSize = new AtomicLong(0);
+
private final QueueFactory queueFactory;
private final boolean checkAllowable;
private final StorageManager storageManager;
+ private final PagingManager pagingManager;
+
private volatile boolean started;
public PostOfficeImpl(final StorageManager storageManager,
+ final PagingManager pagingManager,
final QueueFactory queueFactory, final boolean checkAllowable)
{
this.storageManager = storageManager;
@@ -79,6 +94,8 @@
this.queueFactory = queueFactory;
this.checkAllowable = checkAllowable;
+
+ this.pagingManager = pagingManager;
}
// MessagingComponent implementation ---------------------------------------
@@ -200,6 +217,8 @@
public List<MessageReference> route(final ServerMessage message) throws Exception
{
+ getQueueSize(message.getDestination()).addAndGet(message.getEncodeSize());
+
SimpleString address = message.getDestination();
if (checkAllowable)
@@ -254,7 +273,25 @@
// }
// }
// }
+
+ public boolean isPaging(SimpleString destination) throws Exception
+ {
+ return pagingManager.getPageStore(destination).isPaging();
+ }
+
+ public void messageRemoved(ServerMessage message)
+ {
+ addSize(message.getDestination(), message.getEncodeSize() * -1);
+ }
+
+ public boolean page(ServerMessage message) throws Exception
+ {
+ return pagingManager.getPageStore(message.getDestination()).writeOnCurrentPage(message);
+ }
+
+
+
public Map<SimpleString, List<Binding>> getMappings()
{
return mappings;
@@ -267,6 +304,29 @@
// Private -----------------------------------------------------------------
+
+ private void addSize(SimpleString destination, long size)
+ {
+ getQueueSize(destination).addAndGet(size);
+ totalSize.addAndGet(size);
+ }
+
+ private AtomicLong getQueueSize(SimpleString destination)
+ {
+ AtomicLong size = this.queueSize.get(destination);
+ if (size == null)
+ {
+ size = new AtomicLong(0);
+ AtomicLong oldSize = this.queueSize.putIfAbsent(destination, size);
+ if (oldSize != null)
+ {
+ size = oldSize;
+ }
+ }
+
+ return size;
+ }
+
private Binding createBinding(final SimpleString address, final SimpleString name, final Filter filter,
final boolean durable, final boolean temporary)
{
@@ -365,5 +425,4 @@
storageManager.loadMessages(this, queues);
}
-
}
Modified: branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
===================================================================
--- branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java 2008-08-18 15:34:13 UTC (rev 4831)
+++ branches/Branch_JBMESSAGING-1314/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java 2008-08-18 16:13:23 UTC (rev 4832)
@@ -33,6 +33,9 @@
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.management.MessagingServerManagement;
import org.jboss.messaging.core.management.impl.MessagingServerManagementImpl;
+import org.jboss.messaging.core.paging.PagingStoreFactory;
+import org.jboss.messaging.core.paging.impl.PagingManagerFactoryNIO;
+import org.jboss.messaging.core.paging.impl.PagingManagerImpl;
import org.jboss.messaging.core.persistence.StorageManager;
import org.jboss.messaging.core.postoffice.PostOffice;
import org.jboss.messaging.core.postoffice.impl.PostOfficeImpl;
@@ -166,7 +169,8 @@
queueSettingsRepository.setDefault(new QueueSettings());
scheduledExecutor = new ScheduledThreadPoolExecutor(configuration.getScheduledThreadPoolMaxSize(), new JBMThreadFactory("JBM-scheduled-threads"));
queueFactory = new QueueFactoryImpl(scheduledExecutor, queueSettingsRepository);
- postOffice = new PostOfficeImpl(storageManager, queueFactory, configuration.isRequireDestinations());
+ postOffice = new PostOfficeImpl(storageManager, new PagingManagerImpl(new PagingManagerFactoryNIO("/tmp/factory", 10*1024*1024)),
+ queueFactory, configuration.isRequireDestinations());
securityRepository = new HierarchicalObjectRepository<Set<Role>>();
securityRepository.setDefault(new HashSet<Role>());
Modified: branches/Branch_JBMESSAGING-1314/tests/jms-tests/src/org/jboss/test/messaging/jms/QueueRequestorTest.java
===================================================================
--- branches/Branch_JBMESSAGING-1314/tests/jms-tests/src/org/jboss/test/messaging/jms/QueueRequestorTest.java 2008-08-18 15:34:13 UTC (rev 4831)
+++ branches/Branch_JBMESSAGING-1314/tests/jms-tests/src/org/jboss/test/messaging/jms/QueueRequestorTest.java 2008-08-18 16:13:23 UTC (rev 4832)
@@ -21,10 +21,14 @@
*/
package org.jboss.test.messaging.jms;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
+import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
import javax.jms.QueueConnection;
import javax.jms.QueueReceiver;
import javax.jms.QueueRequestor;
@@ -94,8 +98,9 @@
if (conn1 != null) conn1.close();
if (conn2 != null) conn2.close();
}
- }
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: branches/Branch_JBMESSAGING-1314/tests/src/org/jboss/messaging/tests/integration/paging/PagingManagerIntegrationTest.java
===================================================================
--- branches/Branch_JBMESSAGING-1314/tests/src/org/jboss/messaging/tests/integration/paging/PagingManagerIntegrationTest.java 2008-08-18 15:34:13 UTC (rev 4831)
+++ branches/Branch_JBMESSAGING-1314/tests/src/org/jboss/messaging/tests/integration/paging/PagingManagerIntegrationTest.java 2008-08-18 16:13:23 UTC (rev 4832)
@@ -29,7 +29,7 @@
import org.jboss.messaging.core.paging.Page;
import org.jboss.messaging.core.paging.PagingStore;
import org.jboss.messaging.core.paging.impl.PagingManagerImpl;
-import org.jboss.messaging.core.paging.impl.PagingManagerNIOSPI;
+import org.jboss.messaging.core.paging.impl.PagingManagerFactoryNIO;
import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.core.server.impl.ServerMessageImpl;
@@ -60,10 +60,10 @@
public void testPagingManagerNIO() throws Exception
{
PagingManagerImpl managerImpl =
- new PagingManagerImpl(new PagingManagerNIOSPI(journalDir, 1024*1024));
+ new PagingManagerImpl(new PagingManagerFactoryNIO(journalDir, 1024*1024));
managerImpl.start();
- PagingStore store = managerImpl.getPageStore("simple-test");
+ PagingStore store = managerImpl.getPageStore(new SimpleString("simple-test"));
ServerMessage msg = createMessage(1l, new SimpleString("simple-test"), createRandomBuffer(10));
Modified: branches/Branch_JBMESSAGING-1314/tests/src/org/jboss/messaging/tests/performance/persistence/FakePostOffice.java
===================================================================
--- branches/Branch_JBMESSAGING-1314/tests/src/org/jboss/messaging/tests/performance/persistence/FakePostOffice.java 2008-08-18 15:34:13 UTC (rev 4831)
+++ branches/Branch_JBMESSAGING-1314/tests/src/org/jboss/messaging/tests/performance/persistence/FakePostOffice.java 2008-08-18 16:13:23 UTC (rev 4832)
@@ -131,8 +131,21 @@
public List<org.jboss.messaging.core.server.MessageReference> route(
ServerMessage message) throws Exception
{
- // TODO Auto-generated method stub
return null;
}
+
+ public boolean isPaging(SimpleString destination) throws Exception
+ {
+ return false;
+ }
+
+ public void messageRemoved(ServerMessage message) throws Exception
+ {
+ }
+
+ public boolean page(ServerMessage message) throws Exception
+ {
+ return false;
+ }
}
Modified: branches/Branch_JBMESSAGING-1314/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PageManagerImplTest.java
===================================================================
--- branches/Branch_JBMESSAGING-1314/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PageManagerImplTest.java 2008-08-18 15:34:13 UTC (rev 4831)
+++ branches/Branch_JBMESSAGING-1314/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PageManagerImplTest.java 2008-08-18 16:13:23 UTC (rev 4832)
@@ -29,10 +29,11 @@
import org.easymock.EasyMock;
import org.jboss.messaging.core.journal.SequentialFileFactory;
import org.jboss.messaging.core.paging.PagingStore;
+import org.jboss.messaging.core.paging.PagingStoreFactory;
import org.jboss.messaging.core.paging.impl.PagingManagerImpl;
-import org.jboss.messaging.core.paging.impl.PagingManagerSPI;
import org.jboss.messaging.core.paging.impl.PagingStoreImpl;
import org.jboss.messaging.tests.util.UnitTestCase;
+import org.jboss.messaging.util.SimpleString;
public class PageManagerImplTest extends UnitTestCase
{
@@ -50,10 +51,10 @@
public void testGetStore() throws Exception
{
- PagingManagerSPI spi = EasyMock.createMock(PagingManagerSPI.class);
+ PagingStoreFactory spi = EasyMock.createMock(PagingStoreFactory.class);
PagingManagerImpl manager = new PagingManagerImpl(spi);
- String destination = "some-destination";
+ SimpleString destination = new SimpleString("some-destination");
try
{
@@ -68,7 +69,7 @@
PagingStore store = EasyMock.createNiceMock(PagingStore.class);
- EasyMock.expect(spi.newStore(destination)).andReturn(store);
+ EasyMock.expect(spi.newStore(destination.toString())).andReturn(store);
store.start();
@@ -103,18 +104,18 @@
public void testMultipleThreadsGetStore() throws Exception
{
- PagingManagerSPI spi = EasyMock.createMock(PagingManagerSPI.class);
+ PagingStoreFactory spi = EasyMock.createMock(PagingStoreFactory.class);
final PagingManagerImpl manager = new PagingManagerImpl(spi);
- final String destination = "some-destination";
+ final SimpleString destination = new SimpleString("some-destination");
final SequentialFileFactory factory = EasyMock.createNiceMock(SequentialFileFactory.class);
EasyMock.expect(factory.listFiles(EasyMock.isA(String.class))).andStubReturn(new ArrayList<String>());
- PagingStoreImpl storeImpl = new PagingStoreImpl(factory, destination, 1);
+ PagingStoreImpl storeImpl = new PagingStoreImpl(factory, destination.toString(), 1);
- EasyMock.expect(spi.newStore(destination)).andStubReturn(storeImpl);
+ EasyMock.expect(spi.newStore(destination.toString())).andStubReturn(storeImpl);
EasyMock.replay(spi, factory);
Modified: branches/Branch_JBMESSAGING-1314/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PagingStoreImplTest.java
===================================================================
--- branches/Branch_JBMESSAGING-1314/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PagingStoreImplTest.java 2008-08-18 15:34:13 UTC (rev 4831)
+++ branches/Branch_JBMESSAGING-1314/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PagingStoreImplTest.java 2008-08-18 16:13:23 UTC (rev 4832)
@@ -93,6 +93,8 @@
ServerMessage msg = createMessage(1l, destination, buffer);
+ assertTrue(storeImpl.isPaging());
+
assertTrue(storeImpl.writeOnCurrentPage(msg));
assertEquals(1, storeImpl.getNumberOfPages());
@@ -223,6 +225,8 @@
ServerMessage msg = createMessage(100, destination, buffers.get(0));
+ assertFalse(storeImpl.isPaging());
+
assertFalse(storeImpl.writeOnCurrentPage(msg));
storeImpl.startPaging();
More information about the jboss-cvs-commits
mailing list