• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

How can I handle a subprocess?

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As the topic, I attempt to use ProcessBuilder to handle a subprocess, finally it works.

But I do wanna more feature of the subprocess, for instance, the time of subprocess running, the memory a subprocess consumed. If the running time or consumed memory of this subprocess exceeds the range that one customized, then destroy it immediately.

Is that possible, or else only jni can do it? thanks in advance.
 
author
Posts: 23928
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One option is to use another process (started in another thread). This other process, either vmstat or tasklist, depending on the OS, can be called constantly to get a read on the first process. If the resource limits are violated, it can inform the first thread, which can kill the process.

Henry
 
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Henry,

Sorry for my ignorance on this, can you describe a little more or suggest me a good URL on how to do it.

Ananth Chellathurai
 
Henry Wong
author
Posts: 23928
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ananth Chellathurai:
Sorry for my ignorance on this, can you describe a little more or suggest me a good URL on how to do it.

Ananth Chellathurai



A little more of which? vmstat or tasklist? Which OS are you using -- Windows or unix?

Henry
 
Marshal
Posts: 76811
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Before you even think of going near Process or ProcessBuilder you need to find the classic article by Michael Daconta: here. RpocessBuilder makes it a bit easier, but the principals in Daconta are unchanged.
 
Don't sweat petty things, or pet sweaty things. But cuddle this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic