• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java POSIXFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中jnr.posix.POSIXFactory的典型用法代码示例。如果您正苦于以下问题:Java POSIXFactory类的具体用法?Java POSIXFactory怎么用?Java POSIXFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: monitorParent

import jnr.posix.POSIXFactory; //导入依赖的package包/类
private static void monitorParent(final int pid) {
  Subprocesses.startDaemon(() -> {
    while (true) {
      try {
        Thread.sleep(200);
      } catch (InterruptedException e) {
        continue;
      }
      int ppid = POSIXFactory.getPOSIX().getppid();
      if (ppid != pid) {
        // If we've been reparented, then the spawning parent is dead.
        System.exit(Subprocesses.OK_EXIT_CODE);
      }
    }
  });
}
 
开发者ID:spotify,项目名称:spawn,代码行数:17,代码来源:Trampoline.java


示例2: main

import jnr.posix.POSIXFactory; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  LinuxCpuService linuxCpuService = new LinuxCpuService(POSIXFactory.getPOSIX());
  List<CpuDetails> allCpuDetails = linuxCpuService.getAllCpuDetails();
  for (CpuDetails cpuDetails : allCpuDetails) {
    System.out.println("cpuDetails = " + cpuDetails);
  }
  List<CpuUsage> allCpuUsage1 = linuxCpuService.getAllCpuUsage();
  for (CpuUsage cpuUsage : allCpuUsage1) {
    System.out.println("cpuUsage = " + cpuUsage);
  }
  Thread.sleep(1 * 1000l);
  List<CpuUsage> allCpuUsage2 = linuxCpuService.getAllCpuUsage();
  for (int i = 0; i < allCpuUsage2.size(); i++) {
    CpuUsageRatio cpuUsageRatio = new CpuUsageRatio(allCpuUsage1.get(i), allCpuUsage2.get(i));
    System.out.println("cpuUsageRatio = " + cpuUsageRatio);
  }
}
 
开发者ID:tsegismont,项目名称:simone,代码行数:18,代码来源:LinuxCpuService.java


示例3: getPOSIX

import jnr.posix.POSIXFactory; //导入依赖的package包/类
public static synchronized POSIX getPOSIX()
{
    if (posix == null) {
        posix = POSIXFactory.getPOSIX(DEFAULT_HANDLER, true);
    }
    return posix;
}
 
开发者ID:wrmsr,项目名称:wava,代码行数:8,代码来源:POSIXUtils.java


示例4: sendSignalToProcess

import jnr.posix.POSIXFactory; //导入依赖的package包/类
private static void sendSignalToProcess(Process process, Signal signal) {
  int processPid = getProcessPid(process);
  if (processPid != -1) {
    LOGGER.info("Sending signal {} to process {}", signal.intValue(), processPid);
    POSIXFactory.getNativePOSIX().kill(processPid, signal.intValue());
  }
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:8,代码来源:ChaosMonkeyIntegrationTest.java


示例5: main

import jnr.posix.POSIXFactory; //导入依赖的package包/类
public static void main(String[] args) {
  POSIX posix = POSIXFactory.getPOSIX();
  LinuxProcessService service = new LinuxProcessService(posix);
  int[] allPids = service.getAllPids();
  System.out.println("allPids.length = " + allPids.length);
  int pid = posix.getpid();
  System.out.println(service.getProcessDetails(pid));
  System.out.println(service.getProcessMemoryUsage(pid));
  System.out.println(service.getProcessExecutionContext(pid));
  System.out.println(service.getProcessCpuUsage(pid));
}
 
开发者ID:tsegismont,项目名称:simone,代码行数:12,代码来源:LinuxProcessService.java


示例6: sendSignalToProcess

import jnr.posix.POSIXFactory; //导入依赖的package包/类
private void sendSignalToProcess(Process process, Signal signal) {
  int processPid = getProcessPid(process);
  if (processPid != -1) {
    LOGGER.info("Sending signal {} to process {}", signal.intValue(), processPid);
    POSIXFactory.getNativePOSIX().kill(processPid, signal.intValue());
  }
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:8,代码来源:ChaosMonkeyIntegrationTest.java


示例7: pid

import jnr.posix.POSIXFactory; //导入依赖的package包/类
static int pid() {
  return POSIXFactory.getPOSIX().getpid();
}
 
开发者ID:spotify,项目名称:spawn,代码行数:4,代码来源:Subprocesses.java


示例8: createCpuService

import jnr.posix.POSIXFactory; //导入依赖的package包/类
public static CpuService createCpuService() {
  return createCpuService(POSIXFactory.getPOSIX());
}
 
开发者ID:tsegismont,项目名称:simone,代码行数:4,代码来源:CpuServiceFactory.java


示例9: createProcessService

import jnr.posix.POSIXFactory; //导入依赖的package包/类
public static ProcessService createProcessService() {
  return createProcessService(POSIXFactory.getPOSIX());
}
 
开发者ID:tsegismont,项目名称:simone,代码行数:4,代码来源:ProcessServiceFactory.java


示例10: main

import jnr.posix.POSIXFactory; //导入依赖的package包/类
public static void main(String[] args) {
  LinuxSystemService service = new LinuxSystemService(POSIXFactory.getPOSIX());
  System.out.println(service.getSystemLoad());
  System.out.println(service.getSystemMemoryUsage().toStringRatio());
}
 
开发者ID:tsegismont,项目名称:simone,代码行数:6,代码来源:LinuxSystemService.java


示例11: createSystemService

import jnr.posix.POSIXFactory; //导入依赖的package包/类
public static SystemService createSystemService() {
  return createSystemService(POSIXFactory.getPOSIX());
}
 
开发者ID:tsegismont,项目名称:simone,代码行数:4,代码来源:SystemServiceFactory.java


示例12: kill

import jnr.posix.POSIXFactory; //导入依赖的package包/类
public static int kill(Process process, Signal signal) throws Exception {
    int pid = getPid(process);
    return POSIXFactory.getPOSIX().kill(pid, signal.intValue());
}
 
开发者ID:hawkular,项目名称:hawkular-metrics,代码行数:5,代码来源:ProcessUtil.java



注:本文中的jnr.posix.POSIXFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DependencyFacet类代码示例发布时间:2022-05-23
下一篇:
Java Sorting类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap