Meaningless Drivel is fun!*
The moose likes Applets and the fly likes Multiple Instances of applets in an application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Multiple Instances of applets in an application" Watch "Multiple Instances of applets in an application" New topic
Author

Multiple Instances of applets in an application

harry tasawar
Greenhorn

Joined: Nov 27, 2013
Posts: 4
Hey all,
I have an application in which i have to download streams coming from a URL to a local file in my HDD. Now in order to do this i used applets. The problem is that as the app is just like a download manager, it has to run multiple instances of the applets at the same time. I did this by calling a seperate iframe for the applets so they can run concurrently but if i run two or three instances at a time, the java plugin becomes unresponsive and the app crashes. Can someone tell me what is the problem. It would very kind of you guys if you can help me with this.

P.S : I know this is not the best way to run multiple instances(using the iframe technique) but i am open to suggestions.

Haris.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18657
    
    8

harry tasawar wrote:The problem is that as the app is just like a download manager, it has to run multiple instances of the applets at the same time.


I don't know why it has to do that. I have seen applets which act as download managers (written by IBM, not by me) and I didn't have to run multiple instances of them. My guess would be that they used several threads to download several files at once.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

Are you doing anything special/customized for the download? Else it might make sense to delegate the download operation to the underlying browser which might in fact be more user friendly. E.g. Firefox has a DownThemAll plugin, which many people prefer.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
harry tasawar
Greenhorn

Joined: Nov 27, 2013
Posts: 4
Thanks for the replies guys,

@ Paul : that looks like a very good approach apart from the calling the iframe again and again. Do you have any sort of example regarding this? if you have then please let me know .

@ Maneesh : Yes maneesh, basically i have a sencha UI in which i have to show the progressbar according to the downloaded data so i have to call individual iframes in order to update the progressbar of each download separately, but that is only my assumption that i have to use iframes, maybe there is another way of doing this like paul suggested. If you guys have any other approach then i am all ears.

Thanks.
harry tasawar
Greenhorn

Joined: Nov 27, 2013
Posts: 4
OK guys, i have a possible theory here of why it is failing, when the applet gets loaded, it calls an html page in which i have a script function which constantly updates how much the data is downloaded. This function called every time when the data is collected from the stream, and i am committing the data every time so as to keep the downloaded state maintained. Could this be causing the performance issue?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18657
    
    8

harry tasawar wrote:@ Paul : that looks like a very good approach apart from the calling the iframe again and again. Do you have any sort of example regarding this? if you have then please let me know .

@ Maneesh : Yes maneesh, basically i have a sencha UI in which i have to show the progressbar according to the downloaded data so i have to call individual iframes in order to update the progressbar of each download separately, but that is only my assumption that i have to use iframes, maybe there is another way of doing this like paul suggested. If you guys have any other approach then i am all ears.


I don't see where I recommended the use of any iframes at all. Why would you do that? If you have an applet and you need to show a progress bar, use a Java progress bar instead of an HTML hack.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple Instances of applets in an application