Skip to content

Commit

Permalink
QUEUE-14 now forcibly deleting files once they are used
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Austin committed Feb 11, 2015
1 parent 0be211d commit 89e62eb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Expand Up @@ -24,10 +24,13 @@ public void testCreateAppender() throws Exception {
for (int r = 0; r < 2; r++) {
for (int t = 1; t <= Runtime.getRuntime().availableProcessors(); t++) {
List<Future<?>> futureList = new ArrayList<>();
List<File> files = new ArrayList<>();
long start = System.nanoTime();
for (int j = 0; j < 4; j++) {
String name = TMP + "/single" + start + "-" + j + ".q";
new File(name).deleteOnExit();
File file = new File(name);
files.add(file);
file.deleteOnExit();
ChronicleQueue chronicle = new ChronicleQueueBuilder(name).build();

futureList.add(ForkJoinPool.commonPool().submit(() -> {
Expand Down Expand Up @@ -55,6 +58,9 @@ public void testCreateAppender() throws Exception {
}
long end = System.nanoTime();
System.out.printf("Threads: %,d - Write rate %.1f M/s - Read rate %.1f M/s%n", t, t * RUNS * 1e3 / (mid - start), t * RUNS * 1e3 / (end - mid));
for (File f : files) {
f.delete();
}
}
}
}
Expand Down
Expand Up @@ -43,10 +43,14 @@ public void testCreateAppender() throws Exception {
for (int r = 0; r < 2; r++) {
for (int t = 1; t < Runtime.getRuntime().availableProcessors(); t++) {
List<Future<?>> futureList = new ArrayList<>();

List<File> files = new ArrayList<>();
long start = System.nanoTime();
for (int j = 0; j < t; j++) {
String name = TMP + "/single" + start + "-" + j + ".q";
new File(name).deleteOnExit();
File file = new File(name);
file.deleteOnExit();
files.add(file);
DirectChronicleQueue chronicle = (DirectChronicleQueue) new ChronicleQueueBuilder(name)
.build();

Expand Down Expand Up @@ -76,6 +80,9 @@ public void testCreateAppender() throws Exception {
}
long end = System.nanoTime();
System.out.printf("Threads: %,d - Write rate %.1f M/s - Read rate %.1f M/s%n", t, t * RUNS * 1e3 / (mid - start), t * RUNS * 1e3 / (end - mid));
for (File f : files) {
f.delete();
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions chronicle-queue/src/test/java/simple/WriterMain.java
Expand Up @@ -32,6 +32,7 @@ public static void main(String[] args) throws IOException {
count++;
}
file.close();
tmpFile.delete();
long time = System.nanoTime() - start;
System.out.printf("%,d in %.3f secs, throughput %.6f M/s x %,d%n", count, time / 1e9, count * 1e3 / time, length);
}
Expand Down

0 comments on commit 89e62eb

Please sign in to comment.