Results 1 to 4 of 4
  1. #1
    otacon's Avatar
    otacon is offline Member
    Join Date
    Dec 2010
    Posts
    30
    Rep Power
    0

    Default Multiple modules with one or many JVMs

    Hi guys,

    I have somewhat of a fundamental question.

    I have a fairly large Java application. The application has 2 main modules, that are independent of each other , but are a part of the same core application, access the same database etc.

    I need to create a single starting point which launches the application (aka. both of the modules).

    My question is, how should this be accomplished ?

    My thoughts so far is that I have the following options:
    1. I can have wrapper of sorts, that instantiates both of the modules in the main function, and starts each as a new thread.
    2. I have a batch script that when executed starts both with an individual java ... call

    To my understanding 1. would resulting in using the same JVM, while 2. would result in using 2 different JVMs. I'm not sure which option is better however? Are there major drawbacks to using 1. ? Or is there a way to accomplish 2. but from an actual java method call (as I would prefer to keep the application self contained in java)? Is there an alternative I'm missing?

    Thanks a lot!
    --Otacon
    Somebody set up us the bomb.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Multiple modules with one or many JVMs

    I need to create a single starting point which launches the application (aka. both of the modules).
    Can you explain why the two programs need to be launched at the same time?
    Do the two programs interact with each other or have some dependencies on each other?
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    otacon's Avatar
    otacon is offline Member
    Join Date
    Dec 2010
    Posts
    30
    Rep Power
    0

    Default Re: Multiple modules with one or many JVMs

    More for deployment purposes than anything else. Conceptually, they are a part of the same Application, and access and modify the same database, and the output of one directly effects what the other one does (though the database). They do NOT however depend on each other directly or share any objects etc. That said, while functional, one is useless without the other, which is why they startup should (I think) be coupled somehow.
    --Otacon
    Somebody set up us the bomb.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Multiple modules with one or many JVMs

    There could be interactions between two programs running in the same JVM. One would be calls to the System.exit() method by either would stop both.
    Stopping and restarting one program might not be possible.

    I'm not sure how much would be saved by having two programs in the same JVM. The problems might outweigh the benefits.

    FWIW Years ago when CPUs were slower and JVMs took seconds to start, I wrote a java program that could load other java programs and execute them in the one JVM. That way the JVM was only started one time. It had a table of args to pass to the program and the files that needed to be on the classpath when it executed. I had to add a security manager to trap calls to System.exit() to keep one program from stopping the whole JVM. I still use that program occasionally. There is a URL:
    javascript:document.location = 'ExecJava:"D:/JavaDevelopment/runtime ExecuteJava.jar"' that can be used from a browser's bookmark bar to start the program's execution. Keeps me from having to move the browser out of the way to get to some of my java tool.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. modules integration
    By NANDU in forum New To Java
    Replies: 0
    Last Post: 04-21-2014, 08:37 PM
  2. Replies: 1
    Last Post: 07-10-2012, 07:03 PM
  3. modules in notepad
    By joypik in forum New To Java
    Replies: 6
    Last Post: 11-22-2010, 06:47 PM
  4. how many modules?
    By joypik in forum New To Java
    Replies: 13
    Last Post: 08-04-2010, 05:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •