https://issues.apache.org/jira/browse/AMQ-3374 - long kahadb tx - configurable max size and better tmp file name

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1138443 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2011-06-22 12:56:20 +00:00
parent 40ae055f37
commit 5bcd417f4b
1 changed files with 7 additions and 7 deletions

View File

@ -30,7 +30,7 @@ public class Transaction implements Iterable<Page> {
private RandomAccessFile tmpFile; private RandomAccessFile tmpFile;
private File txfFile; private File txFile;
private int nextLocation = 0; private int nextLocation = 0;
/** /**
@ -91,7 +91,7 @@ public class Transaction implements Iterable<Page> {
// List of pages freed in this transaction // List of pages freed in this transaction
private final SequenceSet freeList = new SequenceSet(); private final SequenceSet freeList = new SequenceSet();
private long maxTransactionSize = 10485760; private long maxTransactionSize = Integer.parseInt(System.getProperty("maxKahaDBTxSize", "" + 10485760));
private long size = 0; private long size = 0;
@ -654,7 +654,7 @@ public class Transaction implements Iterable<Page> {
throw new IOException("Can't delete temporary KahaDB transaction file:" + getTempFile()); throw new IOException("Can't delete temporary KahaDB transaction file:" + getTempFile());
} }
tmpFile = null; tmpFile = null;
txfFile = null; txFile = null;
} }
} }
size = 0; size = 0;
@ -678,7 +678,7 @@ public class Transaction implements Iterable<Page> {
throw new IOException("Can't delete temporary KahaDB transaction file:" + getTempFile()); throw new IOException("Can't delete temporary KahaDB transaction file:" + getTempFile());
} }
tmpFile = null; tmpFile = null;
txfFile = null; txFile = null;
} }
} }
size = 0; size = 0;
@ -693,10 +693,10 @@ public class Transaction implements Iterable<Page> {
protected File getTempFile() { protected File getTempFile() {
if (txfFile == null) { if (txFile == null) {
txfFile = new File(getPageFile().getDirectory(), IOHelper.toFileSystemSafeName(Long.toString(getWriteTransactionId())) + ".tmp"); txFile = new File(getPageFile().getDirectory(), IOHelper.toFileSystemSafeName("tx-"+ Long.toString(getWriteTransactionId()) + "-" + Long.toString(System.currentTimeMillis()) + ".tmp"));
} }
return txfFile; return txFile;
} }
/** /**