java - Memory allocated to main class executed from servlet? -


i have servlet execute class main method(), can typically start via command line.

in web container tomcat, weblogic server, web container has own defined heap space , number of threads execute request sent web application.

if start class main method() in servlet, memory , threads allocated class?

when invoking method via calling myclass.main() (as stated in comment) not matter method called main - other method-invocation. such

  • any memory used during execution allocated on tomcat's heap
  • execution in thread processes servlet-request. servlet not continue processing until main() exits.

the easiest way use storage not tomcat's heap spawn new vm-process via runtime.exec() , run program there. result in quite overhead starting vm can take while.

if ok running in tomcat's vm want execute task in parallel servlet-processing have implement own thread-handling.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo