org.agrona.IoUtil.tmpDirName()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(82)

本文整理了Java中org.agrona.IoUtil.tmpDirName()方法的一些代码示例,展示了IoUtil.tmpDirName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IoUtil.tmpDirName()方法的具体详情如下:
包路径:org.agrona.IoUtil
类名称:IoUtil
方法名:tmpDirName

IoUtil.tmpDirName介绍

[英]Return the system property for java.io.tmpdir ensuring a File#separator is at the end.
[中]返回java的系统属性。木卫一。tmpdir确保文件分隔符位于末尾。

代码示例

代码示例来源:origin: real-logic/aeron

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;
}

代码示例来源:origin: real-logic/aeron

storageDir = new File(IoUtil.tmpDirName());

代码示例来源:origin: real-logic/aeron

.mediaDriverAgentInvoker(driver.sharedAgentInvoker())
.deleteArchiveOnStart(true)
.archiveDir(new File(IoUtil.tmpDirName(), "archive-test"))
.segmentFileLength(segmentFileLength)
.threadingMode(archiveThreadingMode)

代码示例来源:origin: real-logic/aeron

@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));
}

代码示例来源:origin: real-logic/aeron

@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));
}

代码示例来源:origin: real-logic/aeron

archiveDir = new File(IoUtil.tmpDirName(), "archive");

代码示例来源:origin: real-logic/aeron

@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));
}

代码示例来源:origin: kaazing/gateway

/**
 * 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;
}

代码示例来源:origin: real-logic/artio

/**
 * 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();
}

代码示例来源:origin: real-logic/artio

private void launchLibrary()
{
  initiatingLibrary = connect(
    new LibraryConfiguration()
      .sessionAcquireHandler(initiatingSessionHandler)
      .libraryAeronChannels(singletonList("aeron:udp?endpoint=localhost:" + aeronPort))
      .monitoringFile(IoUtil.tmpDirName() + "fix-client" + File.separator + "libraryCounters"));
}

相关文章