public static File makeTestDirectory() { final File archiveDir = new File(IoUtil.tmpDirName(), "archive-test"); if (archiveDir.exists()) { System.err.println("Warning archive directory exists, deleting: " + archiveDir.getAbsolutePath()); IoUtil.delete(archiveDir, false); } if (!archiveDir.mkdirs()) { throw new IllegalStateException("failed to make archive test directory: " + archiveDir.getAbsolutePath()); } return archiveDir; }
storageDir = new File(IoUtil.tmpDirName());
.mediaDriverAgentInvoker(driver.sharedAgentInvoker()) .deleteArchiveOnStart(true) .archiveDir(new File(IoUtil.tmpDirName(), "archive-test")) .segmentFileLength(segmentFileLength) .threadingMode(archiveThreadingMode)
@Before public void before() { rnd.setSeed(seed); driver = MediaDriver.launch( new MediaDriver.Context() .threadingMode(ThreadingMode.DEDICATED) .spiesSimulateConnection(true) .errorHandler(Throwable::printStackTrace) .dirDeleteOnStart(true)); archive = Archive.launch( new Archive.Context() .deleteArchiveOnStart(true) .archiveDir(new File(IoUtil.tmpDirName(), "archive-test")) .fileSyncLevel(0) .threadingMode(ArchiveThreadingMode.SHARED) .errorCounter(driver.context().systemCounters().get(SystemCounterDescriptor.ERRORS)) .errorHandler(driver.context().errorHandler())); aeron = Aeron.connect(); aeronArchive = AeronArchive.connect( new AeronArchive.Context() .controlResponseChannel(CONTROL_RESPONSE_URI) .controlResponseStreamId(CONTROL_RESPONSE_STREAM_ID) .aeron(aeron) .ownsAeronClient(true)); }
@Before public void before() { rnd.setSeed(seed); driver = MediaDriver.launch( new MediaDriver.Context() .threadingMode(ThreadingMode.DEDICATED) .spiesSimulateConnection(true) .errorHandler(Throwable::printStackTrace) .dirDeleteOnStart(true)); archive = Archive.launch( new Archive.Context() .fileSyncLevel(0) .deleteArchiveOnStart(true) .archiveDir(new File(IoUtil.tmpDirName(), "archive-test")) .threadingMode(ArchiveThreadingMode.SHARED) .errorCounter(driver.context().systemCounters().get(SystemCounterDescriptor.ERRORS)) .errorHandler(driver.context().errorHandler())); aeron = Aeron.connect(); aeronArchive = AeronArchive.connect( new AeronArchive.Context() .controlResponseChannel(CONTROL_RESPONSE_URI) .controlResponseStreamId(CONTROL_RESPONSE_STREAM_ID) .aeron(aeron) .ownsAeronClient(true)); }
archiveDir = new File(IoUtil.tmpDirName(), "archive");
@Before public void before() { final String aeronDirectoryName = CommonContext.generateRandomDirName(); archivingMediaDriver = ArchivingMediaDriver.launch( new MediaDriver.Context() .aeronDirectoryName(aeronDirectoryName) .termBufferSparseFile(true) .threadingMode(ThreadingMode.SHARED) .errorHandler(Throwable::printStackTrace) .spiesSimulateConnection(false) .dirDeleteOnStart(true), new Archive.Context() .maxCatalogEntries(MAX_CATALOG_ENTRIES) .aeronDirectoryName(aeronDirectoryName) .deleteArchiveOnStart(true) .archiveDir(new File(IoUtil.tmpDirName(), "archive")) .fileSyncLevel(0) .threadingMode(ArchiveThreadingMode.SHARED)); aeron = Aeron.connect( new Aeron.Context() .aeronDirectoryName(aeronDirectoryName)); aeronArchive = AeronArchive.connect( new AeronArchive.Context() .aeron(aeron)); }
/** * This method is used to compute the monitoring directory name which will be used by Agrona in order * to create a file in which to write the data in shared memory. * * The monitoring directory will be dependent of the operating system. * * For Linux we will use the OS implementation of the shared memory. So the directory will be created * in /dev/shm. For the other operating systems we will create a monitoring folder under the * gateway folder. * * @return the monitoring directory name */ private String getMonitoringDirName() { String monitoringDirName = IoUtil.tmpDirName() + MONITOR_DIR_NAME; if (LINUX.equalsIgnoreCase(System.getProperty(OS_NAME_SYSTEM_PROPERTY))) { final File devShmDir = new File(LINUX_DEV_SHM_DIRECTORY); if (devShmDir.exists()) { monitoringDirName = LINUX_DEV_SHM_DIRECTORY + monitoringDirName; } } return monitoringDirName; }
/** * If shared memory is available, use that as a temporary directory, * otherwise use the default temp directory * * @return the optimal temporary directory */ public static String optimalTmpDirName() { if ("Linux".equalsIgnoreCase(System.getProperty("os.name"))) { final File devShmDir = new File("/dev/shm"); if (devShmDir.exists()) { return devShmDir.getAbsolutePath(); } } return IoUtil.tmpDirName(); }
private void launchLibrary() { initiatingLibrary = connect( new LibraryConfiguration() .sessionAcquireHandler(initiatingSessionHandler) .libraryAeronChannels(singletonList("aeron:udp?endpoint=localhost:" + aeronPort)) .monitoringFile(IoUtil.tmpDirName() + "fix-client" + File.separator + "libraryCounters")); }