@Test public void testGetCores() throws IOException { System.out.println(Systems.getCores()); Systems.JDOS1CoresDetector.ETC_CONFIG_INFO = ""; File file = File.createTempFile("config_info", ""); Files.write(file, "{\"Config\": {\"Cpuset\": \"1,2\", \"Memory\": 4294967296}, \"host_ip\": \"10.8.65" + ".251\"}"); String config = Systems.JDOS1CoresDetector.ETC_CONFIG_INFO; try { Systems.JDOS1CoresDetector.ETC_CONFIG_INFO = file.getPath(); int cores = Systems.getCores(); Assert.assertEquals(cores, 2); } finally { Systems.JDOS1CoresDetector.ETC_CONFIG_INFO = config; } }
public static int getCores() { int cores; for (CoresDetector detector : coresDetectors) { cores = detector.getCores(); if (cores != CoresDetector.UNKNOWN) return cores; } return CoresDetector.UNKNOWN; }
Systems { public static int getCores() { int cores; for (CoresDetector detector : coresDetectors) { cores = detector.getCores(); if (cores != CoresDetector.UNKNOWN) return cores; } return CoresDetector.UNKNOWN; } }
Systems { public static int getCores() { int cores; for (CoresDetector detector : coresDetectors) { cores = detector.getCores(); if (cores != CoresDetector.UNKNOWN) return cores; } return CoresDetector.UNKNOWN; }  }
Systems { public static int getCores() { int cores; for (CoresDetector detector : coresDetectors) { cores = detector.getCores(); if (cores != CoresDetector.UNKNOWN) return cores; } return CoresDetector.UNKNOWN; }  static String getUserHome(); static String getOsName(); static OSType getOsType(); static String getTmpDir(); static long getPid(); static int getCores(); static Unsafe getUnsafe(); static int getCacheLineSize(); static int getLongBytes(); static int getIntBytes(); static int getByte(final byte[] data, final int index); static int getShort(final short[] data, final int index); static int getInt(final byte[] data, final int index); static long getLong(final byte[] data, final int index); static void copyLong(final byte[] src, final int srcIndex, final byte[] dest, final int destIndex); static void copyMemory(final byte[] src, final int srcIndex, final byte[] dest, final int destIndex,
                                  final int length); }
Systems { public static int getCores() { int cores; for (CoresDetector detector : coresDetectors) { cores = detector.getCores(); if (cores != CoresDetector.UNKNOWN) return cores; } return CoresDetector.UNKNOWN; }  static String getUserHome(); static String getOsName(); static OSType getOsType(); static String getTmpDir(); static long getPid(); static int getCores(); static Unsafe getUnsafe(); static int getCacheLineSize(); static int getLongBytes(); static int getIntBytes(); static int getByte(final byte[] data, final int index); static int getShort(final short[] data, final int index); static int getInt(final byte[] data, final int index); static long getLong(final byte[] data, final int index); static void copyLong(final byte[] src, final int srcIndex, final byte[] dest, final int destIndex); static void copyMemory(final byte[] src, final int srcIndex, final byte[] dest, final int destIndex,
                                  final int length); static final String USER_HOME; static final String OS_NAME; static final String JAVA_IO_TMPDIR; static final String JDOS_CPU; static int CACHE_LINE_SIZE; static final Unsafe UNSAFE; static final boolean FAST_ACCESS_SUPPORTED; static final boolean WINDOWS; static final boolean SOLARIS; static final boolean MAC; static final boolean FREEBSD; static final boolean LINUX; static final boolean OTHER; static final boolean PPC_64; static CoresDetector[] coresDetectors; }