[jboss-cvs] JBoss Messaging SVN: r4332 - in trunk: src/main/org/jboss/messaging/core/client/impl and 15 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu May 29 04:48:01 EDT 2008
Author: timfox
Date: 2008-05-29 04:48:01 -0400 (Thu, 29 May 2008)
New Revision: 4332
Modified:
trunk/src/config/jbm-configuration.xml
trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java
trunk/src/main/org/jboss/messaging/core/config/Configuration.java
trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java
trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java
trunk/src/main/org/jboss/messaging/core/journal/SequentialFileFactory.java
trunk/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFile.java
trunk/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFileFactory.java
trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
trunk/src/main/org/jboss/messaging/core/journal/impl/NIOSequentialFile.java
trunk/src/main/org/jboss/messaging/core/journal/impl/NIOSequentialFileFactory.java
trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java
trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java
trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java
trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/SecurityTest.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/impl/JMSServerManagerimplTest.java
trunk/tests/src/org/jboss/messaging/tests/performance/journal/impl/JournalImplTestUnit.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/AIOSequentialFileFactoryTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/JournalImplTestBase.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/JournalImplTestUnit.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java
Log:
Separate sync flag into two flags - sync transactional and non transactional - also fixed several bugs in journal
Modified: trunk/src/config/jbm-configuration.xml
===================================================================
--- trunk/src/config/jbm-configuration.xml 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/config/jbm-configuration.xml 2008-05-29 08:48:01 UTC (rev 4332)
@@ -1,10 +1,6 @@
<deployment>
<configuration>
- <!-- TODO!! Should specify all available properties in here -->
-
- <strict-tck>true</strict-tck>
-
<clustered>false</clustered>
<scheduled-executor-max-pool-size>30</scheduled-executor-max-pool-size>
@@ -80,7 +76,11 @@
<journal-type>asyncio</journal-type>
- <journal-sync>true</journal-sync>
+ <!-- Does the journal sync to disk on each transaction commit, prepare or rollback? -->
+ <journal-sync-transactional>true</journal-sync-transactional>
+
+ <!-- Does the journal sync to disk for every non transactional persistent operation? -->
+ <journal-sync-non-transactional>false</journal-sync-non-transactional>
<!-- 10 MB journal file size -->
<journal-file-size>10485760</journal-file-size>
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -78,7 +78,9 @@
private final boolean defaultSendNonPersistentMessagesBlocking;
+ private final boolean defaultSendPersistentMessagesBlocking;
+
// Static ---------------------------------------------------------------------------------------
// Constructors ---------------------------------------------------------------------------------
@@ -87,7 +89,8 @@
final int defaultConsumerWindowSize, final int defaultConsumerMaxRate,
final int defaultProducerWindowSize, final int defaultProducerMaxRate,
final boolean defaultBlockOnAcknowledge,
- final boolean defaultSendNonPersistentMessagesBlocking)
+ final boolean defaultSendNonPersistentMessagesBlocking,
+ final boolean defaultSendPersistentMessagesBlocking)
{
this.location = location;
this.defaultConsumerWindowSize = defaultConsumerWindowSize;
@@ -96,6 +99,7 @@
this.defaultProducerMaxRate = defaultProducerMaxRate;
this.defaultBlockOnAcknowledge = defaultBlockOnAcknowledge;
this.defaultSendNonPersistentMessagesBlocking = defaultSendNonPersistentMessagesBlocking;
+ this.defaultSendPersistentMessagesBlocking = defaultSendPersistentMessagesBlocking;
this.connectionParams = connectionParams;
}
@@ -117,6 +121,7 @@
this.defaultProducerMaxRate = -1;
this.location = location;
this.defaultSendNonPersistentMessagesBlocking = false;
+ this.defaultSendPersistentMessagesBlocking = false;
this.connectionParams = connectionParams;
}
@@ -147,7 +152,8 @@
return new ClientConnectionImpl(response.getConnectionTargetID(), remotingConnection,
defaultConsumerWindowSize, defaultConsumerMaxRate,
defaultProducerWindowSize, defaultProducerMaxRate,
- defaultBlockOnAcknowledge, defaultSendNonPersistentMessagesBlocking, response.getServerVersion());
+ defaultBlockOnAcknowledge, defaultSendNonPersistentMessagesBlocking,
+ defaultSendPersistentMessagesBlocking, response.getServerVersion());
}
catch (Throwable t)
{
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionImpl.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionImpl.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -75,6 +75,8 @@
private final boolean defaultBlockOnAcknowledge;
private final boolean defaultSendNonPersistentMessagesBlocking;
+
+ private final boolean defaultSendPersistentMessagesBlocking;
private final Version serverVersion;
@@ -91,6 +93,7 @@
final int defaultProducerMaxRate,
final boolean defaultBlockOnAcknowledge,
final boolean defaultSendNonPersistentMessagesBlocking,
+ final boolean defaultSendPersistentMessagesBlocking,
final Version serverVersion)
{
this.serverTargetID = serverTargetID;
@@ -108,6 +111,8 @@
this.defaultBlockOnAcknowledge = defaultBlockOnAcknowledge;
this.defaultSendNonPersistentMessagesBlocking = defaultSendNonPersistentMessagesBlocking;
+
+ this.defaultSendPersistentMessagesBlocking = defaultSendPersistentMessagesBlocking;
this.serverVersion = serverVersion;
}
@@ -128,6 +133,7 @@
ClientSession session =
new ClientSessionImpl(this, response.getSessionID(), ackBatchSize, cacheProducers,
autoCommitSends, autoCommitAcks, blockOnAcknowledge, defaultSendNonPersistentMessagesBlocking,
+ defaultSendPersistentMessagesBlocking,
defaultConsumerWindowSize, defaultConsumerMaxRate, defaultProducerWindowSize,
defaultProducerMaxRate);
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -65,8 +65,6 @@
//For limit throttling
- //private AtomicInteger availableCredits = new AtomicInteger(0);
-
private Semaphore availableCredits;
//For rate throttling
@@ -115,7 +113,7 @@
this.sendPersistentMessagesSynchronously = sendPersistentMessagesSynchronously;
-// this.availableCredits.set(initialCredits);
+ log.info("send np:" + this.sendNonPersistentMessagesSynchronously + " p:" + this.sendPersistentMessagesSynchronously);
this.availableCredits = new Semaphore(initialCredits);
@@ -184,24 +182,7 @@
}
catch (InterruptedException e)
{
- }
-
-// while (availableCredits.get() <= 0)
-// {
-// //log.info("**blocked");
-// synchronized (this)
-// {
-// try
-// {
-// wait();
-// }
-// catch (InterruptedException e)
-// {
-// }
-// }
-// }
-//
-// availableCredits.addAndGet(-message.getClientMessage().encodeSize());
+ }
}
}
@@ -238,19 +219,7 @@
public void receiveCredits(final int credits)
{
- // log.info("received credits " + credits);
-
- this.availableCredits.release(credits);
-
-// int prev = availableCredits.getAndAdd(credits);
-//
-// if (prev <= 0 && prev + credits > 0)
-// {
-// synchronized (this)
-// {
-// notify();
-// }
-// }
+ availableCredits.release(credits);
}
// Public ---------------------------------------------------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -147,6 +147,8 @@
private final boolean sendNonPersistentMessagesBlocking;
+ private final boolean sendPersistentMessagesBlocking;
+
// Constructors ---------------------------------------------------------------------------------
public ClientSessionImpl(final ClientConnectionInternal connection, final long serverTargetID,
@@ -154,6 +156,7 @@
final boolean autoCommitSends, final boolean autoCommitAcks,
final boolean blockOnAcknowledge,
final boolean sendNonPersistentMessagesBlocking,
+ final boolean sendPersistentMessagesBlocking,
final int defaultConsumerWindowSize,
final int defaultConsumerMaxRate,
final int defaultProducerWindowSize,
@@ -200,6 +203,8 @@
this.blockOnAcknowledge = blockOnAcknowledge;
this.sendNonPersistentMessagesBlocking = sendNonPersistentMessagesBlocking;
+
+ this.sendPersistentMessagesBlocking = sendPersistentMessagesBlocking;
}
// ClientSession implementation -----------------------------------------------------------------
@@ -369,7 +374,8 @@
producer = new ClientProducerImpl(this, response.getProducerTargetID(), clientTargetID, address,
remotingConnection,
response.getMaxRate(),
- sendNonPersistentMessagesBlocking, autoCommitSends,
+ sendNonPersistentMessagesBlocking,
+ autoCommitSends && sendPersistentMessagesBlocking,
response.getInitialCredits());
remotingConnection.getPacketDispatcher().register(new ClientProducerPacketHandler(producer, clientTargetID));
Modified: trunk/src/main/org/jboss/messaging/core/config/Configuration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/Configuration.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/main/org/jboss/messaging/core/config/Configuration.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -99,7 +99,9 @@
JournalType getJournalType();
- boolean isJournalSync();
+ boolean isJournalSyncTransactional();
+
+ boolean isJournalSyncNonTransactional();
int getJournalFileSize();
Modified: trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -73,8 +73,10 @@
public JournalType journalType;
- protected boolean journalSync;
+ protected boolean journalSyncTransactional = true;
+ protected boolean journalSyncNonTransactional = false;
+
protected int journalFileSize;
protected int journalMinFiles;
@@ -386,10 +388,15 @@
this.journalType = type;
}
- public boolean isJournalSync()
+ public boolean isJournalSyncTransactional()
{
- return journalSync;
+ return journalSyncTransactional;
}
+
+ public boolean isJournalSyncNonTransactional()
+ {
+ return journalSyncNonTransactional;
+ }
public int getJournalFileSize()
{
Modified: trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -131,7 +131,9 @@
journalType = JournalType.JDBC;
}
- this.journalSync = getBoolean(e, "journal-sync", true);
+ this.journalSyncTransactional = getBoolean(e, "journal-sync-transactional", true);
+
+ this.journalSyncNonTransactional = getBoolean(e, "journal-sync-non-transactional", false);
this.journalFileSize = getInteger(e, "journal-file-size", 10 * 1024 * 1024);
Modified: trunk/src/main/org/jboss/messaging/core/journal/SequentialFileFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/journal/SequentialFileFactory.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/main/org/jboss/messaging/core/journal/SequentialFileFactory.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -34,11 +34,11 @@
*/
public interface SequentialFileFactory
{
- SequentialFile createSequentialFile(String fileName, boolean sync, int maxIO, long timeout) throws Exception;
+ SequentialFile createSequentialFile(String fileName, int maxIO, long timeout) throws Exception;
List<String> listFiles(String extension) throws Exception;
- boolean supportsCallbacks();
+ boolean isSupportsCallbacks();
ByteBuffer newBuffer(int size);
Modified: trunk/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFile.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFile.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFile.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -43,8 +43,6 @@
private final long timeout;
- private final boolean sync;
-
private AsynchronousFile aioFile;
private AtomicLong position = new AtomicLong(0);
@@ -53,13 +51,12 @@
// serious performance problems. Because of that we make all the writes on AIO using a single thread.
private ExecutorService executor;
- public AIOSequentialFile(final String journalDir, final String fileName, final int maxIO, final long timeout, final boolean sync) throws Exception
+ public AIOSequentialFile(final String journalDir, final String fileName, final int maxIO, final long timeout) throws Exception
{
this.journalDir = journalDir;
this.fileName = fileName;
this.maxIO = maxIO;
this.timeout = timeout;
- this.sync = sync;
}
public int getAlignment() throws Exception
@@ -210,7 +207,7 @@
public int write(final ByteBuffer bytes, final boolean sync) throws Exception
{
- if (sync && this.sync)
+ if (sync)
{
WaitCompletion completion = new WaitCompletion();
@@ -223,8 +220,7 @@
else
{
return write (bytes, DummyCallback.instance);
- }
-
+ }
}
Modified: trunk/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFileFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFileFactory.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFileFactory.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -26,12 +26,12 @@
super(journalDir);
}
- public SequentialFile createSequentialFile(final String fileName, final boolean sync, final int maxIO, final long timeout) throws Exception
+ public SequentialFile createSequentialFile(final String fileName, final int maxIO, final long timeout) throws Exception
{
- return new AIOSequentialFile(journalDir, fileName, maxIO, timeout, sync);
+ return new AIOSequentialFile(journalDir, fileName, maxIO, timeout);
}
- public boolean supportsCallbacks()
+ public boolean isSupportsCallbacks()
{
return true;
}
Modified: trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -147,8 +147,10 @@
private final int minFiles;
- private final boolean sync;
+ private final boolean syncTransactional;
+ private final boolean syncNonTransactional;
+
private final SequentialFileFactory fileFactory;
private final long taskPeriod;
@@ -170,8 +172,6 @@
private final ConcurrentMap<Long, TransactionCallback> transactionCallbacks = new ConcurrentHashMap<Long, TransactionCallback>();
- private final boolean shouldUseCallback;
-
private final ExecutorService closingExecutor = Executors.newSingleThreadExecutor();
/**
@@ -203,7 +203,8 @@
private Reclaimer reclaimer = new Reclaimer();
public JournalImpl(final int fileSize, final int minFiles,
- final boolean sync, final SequentialFileFactory fileFactory, final long taskPeriod,
+ final boolean syncTransactional, final boolean syncNonTransactional,
+ final SequentialFileFactory fileFactory, final long taskPeriod,
final String filePrefix, final String fileExtension, final int maxAIO, final long aioTimeout)
{
if (fileSize < MIN_FILE_SIZE)
@@ -243,8 +244,10 @@
this.minFiles = minFiles;
- this.sync = sync;
+ this.syncTransactional = syncTransactional;
+ this.syncNonTransactional = syncNonTransactional;
+
this.fileFactory = fileFactory;
this.taskPeriod = taskPeriod;
@@ -256,8 +259,6 @@
this.maxAIO = maxAIO;
this.aioTimeout = aioTimeout;
-
- shouldUseCallback = fileFactory.supportsCallbacks() && sync;
}
// Journal implementation ----------------------------------------------------------------
@@ -283,19 +284,8 @@
bb.putByte(DONE);
bb.rewind();
- JournalFile usedFile;
-
- if (shouldUseCallback)
- {
- SimpleCallback callback = new SimpleCallback();
- usedFile = appendRecord(bb.getBuffer(), callback);
- callback.waitCompletion(aioTimeout);
- }
- else
- {
- usedFile = appendRecord(bb.getBuffer(), true);
- }
-
+ JournalFile usedFile = appendRecord(bb.getBuffer(), syncNonTransactional);
+
posFilesMap.put(id, new PosFiles(usedFile));
}
@@ -318,19 +308,8 @@
bb.put(DONE);
bb.rewind();
- JournalFile usedFile;
+ JournalFile usedFile = appendRecord(bb, syncNonTransactional);
- if (shouldUseCallback)
- {
- SimpleCallback callback = new SimpleCallback();
- usedFile = appendRecord(bb, callback);
- callback.waitCompletion(aioTimeout);
- }
- else
- {
- usedFile = appendRecord(bb, true);
- }
-
posFilesMap.put(id, new PosFiles(usedFile));
}
@@ -359,18 +338,8 @@
bb.put(record);
bb.put(DONE);
bb.rewind();
-
- JournalFile usedFile;
- if (shouldUseCallback)
- {
- SimpleCallback callback = new SimpleCallback();
- usedFile = appendRecord(bb, callback);
- callback.waitCompletion(aioTimeout);
- }
- else
- {
- usedFile = appendRecord(bb, true);
- }
+
+ JournalFile usedFile = appendRecord(bb, syncNonTransactional);
posFiles.addUpdateFile(usedFile);
}
@@ -400,17 +369,7 @@
bb.put(DONE);
bb.rewind();
- if (shouldUseCallback)
- {
- SimpleCallback callback = new SimpleCallback();
- appendRecord(bb, callback);
- callback.waitCompletion(aioTimeout);
- }
- else
- {
- appendRecord(bb, true);
- }
-
+ appendRecord(bb, syncNonTransactional);
}
public long getTransactionID()
@@ -443,7 +402,7 @@
JournalFile usedFile;
- if (shouldUseCallback)
+ if (fileFactory.isSupportsCallbacks() && syncTransactional)
{
TransactionCallback callback = getTransactionCallback(txID);
callback.countUp();
@@ -467,9 +426,6 @@
throw new IllegalStateException("Journal must be loaded first");
}
- TransactionCallback callback = getTransactionCallback(txID);
- callback.countUp();
-
int size = SIZE_ADD_RECORD_TX + record.length;
ByteBuffer bb = fileFactory.newBuffer(size);
@@ -483,8 +439,19 @@
bb.put(DONE);
bb.rewind();
- JournalFile usedFile = appendRecord(bb, callback);
+ JournalFile usedFile;
+ if (fileFactory.isSupportsCallbacks() && syncTransactional)
+ {
+ TransactionCallback callback = getTransactionCallback(txID);
+ callback.countUp();
+ usedFile = appendRecord(bb, callback);
+ }
+ else
+ {
+ usedFile = appendRecord(bb, false);
+ }
+
TransactionNegPos tx = getTransactionInfo(txID);
tx.addPos(usedFile, id);
@@ -498,9 +465,6 @@
throw new IllegalStateException("Journal must be loaded first");
}
- TransactionCallback callback = getTransactionCallback(txID);
- callback.countUp();
-
int size = SIZE_UPDATE_RECORD_TX + record.length;
ByteBuffer bb = fileFactory.newBuffer(size);
@@ -514,10 +478,21 @@
bb.put(DONE);
bb.rewind();
- JournalFile usedFile = appendRecord(bb, callback);
+ JournalFile usedFile;
+
+ if (fileFactory.isSupportsCallbacks() && syncTransactional)
+ {
+ TransactionCallback callback = getTransactionCallback(txID);
+ callback.countUp();
+ usedFile = appendRecord(bb, callback);
+ }
+ else
+ {
+ usedFile = appendRecord(bb, false);
+ }
- TransactionNegPos tx = getTransactionInfo(txID);
-
+ TransactionNegPos tx = getTransactionInfo(txID);
+
tx.addPos(usedFile, id);
}
@@ -528,9 +503,6 @@
throw new IllegalStateException("Journal must be loaded first");
}
- TransactionCallback callback = getTransactionCallback(txID);
- callback.countUp();
-
int size = SIZE_DELETE_RECORD_TX;
ByteBuffer bb = fileFactory.newBuffer(size);
@@ -541,10 +513,21 @@
bb.put(DONE);
bb.rewind();
- JournalFile usedFile = appendRecord(bb, callback);
+ JournalFile usedFile;
+
+ if (fileFactory.isSupportsCallbacks() && syncTransactional)
+ {
+ TransactionCallback callback = getTransactionCallback(txID);
+ callback.countUp();
+ usedFile = appendRecord(bb, callback);
+ }
+ else
+ {
+ usedFile = appendRecord(bb, false);
+ }
+
+ TransactionNegPos tx = getTransactionInfo(txID);
- TransactionNegPos tx = getTransactionInfo(txID);
-
tx.addNeg(usedFile, id);
}
@@ -555,9 +538,6 @@
throw new IllegalStateException("Journal must be loaded first");
}
- TransactionCallback callback = getTransactionCallback(txID);
- callback.countUp();
-
TransactionNegPos tx = transactionInfos.get(txID);
if (tx == null)
@@ -573,9 +553,22 @@
bb.putLong(txID);
bb.put(DONE);
bb.rewind();
-
- JournalFile usedFile = appendRecord(bb, callback);
-
+
+ JournalFile usedFile;
+
+ if (fileFactory.isSupportsCallbacks() && syncTransactional)
+ {
+ TransactionCallback callback = getTransactionCallback(txID);
+ callback.countUp();
+ usedFile = appendRecord(bb, callback);
+
+ //FIXME!! Need to wait for completion!!! FIXME
+ }
+ else
+ {
+ usedFile = appendRecord(bb, syncTransactional);
+ }
+
tx.prepare(usedFile);
}
@@ -603,17 +596,18 @@
bb.rewind();
JournalFile usedFile;
- if (shouldUseCallback)
- {
+
+ if (fileFactory.isSupportsCallbacks() && syncTransactional)
+ {
TransactionCallback callback = getTransactionCallback(txID);
callback.countUp();
- usedFile = appendRecord(bb, callback);
- callback.waitCompletion(aioTimeout);
- }
- else
- {
- usedFile = appendRecord(bb, true);
- }
+ usedFile = appendRecord(bb, callback);
+ callback.waitCompletion(aioTimeout);
+ }
+ else
+ {
+ usedFile = appendRecord(bb, syncTransactional);
+ }
transactionCallbacks.remove(txID);
@@ -645,17 +639,18 @@
bb.rewind();
JournalFile usedFile;
- if (shouldUseCallback)
+ if (fileFactory.isSupportsCallbacks() && syncTransactional)
{
- SimpleCallback callback = new SimpleCallback();
- usedFile = appendRecord(bb, callback);
- callback.waitCompletion(aioTimeout);
+ TransactionCallback callback = getTransactionCallback(txID);
+ callback.countUp();
+ usedFile = appendRecord(bb, callback);
+ callback.waitCompletion(aioTimeout);
}
else
{
- usedFile = appendRecord(bb, true);
+ usedFile = appendRecord(bb, syncTransactional);
}
-
+
tx.rollback(usedFile);
}
@@ -679,7 +674,7 @@
for (String fileName: fileNames)
{
- SequentialFile file = fileFactory.createSequentialFile(fileName, sync, maxAIO, aioTimeout);
+ SequentialFile file = fileFactory.createSequentialFile(fileName, maxAIO, aioTimeout);
file.open();
@@ -1497,7 +1492,7 @@
if (trace) log.trace("Creating file " + fileName);
- SequentialFile sequentialFile = fileFactory.createSequentialFile(fileName, sync, maxAIO, aioTimeout);
+ SequentialFile sequentialFile = fileFactory.createSequentialFile(fileName, maxAIO, aioTimeout);
sequentialFile.open();
Modified: trunk/src/main/org/jboss/messaging/core/journal/impl/NIOSequentialFile.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/journal/impl/NIOSequentialFile.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/main/org/jboss/messaging/core/journal/impl/NIOSequentialFile.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -46,21 +46,17 @@
private String fileName;
- private boolean sync;
-
private File file;
private FileChannel channel;
private RandomAccessFile rfile;
- public NIOSequentialFile(final String journalDir, final String fileName, final boolean sync)
+ public NIOSequentialFile(final String journalDir, final String fileName)
{
this.journalDir = journalDir;
- this.fileName = fileName;
-
- this.sync = sync;
+ this.fileName = fileName;
}
public int getAlignment()
@@ -160,7 +156,7 @@
{
int bytesRead = channel.write(bytes);
- if (sync && this.sync)
+ if (sync)
{
channel.force(false);
}
Modified: trunk/src/main/org/jboss/messaging/core/journal/impl/NIOSequentialFileFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/journal/impl/NIOSequentialFileFactory.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/main/org/jboss/messaging/core/journal/impl/NIOSequentialFileFactory.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -42,22 +42,22 @@
}
// The timeout is ignored on NIO
- public SequentialFile createSequentialFile(final String fileName, final boolean sync, int maxIO, long timeout)
+ public SequentialFile createSequentialFile(final String fileName, final int maxIO, final long timeout)
{
- return new NIOSequentialFile(journalDir, fileName, sync);
+ return new NIOSequentialFile(journalDir, fileName);
}
- public boolean supportsCallbacks()
+ public boolean isSupportsCallbacks()
{
return false;
}
- public ByteBuffer newBuffer(int size)
+ public ByteBuffer newBuffer(final int size)
{
return ByteBuffer.allocate(size);
}
- public ByteBuffer wrapBuffer(byte[] bytes)
+ public ByteBuffer wrapBuffer(final byte[] bytes)
{
return ByteBuffer.wrap(bytes);
}
Modified: trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -105,7 +105,7 @@
SequentialFileFactory bindingsFF = new NIOSequentialFileFactory(bindingsDir);
- bindingsJournal = new JournalImpl(1024 * 1024, 2, true, bindingsFF, 10000, "jbm-bindings", "bindings", 1, 1);
+ bindingsJournal = new JournalImpl(1024 * 1024, 2, true, true, bindingsFF, 10000, "jbm-bindings", "bindings", 1, 1);
String journalDir = config.getJournalDirectory();
@@ -146,7 +146,8 @@
}
messageJournal = new JournalImpl(config.getJournalFileSize(),
- config.getJournalMinFiles(), config.isJournalSync(), journalFF,
+ config.getJournalMinFiles(), config.isJournalSyncTransactional(),
+ config.isJournalSyncNonTransactional(), journalFF,
config.getJournalTaskPeriod(), "jbm-data", "jbm", config.getJournalMaxAIO(), config.getJournalAIOTimeout());
}
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -93,6 +93,8 @@
private final boolean defaultBlockOnAcknowledge;
private final boolean defaultSendNonPersistentMessagesBlocking;
+
+ private final boolean defaultSendPersistentMessagesBlocking;
// Constructors ---------------------------------------------------------------------------------
@@ -105,7 +107,8 @@
final int defaultProducerWindowSize,
final int defaultProducerMaxRate,
final boolean defaultBlockOnAcknowledge,
- final boolean defaultSendNonPersistentMessagesBlocking)
+ final boolean defaultSendNonPersistentMessagesBlocking,
+ final boolean defaultSendPersistentMessagesBlocking)
{
this.clientID = clientID;
this.dupsOKBatchSize = dupsOKBatchSize;
@@ -117,6 +120,9 @@
this.defaultProducerWindowSize = defaultProducerWindowSize;
this.defaultBlockOnAcknowledge = defaultBlockOnAcknowledge;
this.defaultSendNonPersistentMessagesBlocking = defaultSendNonPersistentMessagesBlocking;
+ this.defaultSendPersistentMessagesBlocking = defaultSendPersistentMessagesBlocking;
+ log.info("cf np:" + this.defaultSendNonPersistentMessagesBlocking + " p:" + this.defaultSendPersistentMessagesBlocking);
+
}
// ConnectionFactory implementation -------------------------------------------------------------
@@ -229,7 +235,8 @@
defaultProducerWindowSize,
defaultProducerMaxRate,
defaultBlockOnAcknowledge,
- defaultSendNonPersistentMessagesBlocking);
+ defaultSendNonPersistentMessagesBlocking,
+ defaultSendPersistentMessagesBlocking);
}
return connectionFactory;
Modified: trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -96,6 +96,7 @@
int producerWindowSize, int producerMaxRate,
boolean blockOnAcknowledge,
boolean defaultSendNonPersistentMessagesBlocking,
+ boolean defaultSendPersistentMessagesBlocking,
String jndiBinding) throws Exception;
/**
@@ -116,6 +117,7 @@
int producerWindowSize, int producerMaxRate,
boolean blockOnAcknowledge,
boolean defaultSendNonPersistentMessagesBlocking,
+ boolean defaultSendPersistentMessagesBlocking,
List<String> jndiBindings) throws Exception;
/**
Modified: trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -46,7 +46,8 @@
private static final String PRODUCER_WINDOW_SIZE = "producer-window-size";
private static final String PRODUCER_MAX_RATE = "producer-max-rate";
private static final String BLOCK_ON_ACKNOWLEDGE = "block-on-acknowledge";
- private static final String SEND_NP_MESSAGES_SYNCHRONOUSLY = "send-np-messages-synchronously";
+ private static final String SEND_NP_MESSAGES_SYNCHRONOUSLY = "send-np-messages-synchronously";
+ private static final String SEND_P_MESSAGES_SYNCHRONOUSLY = "send-p-messages-synchronously";
private static final String ENTRY_NODE_NAME = "entry";
private static final String CONNECTION_FACTORY_NODE_NAME = "connection-factory";
private static final String QUEUE_NODE_NAME = "queue";
@@ -129,6 +130,7 @@
int producerMaxRate = -1;
boolean blockOnAcknowledge = false;
boolean sendNonPersistentMessagesSynchronously = false;
+ boolean sendPersistentMessagesSynchronously = false;
for (int j = 0; j < attributes.getLength(); j++)
{
@@ -164,6 +166,10 @@
{
sendNonPersistentMessagesSynchronously = Boolean.parseBoolean(attributes.item(j).getTextContent().trim());
}
+ else if (SEND_P_MESSAGES_SYNCHRONOUSLY.equalsIgnoreCase(attributes.item(j).getNodeName()))
+ {
+ sendPersistentMessagesSynchronously = Boolean.parseBoolean(attributes.item(j).getTextContent().trim());
+ }
}
NodeList children = node.getChildNodes();
@@ -177,7 +183,8 @@
String name = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
jmsServerManager.createConnectionFactory(name, clientID, dupsOKBatchSize,
consumerWindowSize, consumerMaxRate, producerWindowSize, producerMaxRate,
- blockOnAcknowledge, sendNonPersistentMessagesSynchronously, jndiName);
+ blockOnAcknowledge, sendNonPersistentMessagesSynchronously,
+ sendPersistentMessagesSynchronously, jndiName);
}
}
}
Modified: trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -231,7 +231,8 @@
public boolean createConnectionFactory(String name, String clientID,
int dupsOKBatchSize, int consumerWindowSize, int consumerMaxRate,
int producerWindowSize, int producerMaxRate, boolean blockOnAcknowledge,
- boolean defaultSendNonPersistentMessagesBlocking, String jndiBinding) throws Exception
+ boolean defaultSendNonPersistentMessagesBlocking, boolean defaultSendPersistentMessagesBlocking,
+ String jndiBinding) throws Exception
{
JBossConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
@@ -241,7 +242,8 @@
messagingServerManagement.getConfiguration().getConnectionParams(),
consumerWindowSize, consumerMaxRate, producerWindowSize, producerMaxRate,
blockOnAcknowledge,
- defaultSendNonPersistentMessagesBlocking
+ defaultSendNonPersistentMessagesBlocking,
+ defaultSendPersistentMessagesBlocking
);
}
if (!bindToJndi(jndiBinding, cf))
@@ -261,6 +263,7 @@
int consumerWindowSize, int consumerMaxRate,
int producerWindowSize, int producerMaxRate, boolean blockOnAcknowledge,
boolean defaultSendNonPersistentMessagesBlocking,
+ boolean defaultSendPersistentMessagesBlocking,
List<String> jndiBindings) throws Exception
{
JBossConnectionFactory cf = connectionFactories.get(name);
@@ -270,7 +273,8 @@
messagingServerManagement.getConfiguration().getLocation(),
messagingServerManagement.getConfiguration().getConnectionParams(),
consumerWindowSize, consumerMaxRate, producerWindowSize, producerMaxRate,
- blockOnAcknowledge, defaultSendNonPersistentMessagesBlocking
+ blockOnAcknowledge, defaultSendNonPersistentMessagesBlocking,
+ defaultSendPersistentMessagesBlocking
);
}
for (String jndiBinding : jndiBindings)
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -190,8 +190,7 @@
{
// log the test start in the remote log, this will make hunting through logs so much easier
ServerManagement.log(ServerManagement.INFO, banner);
- }
-
+ }
}
protected boolean isRemote()
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -63,20 +63,6 @@
// TestCase overrides -------------------------------------------
- protected void setUp() throws Exception
- {
- super.setUp();
- getJmsServerManager().createConnectionFactory("ackconnectionfactory", null, 1000, 1024 * 1024, -1, 1000, -1, true, true, "/ackconnectionfactory");
- cf = (JBossConnectionFactory) getInitialContext().lookup("/ackconnectionfactory");
- }
-
- protected void tearDown() throws Exception
- {
- super.tearDown();
- getJmsServerManager().destroyConnectionFactory("ackconnectionfactory");
- cf = null;
- }
-
// Public --------------------------------------------------------
/* Topics shouldn't hold on to messages if there are no subscribers */
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -84,7 +84,7 @@
bindings.add("StrictTCKConnectionFactory");
getJmsServerManager().createConnectionFactory("StrictTCKConnectionFactory", null,
- 1000, 1024 * 1024, -1, 1000, -1, true, true, "/StrictTCKConnectionFactory");
+ 1000, 1024 * 1024, -1, 1000, -1, true, true, true, "/StrictTCKConnectionFactory");
cf = (JBossConnectionFactory) getInitialContext().lookup("/StrictTCKConnectionFactory");
}
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -32,8 +32,21 @@
super.setUp();
ic = getInitialContext();
- cf = getConnectionFactory();
+
+ //All jms tests should use a specific cg which has blockOnAcknowledge = true and
+ //both np and p messages are sent synchronously
+
+ getJmsServerManager().createConnectionFactory("testsuitecf", null, 1000, 1024 * 1024, -1, 1000, -1, true, true, true, "/testsuitecf");
+
+ cf = (JBossConnectionFactory) getInitialContext().lookup("/testsuitecf");
}
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ getJmsServerManager().destroyConnectionFactory("testsuitecf");
+ cf = null;
+ }
public JMSTestCase(String name)
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/SecurityTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/SecurityTest.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/SecurityTest.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -759,7 +759,7 @@
protected void setUp() throws Exception
{
super.setUp();
-
+
oldDefaultConfig = getSecurityConfig();
HashSet<Role> roles = new HashSet<Role>();
@@ -786,14 +786,14 @@
protected void tearDown() throws Exception
{
super.tearDown();
-
+
setSecurityConfig(oldDefaultConfig);
configureSecurityForDestination("Queue1", true, null);
configureSecurityForDestination("Queue2", true, null);
configureSecurityForDestination("Topic1", false, null);
configureSecurityForDestination("Topic2", false, null);
}
-
+
// Private -------------------------------------------------------
private boolean canReadDestination(Connection conn, Destination dest) throws Exception
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -646,7 +646,7 @@
{
log.info("deploying connection factory with name: " + objectName + " and dupsok: " + dupsOkBatchSize);
getJMSServerManager().createConnectionFactory(objectName, clientId, dupsOkBatchSize,
- prefetchSize, -1, 1000, -1, blockOnAcknowledge, true, jndiBindings);
+ prefetchSize, -1, 1000, -1, blockOnAcknowledge, true, true, jndiBindings);
}
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/impl/JMSServerManagerimplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/impl/JMSServerManagerimplTest.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/impl/JMSServerManagerimplTest.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -234,7 +234,7 @@
public void testCreateAndDestroyConnectionFactory() throws Exception
{
- jmsServerManager.createConnectionFactory("newtestcf", "anid", 100, 1000, -1, 1000, -1, false, false, "newtestcf");
+ jmsServerManager.createConnectionFactory("newtestcf", "anid", 100, 1000, -1, 1000, -1, false, false, true, "newtestcf");
JBossConnectionFactory jbcf = (JBossConnectionFactory) initialContext.lookup("newtestcf");
assertNotNull(jbcf);
assertNotNull(jbcf.getDelegate());
@@ -251,7 +251,7 @@
ArrayList<String> bindings = new ArrayList<String>();
bindings.add("oranewtestcf");
bindings.add("newtestcf");
- jmsServerManager.createConnectionFactory("newtestcf", "anid", 100, 1000, -1, 1000, -1, false, false, bindings);
+ jmsServerManager.createConnectionFactory("newtestcf", "anid", 100, 1000, -1, 1000, -1, false, false, true, bindings);
jbcf = (JBossConnectionFactory) initialContext.lookup("newtestcf");
assertNotNull(jbcf);
assertNotNull(jbcf.getDelegate());
Modified: trunk/tests/src/org/jboss/messaging/tests/performance/journal/impl/JournalImplTestUnit.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/performance/journal/impl/JournalImplTestUnit.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/tests/src/org/jboss/messaging/tests/performance/journal/impl/JournalImplTestUnit.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -201,8 +201,7 @@
}
public void internaltestSpeedNonTransactional() throws Exception
- {
-
+ {
final long numMessages = 10000;
int numFiles = (int)(((numMessages * 1024 + 512) / (10 * 1024 * 1024)) * 1.3);
@@ -212,7 +211,7 @@
log.info("num Files=" + numFiles);
Journal journal =
- new JournalImpl(10 * 1024 * 1024, numFiles, true, getFileFactory(),
+ new JournalImpl(10 * 1024 * 1024, numFiles, true, true, getFileFactory(),
5000, "jbm-data", "jbm", 5000, 120);
journal.start();
@@ -287,7 +286,7 @@
journal.stop();
journal =
- new JournalImpl(10 * 1024 * 1024, numFiles, true, getFileFactory(),
+ new JournalImpl(10 * 1024 * 1024, numFiles, true, true, getFileFactory(),
5000, "jbm-data", "jbm", 5000, 120);
journal.start();
@@ -299,7 +298,7 @@
public void testSpeedTransactional() throws Exception
{
Journal journal =
- new JournalImpl(10 * 1024 * 1024, 10, true, getFileFactory(),
+ new JournalImpl(10 * 1024 * 1024, 10, true, true, getFileFactory(),
5000, "jbm-data", "jbm", 5000, 120);
journal.start();
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/AIOSequentialFileFactoryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/AIOSequentialFileFactoryTest.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/AIOSequentialFileFactoryTest.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -61,7 +61,7 @@
public void testBuffer() throws Exception
{
- SequentialFile file = factory.createSequentialFile("filtetmp.log", true, 10, 120);
+ SequentialFile file = factory.createSequentialFile("filtetmp.log", 10, 120);
file.open();
ByteBuffer buff = factory.newBuffer(10);
assertEquals(512, buff.limit());
@@ -122,7 +122,7 @@
final int NUMBER_OF_RECORDS = 10000;
- SequentialFile file = factory.createSequentialFile("callbackBlock.log", true, 1000, 12000);
+ SequentialFile file = factory.createSequentialFile("callbackBlock.log", 1000, 12000);
file.open();
file.fill(0, 512 * NUMBER_OF_RECORDS, (byte)'a');
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/JournalImplTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/JournalImplTestBase.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/JournalImplTestBase.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -139,7 +139,7 @@
public void createJournal() throws Exception
{
journal =
- new JournalImpl(fileSize, minFiles, sync, fileFactory, 1000, filePrefix, fileExtension, maxAIO, 120000);
+ new JournalImpl(fileSize, minFiles, sync, sync, fileFactory, 1000, filePrefix, fileExtension, maxAIO, 120000);
}
protected void startJournal() throws Exception
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/JournalImplTestUnit.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/JournalImplTestUnit.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/JournalImplTestUnit.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -102,7 +102,7 @@
{
try
{
- new JournalImpl(JournalImpl.MIN_FILE_SIZE - 1, 10, true, fileFactory, 5000, filePrefix, fileExtension, 1, 120);
+ new JournalImpl(JournalImpl.MIN_FILE_SIZE - 1, 10, true, true, fileFactory, 5000, filePrefix, fileExtension, 1, 120);
fail("Should throw exception");
}
@@ -113,7 +113,7 @@
try
{
- new JournalImpl(10 * 1024, 1, true, fileFactory, 5000, filePrefix, fileExtension, 1, 120);
+ new JournalImpl(10 * 1024, 1, true, true, fileFactory, 5000, filePrefix, fileExtension, 1, 120);
fail("Should throw exception");
}
@@ -124,7 +124,7 @@
try
{
- new JournalImpl(10 * 1024, 10, true, null, 5000, filePrefix, fileExtension, 1, 120);
+ new JournalImpl(10 * 1024, 10, true, true, null, 5000, filePrefix, fileExtension, 1, 120);
fail("Should throw exception");
}
@@ -135,7 +135,7 @@
try
{
- new JournalImpl(10 * 1024, 10, true, fileFactory, JournalImpl.MIN_TASK_PERIOD - 1, filePrefix, fileExtension, 1, 120);
+ new JournalImpl(10 * 1024, 10, true, true, fileFactory, JournalImpl.MIN_TASK_PERIOD - 1, filePrefix, fileExtension, 1, 120);
fail("Should throw exception");
}
@@ -146,7 +146,7 @@
try
{
- new JournalImpl(10 * 1024, 10, true, fileFactory, 5000, null, fileExtension, 1, 120);
+ new JournalImpl(10 * 1024, 10, true, true, fileFactory, 5000, null, fileExtension, 1, 120);
fail("Should throw exception");
}
@@ -157,7 +157,7 @@
try
{
- new JournalImpl(10 * 1024, 10, true, fileFactory, 5000, filePrefix, null, 1, 120);
+ new JournalImpl(10 * 1024, 10, true, true, fileFactory, 5000, filePrefix, null, 1, 120);
fail("Should throw exception");
}
@@ -168,7 +168,7 @@
try
{
- new JournalImpl(10 * 1024, 10, true, fileFactory, 5000, filePrefix, null, 0, 120);
+ new JournalImpl(10 * 1024, 10, true, true, fileFactory, 5000, filePrefix, null, 0, 120);
fail("Should throw exception");
}
@@ -179,7 +179,7 @@
try
{
- new JournalImpl(10 * 1024, 10, true, fileFactory, 5000, filePrefix, fileExtension, 0, -1);
+ new JournalImpl(10 * 1024, 10, true, true, fileFactory, 5000, filePrefix, fileExtension, 0, -1);
fail("Should throw exception");
}
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -74,7 +74,7 @@
expectedFiles.add(fileName);
- SequentialFile sf = factory.createSequentialFile(fileName, false, 1, 120);
+ SequentialFile sf = factory.createSequentialFile(fileName, 1, 120);
sf.open();
@@ -85,10 +85,10 @@
//Create a couple with a different extension - they shouldn't be picked up
- SequentialFile sf1 = factory.createSequentialFile("different.file", false, 1, 120);
+ SequentialFile sf1 = factory.createSequentialFile("different.file", 1, 120);
sf1.open();
- SequentialFile sf2 = factory.createSequentialFile("different.cheese", false, 1, 120);
+ SequentialFile sf2 = factory.createSequentialFile("different.cheese", 1, 120);
sf2.open();
List<String> fileNames = factory.listFiles("jbm");
@@ -119,7 +119,7 @@
public void testFill() throws Exception
{
- SequentialFile sf = factory.createSequentialFile("fill.jbm", true, 1, 120);
+ SequentialFile sf = factory.createSequentialFile("fill.jbm", 1, 120);
sf.open();
@@ -144,11 +144,11 @@
public void testDelete() throws Exception
{
- SequentialFile sf = factory.createSequentialFile("delete-me.jbm", true, 1, 120);
+ SequentialFile sf = factory.createSequentialFile("delete-me.jbm", 1, 120);
sf.open();
- SequentialFile sf2 = factory.createSequentialFile("delete-me2.jbm", true, 1, 120);
+ SequentialFile sf2 = factory.createSequentialFile("delete-me2.jbm", 1, 120);
sf2.open();
@@ -174,7 +174,7 @@
public void testWriteandRead() throws Exception
{
- SequentialFile sf = factory.createSequentialFile("write.jbm", true, 1, 120);
+ SequentialFile sf = factory.createSequentialFile("write.jbm", 1, 120);
sf.open();
@@ -237,7 +237,7 @@
public void testPosition() throws Exception
{
- SequentialFile sf = factory.createSequentialFile("position.jbm", true, 1, 120);
+ SequentialFile sf = factory.createSequentialFile("position.jbm", 1, 120);
sf.open();
@@ -303,7 +303,7 @@
public void testOpenClose() throws Exception
{
- SequentialFile sf = factory.createSequentialFile("openclose.jbm", true, 1, 120);
+ SequentialFile sf = factory.createSequentialFile("openclose.jbm", 1, 120);
sf.open();
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java 2008-05-28 22:01:09 UTC (rev 4331)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java 2008-05-29 08:48:01 UTC (rev 4332)
@@ -45,13 +45,13 @@
private Map<String, FakeSequentialFile> fileMap = new ConcurrentHashMap<String, FakeSequentialFile>();
- public SequentialFile createSequentialFile(final String fileName, final boolean sync, final int maxAIO, final long timeout) throws Exception
+ public SequentialFile createSequentialFile(final String fileName, final int maxAIO, final long timeout) throws Exception
{
FakeSequentialFile sf = fileMap.get(fileName);
if (sf == null)
{
- sf = new FakeSequentialFile(fileName, sync);
+ sf = new FakeSequentialFile(fileName);
fileMap.put(fileName, sf);
}
@@ -90,7 +90,7 @@
fileMap.clear();
}
- public boolean supportsCallbacks()
+ public boolean isSupportsCallbacks()
{
return false;
}
@@ -111,8 +111,6 @@
private final String fileName;
- private final boolean sync;
-
private volatile ByteBuffer data;
public ByteBuffer getData()
@@ -120,22 +118,15 @@
return data;
}
- public boolean isSync()
- {
- return sync;
- }
-
public boolean isOpen()
{
//log.info("is open" + System.identityHashCode(this) +" open is now " + open);
return open;
}
- public FakeSequentialFile(final String fileName, final boolean sync)
+ public FakeSequentialFile(final String fileName)
{
- this.fileName = fileName;
-
- this.sync = sync;
+ this.fileName = fileName;
}
public void close() throws Exception
More information about the jboss-cvs-commits
mailing list