当前位置: 首页>>代码示例>>Java>>正文


Java IOUtils.tryGetCanonicalFileElseGetAbsoluteFile方法代码示例

本文整理汇总了Java中com.gemstone.gemfire.internal.util.IOUtils.tryGetCanonicalFileElseGetAbsoluteFile方法的典型用法代码示例。如果您正苦于以下问题:Java IOUtils.tryGetCanonicalFileElseGetAbsoluteFile方法的具体用法?Java IOUtils.tryGetCanonicalFileElseGetAbsoluteFile怎么用?Java IOUtils.tryGetCanonicalFileElseGetAbsoluteFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.gemstone.gemfire.internal.util.IOUtils的用法示例。


在下文中一共展示了IOUtils.tryGetCanonicalFileElseGetAbsoluteFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import com.gemstone.gemfire.internal.util.IOUtils; //导入方法依赖的package包/类
/**
 * After parsing the command line arguments, spawn the Java VM that will host the GemFire JMX Agent.
 */
public void start(final String[] args) throws Exception {
  final Map<String, Object> options = getStartOptions(args);

  workingDirectory = IOUtils.tryGetCanonicalFileElseGetAbsoluteFile((File) options.get(DIR));

  // verify that any GemFire JMX Agent process has been properly shutdown and delete any remaining status files...
  verifyAndClearStatus();

  // start the GemFire JMX Agent process...
  runCommandLine(options, buildCommandLine(options));

  // wait for the GemFire JMX Agent process to complete startup and begin running...
  // it is also possible the Agent process may fail to start, so this should not wait indefinitely unless
  // the status file was not successfully written to
  pollAgentUntilRunning();

  System.exit(0);
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:22,代码来源:AgentLauncher.java

示例2: server

import com.gemstone.gemfire.internal.util.IOUtils; //导入方法依赖的package包/类
/**
 * Starts the GemFire JMX Agent "server" process with the given command line arguments.
 */
public void server(final String[] args) throws Exception {
  final Map<String, Object> options = getServerOptions(args);

  // make the process a UNIX daemon if possible
  String errMsg = makeDaemon();

  workingDirectory = IOUtils.tryGetCanonicalFileElseGetAbsoluteFile((File) options.get(DIR));

  Status status = createStatus(this.basename, STARTING, OSProcess.getId());
  status.msg = errMsg;
  writeStatus(status);

  Agent agent = startAgentVM((Properties) options.get(AGENT_PROPS), status);

  // periodically check and see if the JMX Agent has been told to stop
  pollAgentForPendingShutdown(agent);
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:21,代码来源:AgentLauncher.java

示例3: runCommandLine

import com.gemstone.gemfire.internal.util.IOUtils; //导入方法依赖的package包/类
private int runCommandLine(final Map<String, Object> options, final String[] commandLine) throws IOException {
  // initialize the startup log starting with a fresh log file (where all startup messages are printed)
  final File startLogFile = IOUtils.tryGetCanonicalFileElseGetAbsoluteFile(
    new File(workingDirectory, startLogFileName));

  if (startLogFile.exists() && !startLogFile.delete()) {
    throw new IOException(LocalizedStrings.AgentLauncher_UNABLE_TO_DELETE_FILE_0.toLocalizedString(
      startLogFile.getAbsolutePath()));
  }

  Map<String, String> env = (Map<String, String>)options.get(ENVARGS);
  if (env == null) {
    env = new HashMap<String, String>();
  }
  // read the passwords from command line
  SocketCreator.readSSLProperties(env, true);

  printCommandLine(commandLine);

  final int pid = OSProcess.bgexec(commandLine, workingDirectory,
      startLogFile, false, env);

  System.out.println(LocalizedStrings
      .AgentLauncher_STARTING_JMX_AGENT_WITH_PID_0.toLocalizedString(pid));

  return pid;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:28,代码来源:AgentLauncher.java

示例4: stop

import com.gemstone.gemfire.internal.util.IOUtils; //导入方法依赖的package包/类
/**
 * Stops a running JMX Agent by setting the status to "shutdown pending".
 */
public void stop(final String[] args) throws Exception {
  final Map<String, Object> options = getStopOptions(args);

  workingDirectory = IOUtils.tryGetCanonicalFileElseGetAbsoluteFile((File) options.get(DIR));

  int exitStatus = 1;

  if (new File(workingDirectory, statusFileName).exists()) {
    spinReadStatus();

    if (!isStatus(SHUTDOWN)) {
      writeStatus(createStatus(this.basename, SHUTDOWN_PENDING, status.pid));
    }

    pollAgentForShutdown();

    if (isStatus(SHUTDOWN)) {
      System.out.println(LocalizedStrings.AgentLauncher_0_HAS_STOPPED.toLocalizedString(this.basename));
      deleteStatus();
      exitStatus = 0;
    }
    else {
      System.out.println(LocalizedStrings.AgentLauncher_TIMEOUT_WAITING_FOR_0_TO_SHUTDOWN_STATUS_IS_1
        .toLocalizedString(this.basename, status));
    }
  }
  else {
    System.out.println(LocalizedStrings.AgentLauncher_THE_SPECIFIED_WORKING_DIRECTORY_0_CONTAINS_NO_STATUS_FILE
      .toLocalizedString(workingDirectory));
  }

  System.exit(exitStatus);
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:37,代码来源:AgentLauncher.java

示例5: status

import com.gemstone.gemfire.internal.util.IOUtils; //导入方法依赖的package包/类
/**
 * Prints the status of the GemFire JMX Agent running in the configured working directory.
 */
public void status(final String[] args) throws Exception {
  this.workingDirectory = IOUtils.tryGetCanonicalFileElseGetAbsoluteFile((File) getStopOptions(args).get(DIR));
  System.out.println(getStatus());
  System.exit(0);
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:9,代码来源:AgentLauncher.java


注:本文中的com.gemstone.gemfire.internal.util.IOUtils.tryGetCanonicalFileElseGetAbsoluteFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。