本文整理了Java中org.apache.storm.utils.Utils.isOnWindows()
方法的一些代码示例,展示了Utils.isOnWindows()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.isOnWindows()
方法的具体详情如下:
包路径:org.apache.storm.utils.Utils
类名称:Utils
方法名:isOnWindows
暂无
代码示例来源:origin: apache/storm
public AdvancedRunAsUserFSOps(Map<String, Object> conf) {
super(conf);
if (Utils.isOnWindows()) {
throw new UnsupportedOperationException("ERROR: Windows doesn't support running workers as different users yet");
}
_conf = conf;
}
代码示例来源:origin: apache/storm
RunAsUserContainer(Container.ContainerType type, Map<String, Object> conf, String supervisorId, int supervisorPort,
int port, LocalAssignment assignment, ResourceIsolationInterface resourceIsolationManager,
LocalState localState, String workerId, StormMetricsRegistry metricsRegistry,
ContainerMemoryTracker containerMemoryTracker, Map<String, Object> topoConf,
AdvancedFSOps ops, String profileCmd) throws IOException {
super(type, conf, supervisorId, supervisorPort, port, assignment, resourceIsolationManager, localState,
workerId, metricsRegistry, containerMemoryTracker, topoConf, ops, profileCmd);
if (Utils.isOnWindows()) {
throw new UnsupportedOperationException("ERROR: Windows doesn't support running workers as different users yet");
}
}
代码示例来源:origin: apache/storm
public static String localTempPath() {
StringBuilder ret = new StringBuilder().append(System.getProperty("java.io.tmpdir"));
if (!Utils.isOnWindows()) {
ret.append("/");
}
ret.append(Utils.uuid());
return ret.toString();
}
代码示例来源:origin: apache/storm
public static void sendSignalToProcess(long lpid, int signum) throws IOException {
String pid = Long.toString(lpid);
try {
if (Utils.isOnWindows()) {
if (signum == SIGKILL) {
execCommand("taskkill", "/f", "/pid", pid);
} else {
execCommand("taskkill", "/pid", pid);
}
} else {
execCommand("kill", "-" + signum, pid);
}
} catch (ExecuteException e) {
LOG.info("Error when trying to kill {}. Process is probably already dead.", pid);
} catch (IOException e) {
LOG.info("IOException Error when trying to kill {}.", pid);
throw e;
}
}
代码示例来源:origin: apache/storm
/**
* Given a Tar File as input it will untar the file in a the untar directory passed as the second parameter
* <p/>
* This utility will untar ".tar" files and ".tar.gz","tgz" files.
*
* @param inFile The tar file as input.
* @param untarDir The untar directory where to untar the tar file.
* @param symlinksDisabled true if symlinks should be disabled, else false.
* @throws IOException
*/
public static void unTar(File inFile, File untarDir, boolean symlinksDisabled) throws IOException {
ensureDirectory(untarDir);
boolean gzipped = inFile.toString().endsWith("gz");
if (Utils.isOnWindows() || symlinksDisabled) {
// Tar is not native to Windows. Use simple Java based implementation for
// tests and simple tar archives
unTarUsingJava(inFile, untarDir, gzipped, symlinksDisabled);
} else {
// spawn tar utility to untar archive for full fledged unix behavior such
// as resolving symlinks in tar archives
unTarUsingTar(inFile, untarDir, gzipped);
}
}
代码示例来源:origin: apache/storm
/**
* Factory to create a new AdvancedFSOps
*
* @param conf the configuration of the process
* @return the appropriate instance of the class for this config and environment.
*/
public static AdvancedFSOps make(Map<String, Object> conf) {
if (Utils.isOnWindows()) {
return new AdvancedWindowsFSOps(conf);
}
if (ObjectReader.getBoolean(conf.get(Config.SUPERVISOR_RUN_WORKER_AS_USER), false)) {
return new AdvancedRunAsUserFSOps(conf);
}
return new AdvancedFSOps(conf);
}
代码示例来源:origin: apache/storm
config, componentPageInfo.get_eventlog_port()));
result.put("profilingAndDebuggingCapable", !Utils.isOnWindows());
result.put("profileActionEnabled", config.get(DaemonConfig.WORKER_PROFILER_ENABLED));
代码示例来源:origin: apache/storm
public void testArchives(File archiveFile, boolean supportSymlinks, int size) throws Exception {
if (Utils.isOnWindows()) {
代码示例来源:origin: org.apache.storm/storm-core
RunAsUserContainer(ContainerType type, Map<String, Object> conf, String supervisorId, int port,
LocalAssignment assignment, LocalState localState,
String workerId, Map<String, Object> topoConf, AdvancedFSOps ops, String profileCmd) throws IOException {
super(type, conf, supervisorId, port, assignment, localState, workerId, topoConf, ops,
profileCmd);
if (Utils.isOnWindows()) {
throw new UnsupportedOperationException("ERROR: Windows doesn't support running workers as different users yet");
}
}
代码示例来源:origin: org.apache.storm/storm-core
public AdvancedRunAsUserFSOps(Map<String, Object> conf) {
super(conf);
if (Utils.isOnWindows()) {
throw new UnsupportedOperationException("ERROR: Windows doesn't support running workers as different users yet");
}
_conf = conf;
}
代码示例来源:origin: org.apache.storm/storm-core
public static void sendSignalToProcess(long lpid, int signum) throws IOException {
String pid = Long.toString(lpid);
try {
if (isOnWindows()) {
if (signum == SIGKILL) {
execCommand("taskkill", "/f", "/pid", pid);
} else {
execCommand("taskkill", "/pid", pid);
}
} else {
execCommand("kill", "-" + signum, pid);
}
} catch (ExecuteException e) {
LOG.info("Error when trying to kill {}. Process is probably already dead.", pid);
} catch (IOException e) {
LOG.info("IOException Error when trying to kill {}.", pid);
throw e;
}
}
代码示例来源:origin: org.apache.storm/storm-core
/**
* Given a Tar File as input it will untar the file in a the untar directory
* passed as the second parameter
* <p/>
* This utility will untar ".tar" files and ".tar.gz","tgz" files.
*
* @param inFile The tar file as input.
* @param untarDir The untar directory where to untar the tar file.
* @param symlinksDisabled true if symlinks should be disabled, else false.
* @throws IOException
*/
public static void unTar(File inFile, File untarDir, boolean symlinksDisabled) throws IOException {
ensureDirectory(untarDir);
boolean gzipped = inFile.toString().endsWith("gz");
if (Utils.isOnWindows() || symlinksDisabled) {
// Tar is not native to Windows. Use simple Java based implementation for
// tests and simple tar archives
unTarUsingJava(inFile, untarDir, gzipped, symlinksDisabled);
} else {
// spawn tar utility to untar archive for full fledged unix behavior such
// as resolving symlinks in tar archives
unTarUsingTar(inFile, untarDir, gzipped);
}
}
代码示例来源:origin: org.apache.storm/storm-core
/**
* Factory to create a new AdvancedFSOps
* @param conf the configuration of the process
* @return the appropriate instance of the class for this config and environment.
*/
public static AdvancedFSOps make(Map<String, Object> conf) {
if (Utils.isOnWindows()) {
return new AdvancedWindowsFSOps(conf);
}
if (Utils.getBoolean(conf.get(Config.SUPERVISOR_RUN_WORKER_AS_USER), false)) {
return new AdvancedRunAsUserFSOps(conf);
}
return new AdvancedFSOps(conf);
}
内容来源于网络,如有侵权,请联系作者删除!