313 * @return the native subprocess HANDLE returned by CreateProcess 314 */ 315 private static native long create(String cmdstr, 316 String envblock, 317 String dir, 318 long[] stdHandles, 319 boolean redirectErrorStream) 320 throws IOException; 321 322 /** 323 * Opens a file for atomic append. The file is created if it doesn't 324 * already exist. 325 * 326 * @param file the file to open or create 327 * @return the native HANDLE 328 */ 329 private static native long openForAtomicAppend(String path) 330 throws IOException; 331 332 private static native boolean closeHandle(long handle); 333 } | 313 * @return the native subprocess HANDLE returned by CreateProcess 314 */ 315 private static native long create(String cmdstr, 316 String envblock, 317 String dir, 318 long[] stdHandles, 319 boolean redirectErrorStream) 320 throws IOException; 321 322 /** 323 * Opens a file for atomic append. The file is created if it doesn't 324 * already exist. 325 * 326 * @param file the file to open or create 327 * @return the native HANDLE 328 */ 329 private static native long openForAtomicAppend(String path) 330 throws IOException; 331 332 private static native boolean closeHandle(long handle); 333 334 private static native int getProcessId(long handle); 335 private static native String getModuleBaseName(int pid); 336 337 @Override 338 public int getPid() { 339 if (!isAlive()) { 340 return -1; 341 } else { 342 return getProcessId(handle); 343 } 344 } 345 346 @Override 347 public String getProcessName(int pid) { 348 return getModuleBaseName(pid); 349 } 350 351 } |