🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #8778

Re: Calling applis from an appli

#8778
From: John McGrath TeamB
Date: Sun, 04 Mar 2001 04:08
56 lines
3453 bytes
On Sat, 3 Mar 2001 16:30:25 +0100, icsd.jt@wanadoo.fr wrote:

> I want just grouping this applications in one alone or make
> an super main menu for reduce the chargement time.
> It ' s possible ? and how .

Sure, that is possible, and it sounds like it would be an ideal way to 
run those "applications".  When you run them all in a single virtual 
machine, they will start faster and consume a lot less resources.

I am assuming that you have control of the source of the applications.  
If so, then you will probably just have to make a few simple changes to 
the structure of the applications to make them co-exist in the same VM 
with other code.  It is even possible that the applications are already 
well behaved, and no changes will be needed.

The area that is most likely to be an issue is how the applications 
shut themselves down.  If one of the applications calls System.exit(), 
it will shut down the virtual machine, so your menu and any other 
running applications will terminate as well.

Exactly how to deal with this will depend on the structure of your 
applications.  Assuming that they are typical Java GUI programs, they 
have a main() method that instantiates a single frame and shows it.  In 
that case, you can just have your menu instantiate and show the frame 
when the user runs the application from the menu.

The best way to deal with the exit() issue is to have the exit function 
for the application just dispose the frame.  Then from the main() 
method, add a WindowListener to the frame that detects the windowClosed 
event (not windowClosing), and does an exit when that occurs.

Other areas to watch out for is how static variables are initialized 
and handled.  If an application assumes that it will be the only user 
of such variables, it may find that it is wrong.

Another concern is the reentrancy of the applications.  When run from 
the main() method, they are always run once and then the VM is shut 
down after one execution.  But with this model, it will be possible to 
run the application multiple times.  So keep an eye out for code that 
makes such assumptions.

If you do this right, the applications should be able to run from the 
command line or from your menu without any noticeable difference in 
their behavior.  

Good luck, and left us know how it works out for you.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <MPG.150b85684df4a28498a003@forums.borland.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!bornews.borland.com!not-for-mail
References: <3aa0a077_1@dnews> <MPG.150a9aa7fc92fce5989ffc@forums.borland.com> <3aa10cea$1_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,ec6af10449d9afc3
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-03-03 20:14:03 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!bornews.borland.com!not-for-mail
From: John McGrath  [TeamB] <ng-b@JPMcGrath.net>
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: Calling applis from an appli
Date: Sat, 3 Mar 2001 23:08:44 -0500
Organization: Another Netscape Collabra Server User
Lines: 56
Message-ID: <MPG.150b85684df4a28498a003@forums.borland.com>
References: <3aa0a077_1@dnews> <MPG.150a9aa7fc92fce5989ffc@forums.borland.com> <3aa10cea$1_2@dnews>
NNTP-Posting-Host: dslcv1-60.fast.net
X-Newsreader: MicroPlanet Gravity v2.30