git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@663032 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-06-04 08:35:00 +00:00
parent 47ea0980f0
commit 2ccbdefc69
4 changed files with 28 additions and 7 deletions

View File

@ -589,7 +589,7 @@ public class HashIndex implements Index, HashIndexMBean {
DEFAULT_PAGE_SIZE = Integer.parseInt(System.getProperty("defaultPageSize", "1024"));
DEFAULT_KEY_SIZE = Integer.parseInt(System.getProperty("defaultKeySize", "96"));
DEFAULT_BIN_SIZE= Integer.parseInt(System.getProperty("defaultBinSize", "1024"));
MAXIMUM_CAPACITY = Integer.parseInt(System.getProperty("defaultPageSize", "16384"));
MAXIMUM_CAPACITY = Integer.parseInt(System.getProperty("maximumCapacity", "16384"));
DEFAULT_LOAD_FACTOR=Integer.parseInt(System.getProperty("defaultLoadFactor","50"));
}
}

View File

@ -107,6 +107,7 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener,
private Runnable periodicCleanupTask;
private boolean deleteAllMessages;
private boolean syncOnWrite;
private boolean syncOnTransaction=true;
private String brokerName = "";
private File directory;
private File directoryArchive;
@ -650,7 +651,11 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener,
* @throws IOException
*/
public Location writeCommand(DataStructure command, boolean syncHint) throws IOException {
return asyncDataManager.write(wireFormat.marshal(command), syncHint && syncOnWrite);
return writeCommand(command, syncHint,false);
}
public Location writeCommand(DataStructure command, boolean syncHint,boolean forceSync) throws IOException {
return asyncDataManager.write(wireFormat.marshal(command), (forceSync||(syncHint && syncOnWrite)));
}
private Location writeTraceMessage(String message, boolean sync) throws IOException {
@ -779,6 +784,14 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener,
public void setSyncOnWrite(boolean syncOnWrite) {
this.syncOnWrite = syncOnWrite;
}
public boolean isSyncOnTransaction() {
return syncOnTransaction;
}
public void setSyncOnTransaction(boolean syncOnTransaction) {
this.syncOnTransaction = syncOnTransaction;
}
/**
* @param referenceStoreAdapter the referenceStoreAdapter to set
@ -998,5 +1011,4 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener,
+ ".DisableLocking",
"false"));
}
}

View File

@ -40,6 +40,7 @@ public class AMQPersistenceAdapterFactory implements PersistenceAdapterFactory {
private String brokerName = "localhost";
private ReferenceStoreAdapter referenceStoreAdapter;
private boolean syncOnWrite;
private boolean syncOnTransaction=true;
private boolean persistentIndex=true;
private boolean useNio = true;
private int maxFileLength = AsyncDataManager.DEFAULT_MAX_FILE_LENGTH;
@ -154,6 +155,14 @@ public class AMQPersistenceAdapterFactory implements PersistenceAdapterFactory {
public void setSyncOnWrite(boolean syncOnWrite) {
this.syncOnWrite = syncOnWrite;
}
public boolean isSyncOnTransaction() {
return syncOnTransaction;
}
public void setSyncOnTransaction(boolean syncOnTransaction) {
this.syncOnTransaction = syncOnTransaction;
}
public boolean isUseNio() {
return useNio;

View File

@ -112,9 +112,9 @@ public class AMQTransactionStore implements TransactionStore {
return;
}
if (txid.isXATransaction()) {
peristenceAdapter.writeCommand(new JournalTransaction(JournalTransaction.XA_COMMIT, txid, wasPrepared), true);
peristenceAdapter.writeCommand(new JournalTransaction(JournalTransaction.XA_COMMIT, txid, wasPrepared), true,true);
} else {
peristenceAdapter.writeCommand(new JournalTransaction(JournalTransaction.LOCAL_COMMIT, txid, wasPrepared), true);
peristenceAdapter.writeCommand(new JournalTransaction(JournalTransaction.LOCAL_COMMIT, txid, wasPrepared), true,true);
}
}
@ -150,9 +150,9 @@ public class AMQTransactionStore implements TransactionStore {
}
if (tx != null) {
if (txid.isXATransaction()) {
peristenceAdapter.writeCommand(new JournalTransaction(JournalTransaction.XA_ROLLBACK, txid, false), true);
peristenceAdapter.writeCommand(new JournalTransaction(JournalTransaction.XA_ROLLBACK, txid, false), true,true);
} else {
peristenceAdapter.writeCommand(new JournalTransaction(JournalTransaction.LOCAL_ROLLBACK, txid, false), true);
peristenceAdapter.writeCommand(new JournalTransaction(JournalTransaction.LOCAL_ROLLBACK, txid, false), true,true);
}
}
}