×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Jun 2009
    Location
    Tel-Aviv Israel
    Posts
    410

    other midlets interaction in suit + class loading of midlets

    Hey guys,
    I'm wondering when I start my midlet one out of 10 in the suit, does all the suit loads into the memory, or only the midlet classes as it uses them?

    I know classes loading process is different between devices, but loading midlets? is there some behavior I can count on?
    Thanks,
    Adam Zehavi.

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: other midlets interaction in suit + class loading of midlets

    Behaviour you count on... hmmmm... that's always tricky. There's nothing strict in any specification about when a MIDlet class must be loaded. And even if it's in the specification, counting on it isn't always possible!

    As a general... I hestitate to say "rule"... let's say "observation"... MIDlet loading is implemented something like:

    Code:
    String midletClassName = readMidletClassNameFromJad(index);
    MIDlet midlet = (MIDlet) (Class.forName(midletClassName).newInstance());
    midlet.startApp();
    We can tell that Class.forName() is used, because if the MIDlet class is missing, we see a ClassNotFoundException (thrown by the runtime library), rather than a NoClassDefFoundError (thrown by the VM).

    I'm not aware of any implementation loading all the MIDlets. I guess it's possible than an implementation might load the all before the menu of them is displayed, in order to verify that they all exist, but I have no evidence that this happens.

    For me, a bigger worry would be what happens when the MIDlet terminates, and you return to the list of MIDlets in the suite (for devices that display a two-level menu, one of suites, then a second level of MIDlets in the suite). Does the VM terminate at the point? If it doesn't, then all the classes are still loaded, and their static variables will retain their state.

    Personally, I'd avoid multiple MIDlets in a suite, mainly because I just don't have enough experience of how different devices behave.

    Graham.

  3. #3
    Regular Contributor
    Join Date
    Jun 2009
    Location
    Tel-Aviv Israel
    Posts
    410

    Re: other midlets interaction in suit + class loading of midlets

    Thanks, Graham,

    here is the deal,
    I would like to use one midlet to be the main application, and another to be for example a sort of a connector to data, if it need to read from RMS, files, internet, what ever unknown operation to retrieve data, and since my main application is big enough and if I have resources that would only work once in a while, I would like to use them and dispose of them, and since class loading is an issue I was wondering, does each midlet has its own class loader? could I transfer information between them? I know I should learn more about multiple midlets, I just want to know if it worth investigating...

    there are other operations I use once in a while, or some even once, that I would not like to load into the memory every time the application starts
    Thanks,
    Adam Zehavi.

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: other midlets interaction in suit + class loading of midlets

    There will be only one class loader. In CLDC implementations, the class loader is part of the VM, and not an instantiable component. Whether or not classes are disposed of depends on whether or not the VM terminates in between. There's no guarantee.

    Communicating between MIDlets in a suite is possible by RMS - RMS is per suite, not per MIDlet, so all MIDlets in the same suite share the same record stores. There is no signing or permission involved.

  5. #5
    Regular Contributor
    Join Date
    Jun 2009
    Location
    Tel-Aviv Israel
    Posts
    410

    Re: other midlets interaction in suit + class loading of midlets

    how about storing data on a static var on one midlet and read it from another, not very OO, but would it do?
    Adam.
    Thanks,
    Adam Zehavi.

  6. #6
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: other midlets interaction in suit + class loading of midlets

    No, since there's no guarantee that the VM would remain active after terminating one MIDlet, and before launching the other.

Similar Threads

  1. Class used by multiple MIDlets in a MIDlet suite
    By hajj00 in forum Mobile Java General
    Replies: 1
    Last Post: 2008-05-13, 17:36
  2. Replies: 2
    Last Post: 2007-03-14, 17:15
  3. Replies: 0
    Last Post: 2005-10-20, 07:56
  4. Loading Multiple MIDlets on Emulator
    By shalindalal in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2003-12-15, 21:45
  5. Java midlets on Symbian OS? (2nd class?)
    By steffi1 in forum Symbian
    Replies: 0
    Last Post: 2003-11-29, 18:55

Posting Permissions

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