Can i run a background thread which has no connection with the MIDlet currently running? let me explain the problem in more detail,
1. i am running a midlet(A) which will has the capability to download another midlet(B). 2. midlet A starts a thread(T1) 3. midlet A downloaded the jad and jar of midlet B and installs it. 4. midlet A launchs the midlet B. 5. midlet B is running now
what will happens to the thread T1 when B is running will it be still in running state or is it destroyed immediatly after B gets the control?
Originally posted by Nidheesh P: what happens to T1 when A destroys.
'A' is an application so if you kill its main all of its resources should be destroyed. If two application ran concurrently on the same JVM passing the thread may be possible but the CLDC spec says that there is no universal behavior for devices running J2ME applications concurrently:
Depending on the resources available on the device, a CLDC system can allow multiple Java applications to execute concurrently, or can restrict the system to permit only the execution of one Java application at a time. It is up to the particular CLDC implementation to decide if the execution of multiple Java applications is supported by utilizing the multitasking capabilities (if they exist) of the underlying host operating system, or by instantiating multiple logical virtual machines to run the concurrent Java applications.
I was also under the impression that the sandbox model of J2ME prevents J2ME applications from declaratively starting or stopping other applications. The spec does not mention this (that I could find), so I could be wrong on that particular detail.
I sent a reply yesterday but it seems not updated. Anyway I will resend it again.
Ur reply clears my doubt regarding the background thread. But I still have one more problem.
Consider the case here, 1.midlet A is running 2.runtime memory of A contains jad and jar files of midlet B in two byte arrays. 3.assume some native methods which allows the applications to install, launch and remove midlet and midlet suites by passing the jad and jar files. 4.midlet A uses launchMIDletsuite method for launching the midlet B by passing the jad and jar files. 5.what will be the state of A after B is launched. (running?, waiting?, destroyed?) 6.Whether B is a subset of A. ie. Will A gets control back after B is destroyed. 7.if not, is there any way to get the control back to A?
Your contrived scenario is going to be different device to device on how it would be handled. There is no set answer.
I am skeptical that you could really get yourself into such a scenario though, and if you really wanted such functionality you might as well program outside of J2ME, which inherently comes with various security restrictions.
A good workman is known by his tools.
I can't beleive you just said that. Now I need to calm down with this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners