diff --git a/docs/CM_Tutorial.adoc b/docs/CM_Tutorial.adoc index 63c960f17..56e1232fa 100755 --- a/docs/CM_Tutorial.adoc +++ b/docs/CM_Tutorial.adoc @@ -53,24 +53,26 @@ ChronicleMap cityPostalCodes = ChronicleMap == Persisted Chronicle Map -You can amend this code to create a persisted Chronicle Map by replacing `.create()` calls with `.createPersistedTo(cityPostalCodesFile)`. Use a persisted Chronicle Map if you want it to, either: +You can amend this code to create a persisted Chronicle Map by replacing `.create()` calls with `.createPersistedTo(cityPostalCodesFile)`. +Use a persisted Chronicle Map if you want it to, either: - - outlive the process it was created within; for example, to support hot application redeployment. - - be accessible from multiple concurrent processes on the same server. - - persist the data to disk. +- outlive the process it was created within; for example, to support hot application redeployment. +- be accessible from multiple concurrent processes on the same server. +- persist the data to disk. -The `cityPostalCodesFile` has to represent the same location on your server for all the Java -processes that wish to access this Chronicle Map instance. For example, `System.getProperty("java.io.tmpdir") + "/cityPostalCodes.dat"`. +The `cityPostalCodesFile` has to represent the same location on your server for all the Java processes that wish to access this Chronicle Map instance. +For example, `OS.getTarget() + "/cityPostalCodes.dat"`. The name and location of the file is entirely up to you. -NOTE: When you create a `ChronicleMap` instance with `.createPersistedTo(file)`, and the specified -file already exists in the system, you open a view to the existing Chronicle Map data store from -this JVM process, rather than creating a new Chronicle Map data store. That means that the data store may already contain some entries. No special action with the data is performed during such an operation. If you want to clean up corrupted entries, and ensure that the data store is in correct state, see the <> section. +NOTE: When you create a `ChronicleMap` instance with `.createPersistedTo(file)`, and the specified file already exists in the system, you open a view to the existing Chronicle Map data store from this JVM process, rather than creating a new Chronicle Map data store. +That means that the data store may already contain some entries. +No special action with the data is performed during such an operation. +If you want to clean up corrupted entries, and ensure that the data store is in correct state, see the <> section. == ChronicleMap instance vs Chronicle Map data store -In this tutorial, the term `ChronicleMap` instance (or simply `ChronicleMap`) is used to refer to an on-heap object providing access to a Chronicle Map data store (or Chronicle Map key-value store, or Chronicle Map store, or simply Chronicle Map, with space between two words in contrast to `ChronicleMap`), which could be purely in-memory, or persisted to disk. +In this tutorial, the term `ChronicleMap` instance (or simply `ChronicleMap`) is used to refer to an on-heap object providing access to a Chronicle Map data store (or Chronicle Map key-value store, or Chronicle Map store, or simply Chronicle Map, with space between two words in contrast to `ChronicleMap`), which could be purely in-memory, or persisted to disk. Currently the Java implementation doesn't allow creation of multiple accessor ChronicleMap` objects for a single *in-memory Chronicle Map store*; there is always a one-to-one relationship. diff --git a/docs/archived/README.md b/docs/archived/README.md index dfeaaf77f..21f40bf52 100755 --- a/docs/archived/README.md +++ b/docs/archived/README.md @@ -288,7 +288,7 @@ Map to either The `cityPostalCodesFile` has to represent the same location on your server among all Java processes, wishing to access this Chronicle Map instance, e. g. -`System.getProperty("java.io.tmpdir") + "/cityPostalCodes.dat"`. +`OS.getTarget() + "/cityPostalCodes.dat"`. The name and location of the file is entirely up to you. diff --git a/src/test/java/net/openhft/chronicle/map/AcquireGetUsingMain.java b/src/test/java/net/openhft/chronicle/map/AcquireGetUsingMain.java index 2937a3108..685f817cf 100644 --- a/src/test/java/net/openhft/chronicle/map/AcquireGetUsingMain.java +++ b/src/test/java/net/openhft/chronicle/map/AcquireGetUsingMain.java @@ -27,7 +27,7 @@ import static org.junit.Assert.fail; public class AcquireGetUsingMain { public static void main(String[] args) throws IOException { - File file = new File(System.getProperty("java.io.tmpdir") + "/test1"); + File file = new File(OS.getTarget() + "/test1"); ChronicleMap theSharedMap = ChronicleMapBuilder.of(String.class, Data.class) .createPersistedTo(file); diff --git a/src/test/java/net/openhft/chronicle/map/ArrayTest.java b/src/test/java/net/openhft/chronicle/map/ArrayTest.java index 7536a99e9..f056683d7 100644 --- a/src/test/java/net/openhft/chronicle/map/ArrayTest.java +++ b/src/test/java/net/openhft/chronicle/map/ArrayTest.java @@ -26,7 +26,7 @@ public class ArrayTest { // don't use Double[] as it uses ~3.5x the memory of a double[] @Test public void testDoubleArray() throws IOException { - File file = new File(OS.getTarget() + "/testDoubleArray-" + System.nanoTime()); + File file = new File(OS.getTarget() + "/testDoubleArray-" + Time.uniqueId()); ChronicleMap writeMap = ChronicleMapBuilder .of(Long.class, double[].class) .entries(1_000) @@ -46,7 +46,7 @@ public class ArrayTest { // don't use Long[] as it uses ~3.5x the memory of a long[] @Test public void testLongArray() throws IOException { - File file = new File(OS.getTarget() + "/testLongArray-" + System.nanoTime()); + File file = new File(OS.getTarget() + "/testLongArray-" + Time.uniqueId()); ChronicleMap writeMap = ChronicleMapBuilder .of(Long.class, long[].class) .entries(1_000) diff --git a/src/test/java/net/openhft/chronicle/map/ChronicleMapImportExportTest.java b/src/test/java/net/openhft/chronicle/map/ChronicleMapImportExportTest.java index 2502e0680..fff81c80f 100644 --- a/src/test/java/net/openhft/chronicle/map/ChronicleMapImportExportTest.java +++ b/src/test/java/net/openhft/chronicle/map/ChronicleMapImportExportTest.java @@ -38,12 +38,12 @@ import static org.junit.Assert.assertEquals; */ public class ChronicleMapImportExportTest { - public static final String TMP = System.getProperty("java.io.tmpdir"); + public static final String TMP = OS.getTarget(); @Test public void test() throws IOException, InterruptedException { - File file = new File(TMP + "/chronicle-map-" + System.nanoTime() + ".json"); + File file = new File(TMP + "/chronicle-map-" + Time.uniqueId() + ".json"); file.deleteOnExit(); ChronicleMapBuilder builder = ChronicleMapBuilder @@ -68,7 +68,7 @@ public class ChronicleMapImportExportTest { @Test public void testWithMapValue() throws IOException, InterruptedException { - File file = new File(TMP + "/chronicle-map-" + System.nanoTime() + ".json"); + File file = new File(TMP + "/chronicle-map-" + Time.uniqueId() + ".json"); file.deleteOnExit(); System.out.println(file.getAbsoluteFile()); @@ -97,7 +97,7 @@ public class ChronicleMapImportExportTest { @Test public void testWithMapOfMapValue() throws IOException, InterruptedException { - File file = new File(TMP + "/chronicle-map-" + System.nanoTime() + ".json"); + File file = new File(TMP + "/chronicle-map-" + Time.uniqueId() + ".json"); file.deleteOnExit(); System.out.println(file.getAbsoluteFile()); @@ -127,7 +127,7 @@ public class ChronicleMapImportExportTest { @Test public void testWithIntegerAndDouble() throws IOException, InterruptedException { - File file = new File(TMP + "/chronicle-map-" + System.nanoTime() + ".json"); + File file = new File(TMP + "/chronicle-map-" + Time.uniqueId() + ".json"); file.deleteOnExit(); try (ChronicleMap expected = ChronicleMap.of(Integer.class, Double.class) @@ -150,7 +150,7 @@ public class ChronicleMapImportExportTest { @Test public void testWithCharSeq() throws IOException, InterruptedException { - File file = new File(TMP + "/chronicle-map-" + System.nanoTime() + ".json"); + File file = new File(TMP + "/chronicle-map-" + Time.uniqueId() + ".json"); file.deleteOnExit(); System.out.println(file.getAbsolutePath()); @@ -178,10 +178,10 @@ public class ChronicleMapImportExportTest { @Test public void testFromHashMap() throws IOException, InterruptedException { - File file = new File(TMP + "/chronicle-map-" + System.nanoTime() + ".json"); + File file = new File(TMP + "/chronicle-map-" + Time.uniqueId() + ".json"); System.out.println(file.getCanonicalFile()); - File file2 = new File(TMP + "/chronicle-map-2" + System.nanoTime() + ".json"); + File file2 = new File(TMP + "/chronicle-map-2" + Time.uniqueId() + ".json"); System.out.println(file2.getCanonicalFile()); HashMap map = new HashMap(); @@ -216,7 +216,7 @@ public class ChronicleMapImportExportTest { @Test public void testWithLongValue() throws IOException, InterruptedException { - File file = new File(TMP + "/chronicle-map-" + System.nanoTime() + ".json"); + File file = new File(TMP + "/chronicle-map-" + Time.uniqueId() + ".json"); //file.deleteOnExit(); System.out.println(file.getAbsolutePath()); @@ -250,7 +250,7 @@ public class ChronicleMapImportExportTest { @Test public void testBondVOInterface() throws IOException, InterruptedException { - File file = new File(TMP + "/chronicle-map-" + System.nanoTime() + ".json"); + File file = new File(TMP + "/chronicle-map-" + Time.uniqueId() + ".json"); file.deleteOnExit(); System.out.println(file.getAbsolutePath()); diff --git a/src/test/java/net/openhft/chronicle/map/ChronicleMapSanityCheckTest.java b/src/test/java/net/openhft/chronicle/map/ChronicleMapSanityCheckTest.java index 8a12f33f1..167416ac5 100644 --- a/src/test/java/net/openhft/chronicle/map/ChronicleMapSanityCheckTest.java +++ b/src/test/java/net/openhft/chronicle/map/ChronicleMapSanityCheckTest.java @@ -38,9 +38,9 @@ public class ChronicleMapSanityCheckTest { @Test public void testSanity1() throws IOException, InterruptedException { - String tmp = System.getProperty("java.io.tmpdir"); + String tmp = OS.getTarget(); - String pathname = tmp + "/testSanity1-" + UUID.randomUUID().toString() + ".dat"; + String pathname = tmp + "/testSanity1-" + Time.uniqueId() + ".dat"; File file = new File(pathname); diff --git a/src/test/java/net/openhft/chronicle/map/ChronicleMapTest.java b/src/test/java/net/openhft/chronicle/map/ChronicleMapTest.java index 792964e22..28030fed0 100755 --- a/src/test/java/net/openhft/chronicle/map/ChronicleMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/ChronicleMapTest.java @@ -107,8 +107,8 @@ public class ChronicleMapTest { } static File getPersistenceFile() { - String TMP = System.getProperty("java.io.tmpdir"); - File file = new File(TMP + "/chm-test" + System.nanoTime() + count++); + String TMP = OS.getTarget(); + File file = new File(TMP + "/chm-test" + Time.uniqueId() + count++); file.deleteOnExit(); return file; } diff --git a/src/test/java/net/openhft/chronicle/map/ConcurrentMap8Test.java b/src/test/java/net/openhft/chronicle/map/ConcurrentMap8Test.java index 590d892dc..5c51aadb9 100644 --- a/src/test/java/net/openhft/chronicle/map/ConcurrentMap8Test.java +++ b/src/test/java/net/openhft/chronicle/map/ConcurrentMap8Test.java @@ -46,7 +46,7 @@ public class ConcurrentMap8Test extends JSR166TestCase { assertEquals(8, builder.minSegments()); //// end of test - String chmPath = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator") + "CHMTest" + System.nanoTime(); + String chmPath = OS.getTarget() + System.getProperty("file.separator") + "CHMTest" + Time.uniqueId(); try { return builder.create(new File(chmPath)); } catch (IOException e) { @@ -64,8 +64,8 @@ public class ConcurrentMap8Test extends JSR166TestCase { assertEquals(8, builder.minSegments()); //// end of test - String chmPath = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator") + - "CHMTest" + System.nanoTime(); + String chmPath = OS.getTarget() + System.getProperty("file.separator") + + "CHMTest" + Time.uniqueId(); try { return builder.create(new File(chmPath)); } catch (IOException e) { diff --git a/src/test/java/net/openhft/chronicle/map/EntryCountMapTest.java b/src/test/java/net/openhft/chronicle/map/EntryCountMapTest.java index 9f4c4236b..0cac1a96a 100644 --- a/src/test/java/net/openhft/chronicle/map/EntryCountMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/EntryCountMapTest.java @@ -36,7 +36,7 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; public class EntryCountMapTest { - static final String TMP = System.getProperty("java.io.tmpdir"); + static final String TMP = OS.getTarget(); static final int ecmTests = Integer.getInteger("ecm.tests", 5); double score = 0; int scoreCount = 0; diff --git a/src/test/java/net/openhft/chronicle/map/ForEachSegmentTest.java b/src/test/java/net/openhft/chronicle/map/ForEachSegmentTest.java index 25581065b..254d37444 100644 --- a/src/test/java/net/openhft/chronicle/map/ForEachSegmentTest.java +++ b/src/test/java/net/openhft/chronicle/map/ForEachSegmentTest.java @@ -19,7 +19,7 @@ public class ForEachSegmentTest { ChronicleMapBuilder builder = ChronicleMapBuilder.simpleMapOf(Integer.class, MyDto.class) .entries(256) .actualSegments(1); - File tmp = new File(OS.TMP, "stressTest-" + System.nanoTime()); + File tmp = new File(OS.TMP, "stressTest-" + Time.uniqueId()); tmp.deleteOnExit(); try (ChronicleMap map = builder.createOrRecoverPersistedTo(tmp)) { map.put(1, new MyDto()); @@ -38,7 +38,7 @@ public class ForEachSegmentTest { ChronicleMapBuilder builder = ChronicleMapBuilder.simpleMapOf(Integer.class, MyDto.class) .entries(256) .actualSegments(1); - File tmp = new File(OS.TMP, "stressTest-" + System.nanoTime()); + File tmp = new File(OS.TMP, "stressTest-" + Time.uniqueId()); Thread t = null; try (ChronicleMap map = builder.createOrRecoverPersistedTo(tmp)) { try { diff --git a/src/test/java/net/openhft/chronicle/map/Issue125Test.java b/src/test/java/net/openhft/chronicle/map/Issue125Test.java index d0762a004..5dc7bd120 100644 --- a/src/test/java/net/openhft/chronicle/map/Issue125Test.java +++ b/src/test/java/net/openhft/chronicle/map/Issue125Test.java @@ -28,7 +28,7 @@ import java.io.IOException; public class Issue125Test { @Test public void test() throws IOException { - final File cacheRoot = new File(OS.getTarget() + "/test.cm3"); + final File cacheRoot = new File(OS.getTarget() + "/test-" + Time.unqiueId+".cm3"); ChronicleMapBuilder shaToNodeBuilder = ChronicleMapBuilder.of(byte[].class, byte[].class) // .name("bytes-to-bytes") diff --git a/src/test/java/net/openhft/chronicle/map/Issue62ChronicleServer.java b/src/test/java/net/openhft/chronicle/map/Issue62ChronicleServer.java index 6d1e8cd78..18aa6ac08 100644 --- a/src/test/java/net/openhft/chronicle/map/Issue62ChronicleServer.java +++ b/src/test/java/net/openhft/chronicle/map/Issue62ChronicleServer.java @@ -30,10 +30,10 @@ public class Issue62ChronicleServer { //"This is just a long string, which causes sink to fail for some reason."; "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; final static File MAP_FILE_B = - Paths.get(System.getProperty("java.io.tmpdir"), "map.b").toFile(); + Paths.get(OS.getTarget(), Time.uniqueId()+"map.b").toFile(); private final static Logger LOGGER = LoggerFactory.getLogger(Issue62ChronicleServer.class); private final static File MAP_FILE_A = - Paths.get(System.getProperty("java.io.tmpdir"), "map.a").toFile(); + Paths.get(OS.getTarget(), Time.uniqueId()+"map.a").toFile(); static void prepare(File file) { if (file.exists()) diff --git a/src/test/java/net/openhft/chronicle/map/Issue63Test.java b/src/test/java/net/openhft/chronicle/map/Issue63Test.java index 876f94653..b2f37baee 100644 --- a/src/test/java/net/openhft/chronicle/map/Issue63Test.java +++ b/src/test/java/net/openhft/chronicle/map/Issue63Test.java @@ -87,7 +87,7 @@ public class Issue63Test { @Test public void issue63test() throws IOException { - Path path = Paths.get(System.getProperty("java.io.tmpdir") + "/test-vectors1.dat"); + Path path = Paths.get(OS.getTarget() + "/test-vectors1-"+Time.uniqueId()+".dat"); if (Files.exists(path)) Files.delete(path); File mapFile = path.toFile(); mapFile.deleteOnExit(); @@ -185,7 +185,7 @@ public class Issue63Test { void testChronicleMap() throws IOException { int num = 1_000_000; - testChronicleMap(System.getProperty("java.io.tmpdir"), num, num); + testChronicleMap(OS.getTarget(), num, num); ThreadLocalRandom random = ThreadLocalRandom.current(); for (int i = 0; i < num; i++) { String id = UUID.randomUUID().toString().substring(0, 32); @@ -313,7 +313,7 @@ public class Issue63Test { averageKnownItems.add("average sized known item"); } Path knownItemsPath = Paths.get( - System.getProperty("java.io.tmpdir") + "/test-vectors2.dat"); + OS.getTarget() + "/test-vectors2.dat"); Files.deleteIfExists(knownItemsPath); ChronicleMap> knownItems; ChronicleMapBuilder> knownItemsBuilder = ChronicleMap diff --git a/src/test/java/net/openhft/chronicle/map/MarkTest.java b/src/test/java/net/openhft/chronicle/map/MarkTest.java index b5dc8093a..b1f6ebd5d 100644 --- a/src/test/java/net/openhft/chronicle/map/MarkTest.java +++ b/src/test/java/net/openhft/chronicle/map/MarkTest.java @@ -63,7 +63,7 @@ public class MarkTest { @Test(timeout = 25000) public void persistedTest() { int rnd = new Random().nextInt(); - final File db = Paths.get(System.getProperty("java.io.tmpdir"), "mark" + rnd).toFile(); + final File db = Paths.get(OS.getTarget(), "mark" + rnd).toFile(); if (db.exists()) db.delete(); try { diff --git a/src/test/java/net/openhft/chronicle/map/ProcessInstanceLimiterMain.java b/src/test/java/net/openhft/chronicle/map/ProcessInstanceLimiterMain.java index f226109b4..628a675d6 100644 --- a/src/test/java/net/openhft/chronicle/map/ProcessInstanceLimiterMain.java +++ b/src/test/java/net/openhft/chronicle/map/ProcessInstanceLimiterMain.java @@ -41,7 +41,7 @@ public class ProcessInstanceLimiterMain implements Runnable { ChronicleMapBuilder.of(String.class, Data.class); builder.entries(10000); builder.minSegments(2); - File file = new File(System.getProperty("java.io.tmpdir") + "/" + sharedMapName); + File file = new File(OS.getTarget() + "/" + sharedMapName); this.theSharedMap = builder.create(); Thread t = new Thread(this, "ProcessInstanceLimiterMain updater"); t.setDaemon(true); diff --git a/src/test/java/net/openhft/chronicle/map/RecursiveRefereneChMapTest.java b/src/test/java/net/openhft/chronicle/map/RecursiveRefereneChMapTest.java index 7d6e0ad79..63cc1bea6 100644 --- a/src/test/java/net/openhft/chronicle/map/RecursiveRefereneChMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/RecursiveRefereneChMapTest.java @@ -24,11 +24,11 @@ import java.util.Map; import static org.junit.Assert.assertSame; public class RecursiveRefereneChMapTest { - public static final String TMP = System.getProperty("java.io.tmpdir"); + public static final String TMP = OS.getTarget(); @Test public void testRecursive() throws IOException { - File file = new File(TMP + "/test." + System.nanoTime() + ".tmp"); + File file = new File(TMP + "/test." + Time.uniqueId() + ".tmp"); file.deleteOnExit(); Map map = ChronicleMapBuilder.of(String.class, StupidCycle.class) .averageKey("Test").averageValue(new StupidCycle()) diff --git a/src/test/java/net/openhft/chronicle/map/WriteThroughputTest.java b/src/test/java/net/openhft/chronicle/map/WriteThroughputTest.java index 553eeadba..07c51693d 100644 --- a/src/test/java/net/openhft/chronicle/map/WriteThroughputTest.java +++ b/src/test/java/net/openhft/chronicle/map/WriteThroughputTest.java @@ -44,7 +44,7 @@ public class WriteThroughputTest { doTest(count, size, map); } - File file = new File("bandwidthTest" + System.nanoTime() + ".deleteme"); + File file = new File("bandwidthTest" + Time.uniqueId() + ".deleteme"); file.deleteOnExit(); try (ChronicleMap map = ChronicleMapBuilder .of(CharSequence.class, CharSequence.class) @@ -57,7 +57,7 @@ public class WriteThroughputTest { doTest(count, size, map); } - File file2 = new File("bandwidthTest" + System.nanoTime() + ".snappy.deleteme"); + File file2 = new File("bandwidthTest" + Time.uniqueId() + ".snappy.deleteme"); file2.deleteOnExit(); try (ChronicleMap map = ChronicleMapBuilder .of(CharSequence.class, CharSequence.class) @@ -78,7 +78,7 @@ public class WriteThroughputTest { int count = 2 << 10; int size = 50 << 10; - File file3 = new File("bandwidthTest" + System.nanoTime() + ".Z.deleteme"); + File file3 = new File("bandwidthTest" + Time.uniqueId() + ".Z.deleteme"); file3.deleteOnExit(); try (ChronicleMap map = ChronicleMapBuilder .of(CharSequence.class, CharSequence.class) diff --git a/src/test/java/net/openhft/chronicle/map/example/LotsOfEntriesMain.java b/src/test/java/net/openhft/chronicle/map/example/LotsOfEntriesMain.java index a33bb60ca..48648ce8e 100755 --- a/src/test/java/net/openhft/chronicle/map/example/LotsOfEntriesMain.java +++ b/src/test/java/net/openhft/chronicle/map/example/LotsOfEntriesMain.java @@ -52,7 +52,7 @@ public class LotsOfEntriesMain { private static void workEntries(final boolean add) throws IOException, ExecutionException, InterruptedException { final long entries = 100_000_000; - File file = new File("/tmp/lotsOfEntries.dat"); + File file = new File(OS.getTarget(), "lotsOfEntries.dat"); final ChronicleMap map = ChronicleMapBuilder .of(CharSequence.class, MyFloats.class) .entries(entries) diff --git a/src/test/java/net/openhft/chronicle/map/externalizable/ExternalizableTest.java b/src/test/java/net/openhft/chronicle/map/externalizable/ExternalizableTest.java index 5495ffdb9..6893f5743 100755 --- a/src/test/java/net/openhft/chronicle/map/externalizable/ExternalizableTest.java +++ b/src/test/java/net/openhft/chronicle/map/externalizable/ExternalizableTest.java @@ -29,7 +29,7 @@ import static org.junit.Assert.assertEquals; public class ExternalizableTest { @Test public void externalizable() throws IOException { - String path = OS.getTarget() + "/test-" + System.nanoTime() + ".map"; + String path = OS.getTarget() + "/test-" + Time.uniqueId() + ".map"; new File(path).deleteOnExit(); try (ChronicleMap storage = ChronicleMapBuilder .of(Long.class, SomeClass.class) diff --git a/src/test/java/net/openhft/chronicle/map/fromdocs/OpenJDKAndHashMapExamplesTest.java b/src/test/java/net/openhft/chronicle/map/fromdocs/OpenJDKAndHashMapExamplesTest.java index 0b575f590..21b2ba6cb 100644 --- a/src/test/java/net/openhft/chronicle/map/fromdocs/OpenJDKAndHashMapExamplesTest.java +++ b/src/test/java/net/openhft/chronicle/map/fromdocs/OpenJDKAndHashMapExamplesTest.java @@ -37,7 +37,7 @@ import static org.junit.Assert.assertEquals; public class OpenJDKAndHashMapExamplesTest { private static final SimpleDateFormat YYYYMMDD = new SimpleDateFormat("yyyyMMdd"); - private static final String TMP = System.getProperty("java.io.tmpdir"); + private static final String TMP = OS.getTarget(); public static long parseYYYYMMDD(String s) { try { @@ -50,7 +50,7 @@ public class OpenJDKAndHashMapExamplesTest { @Test public void bondExample() throws IOException, InterruptedException { - File file = new File(TMP + "/chm-myBondPortfolioCHM-" + System.nanoTime()); + File file = new File(TMP + "/chm-myBondPortfolioCHM-" + Time.uniqueId()); file.deleteOnExit(); ChronicleMap chm = ChronicleMapBuilder diff --git a/src/test/java/net/openhft/chronicle/map/ipc/StateMachineTutorial.java b/src/test/java/net/openhft/chronicle/map/ipc/StateMachineTutorial.java index a37b3dd95..bfce30183 100644 --- a/src/test/java/net/openhft/chronicle/map/ipc/StateMachineTutorial.java +++ b/src/test/java/net/openhft/chronicle/map/ipc/StateMachineTutorial.java @@ -37,7 +37,7 @@ public class StateMachineTutorial { ChronicleMap map = null; try { - File dataFile = new File(System.getProperty("java.io.tmpdir"), "hft-state-machine"); + File dataFile = new File(OS.getTarget(), "hft-state-machine"); map = ChronicleMapBuilder.of(Integer.class, StateMachineData.class) .entries(8).create(); diff --git a/src/test/java/net/openhft/chronicle/map/utility/ProcessInstanceLimiter.java b/src/test/java/net/openhft/chronicle/map/utility/ProcessInstanceLimiter.java index 4761331a3..0d295eb44 100644 --- a/src/test/java/net/openhft/chronicle/map/utility/ProcessInstanceLimiter.java +++ b/src/test/java/net/openhft/chronicle/map/utility/ProcessInstanceLimiter.java @@ -87,7 +87,7 @@ import static net.openhft.chronicle.algo.bytes.Access.checkedBytesStoreAccess; public class ProcessInstanceLimiter implements Runnable { private static final long DEFAULT_TIME_UPDATE_INTERVAL_MS = 100L; private static final String DEFAULT_SHARED_MAP_NAME = "ProcessInstanceLimiter_DEFAULT_SHARED_MAP_"; - private static final String DEFAULT_SHARED_MAP_DIRECTORY = System.getProperty("java.io.tmpdir"); + private static final String DEFAULT_SHARED_MAP_DIRECTORY = OS.getTarget(); private static final String DEFAULT_PROCESS_NAME = "_DEFAULT_"; static { diff --git a/src/test/java/net/openhft/lang/values/ArrayTest.java b/src/test/java/net/openhft/lang/values/ArrayTest.java index f11c7b006..db9178725 100644 --- a/src/test/java/net/openhft/lang/values/ArrayTest.java +++ b/src/test/java/net/openhft/lang/values/ArrayTest.java @@ -36,7 +36,7 @@ public class ArrayTest { public void test0() throws IOException, JSONException{ ClassAliasPool.CLASS_ALIASES.addAlias(MovingAverageArray.class); - File file = new File(OS.getTarget() + "/pf-PosistionsAndClose-" + System.nanoTime()); + File file = new File(OS.getTarget() + "/pf-PosistionsAndClose-" + Time.uniqueId()); ChronicleMap mapWrite = ChronicleMap .of(Long.class, MovingAverageArray.class)