Results 1 to 1 of 1
- 11-02-2012, 01:23 AM #1Member
- Join Date
- Nov 2012
- Rep Power
separate JVM/Process per tab in JTabbedPane
hey, so I have this game I am trying to make a custom client for. What I have to start with is their jar file containing the game (which runs as an Applet). I download it every time my program executes, and make a few minor changes to the bytecode and then run it multiple times in my program. I have a JTabbedPane where each tab is a separate instance of this game.
Now my problem is, each instance of the game takes up a very large amount of memory. So I've come up with a few solutions, none of which are ideal:
1) Create a Starter class that initializes a JVM for the main application with some very large memory limits. I need this because most of my users are idiots, and the program has to be runnable just by double clicking a jar (I can't have them add their own JVM options). The problem with this is that the total memory of my users varies widely. So either some people won't be able to run enough tabs, or some won't be able to run the program because it asks for too much memory!
The primary issue with this approach however, is that all of the tabs share resources. If one of them freezes up for some reason, they all freeze up and that is a huge problem. I would prefer a number of asynchronously running tabs.
2) Create a program for a single instance of the game, and start an entirely new JVM for each "tab". I setup a Socket protocol for communication between each of the clients and a controller program. Functionally, this setup is perfect. I don't need to worry about JVM memory arguments and each of the clients is running independently! The problem is it is not user-friendly at all, and my user's just can't figure it out. Having a separate window (and start-bar icon) per client is just too complicated.
So what I would like to do is combine these two ideas somehow but I have no idea where to start. I want to keep the JTabbedPane layout in a single window, but I would like all of the processing for the individual tabs to be done invisibly in a new process. My naive approach to achieving this, would be to just use my socket protocol to transmit images and key events between the main controller and the client program. There are a few main problems with this though:
1) The Applet is heavily dependent on AWT and it will NOT run if AWT is "turned off". I know there is a JVM option to disable all the visual aspects of AWT, but when I use this the applet instantly crashes. So as far as the Applet is concerned, it needs to think it is running and being displayed as usual.
2) I still have no way to hide the windows that are created for each sub-process.
3) I really dislike the Socket approach and I'm hoping someone has some cleaner solution for me
Any help would be greatly appreciated,
- By firstname.lastname@example.org in forum AWT / SwingReplies: 1Last Post: 05-18-2012, 05:39 PM
- By gozuhair in forum New To JavaReplies: 38Last Post: 07-21-2011, 12:42 PM
- By Shyamz1 in forum New To JavaReplies: 0Last Post: 10-31-2010, 06:31 PM
- By doha786 in forum New To JavaReplies: 1Last Post: 03-10-2010, 04:43 PM
- By Inks in forum New To JavaReplies: 0Last Post: 03-26-2009, 01:12 AM