×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    4

    Bug on 2660 and 2760

    Hi Guys,

    I'd like to know if there is a bug on 2660 and 2760 devices about persistence with RecordStore, because i'm facing a problem of the registers in my Rms after deleted, the records are getting back to the phone, 3 or 4 days after deleting.

    Thanks
    osvald.jr

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

    Re: Bug on 2660 and 2760

    I would guess that your application is terminating with record stores still open. This can cause missing updates on Series 40s.

    I recommend that you don't keep record stores open longer than the duration of one update, and that you open and close them within the same method invokation. If you reference RecordStore objects from non-local variables, you are likely to experience problems.

    Methods that read or update a record store should look like these:

    PHP Code:
    public byte[] readRecord(int nthrows RecordStoreException {
        
    byte[] data;
        
    RecordStore rs RecordStore.openRecordStore(RECORD_STORE_NAMEtrue);
        try {
            
    data rs.getRecord(n);
        } 
    finally {
            
    rs.closeRecordStore();
        }
        return 
    data;
    }

    public 
    void deleteRecord(int nthrows RecordStoreException {
        
    RecordStore rs RecordStore.openRecordStore(RECORD_STORE_NAMEtrue);
        try {
            
    rs.deleteRecord(n);
        } 
    finally {
            
    rs.closeRecordStore();
        }

    This way, record stores are open for the shortest possible time, and they are always closed, even if something goes wrong.

    Cheers,
    Graham.

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    4

    Re: Bug on 2660 and 2760

    Hi Graham,

    I'm not using the conventional persistence, i'm using a framework named Floggy , I've start using Floggy in order to try to finish this problem, but unfortunately doesn't work, I've already try this solution that you wrote, but i haven't success too, the problem continued to happen.

    I have a doubt, when i use rs.closeRecordStore(), is it like a "commit" in RecordStore? the rs.deleteRecord(n) does not guarantee the data is deleted?

    I was reading this post: http://discussion.forum.nokia.com/fo...d.php?t=162897, is the way write all my data in only one record?

    thanks,
    osvald.jr

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

    Re: Bug on 2660 and 2760

    I know nothing of Floggy, and I avoid using Other People's Code.

    How much information do you want to write? If it is something small, like game high-scores, user preferences, that kind of thing, then yes, put it all in one record, and just update it.

    The "one record technique" is very reliable across a huge range of handsets.

    Use a ByteArrayOutputStream and a DataOutputStream to construct the data, and their InputStream equivalents to deconstruct it later.

    You can probably use this technique for up to about 8k of data.

    Cheers,
    Graham.

  5. #5
    Registered User
    Join Date
    Apr 2008
    Posts
    4

    Re: Bug on 2660 and 2760

    I wanna write around 50 registers of 250 bytes each.

    Well.... I'll develop the "one record technique", i hope that works!

    Graham, can we consider this part of a bug in jvm?

    Thanks!!!

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

    Re: Bug on 2660 and 2760

    It is probably a bug in the RMS implementation. In my experience, bugs in RMS are common, not just on Nokia devices.

    Some devices struggle with more than a few records in a record store. Others, don't allow more than two or three record stores. Corruption, loss of updates, additions or deletes, are all common.

    That's why I stick religously to this very narrow use of RMS. Very strict open and close, one record store, one record.

    The other technique (favoured by jitu_goldie) is to read the entire record store, update it in memory, then delete the record store and re-create it from scratch. The downside of this is that there is a short, critical period when you have no data written. But, that period is probably not long enough to be of any real concern. The benefit is, you can have more than one record. It is also a reliable technique. Try it if the "one record" technique doesn't work (or if having so much data in one record is a problem).

    My other tip: encapsulate the RMS work as much as possible, so you can change the way it works easily. Or even, so you can have different implementations for different devices.

    Good luck!
    Graham.

  7. #7
    Registered User
    Join Date
    Apr 2008
    Posts
    4

    Re: Bug on 2660 and 2760

    Hi Graham!

    I've developed three versions of persistence, with only one record, several RecordStores and store in memory, for while the app it's working, but i'd like to make a test in a Series 60 device, do you know if in the Series 60 devices there is the same problem of persistence?

    Thanks

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

    Re: Bug on 2660 and 2760

    Hard for me to say which devices do and don't have problems. When I started developing with J2ME five years ago, so many phones had problems that I found a way that always worked and stuck with it. Newer phone might be very stable (though your experience suggests otherwise).

    MIDP-1 Series 60s have a problem recovering space when records are deleted (a bug that eventually chokes the phone to death), so the "one record technique" works quite well for them. But let us hope that all these phones are now dead! Newer (MIDP-2) Series 60s don't have the same problem.

    Cheers,
    Graham.

Similar Threads

  1. Developer platform for handsets 2660, 2760 and 2630
    By aadipa in forum General Development Questions
    Replies: 2
    Last Post: 2009-06-23, 12:44
  2. Nokia 2660 flip 'phone.
    By macalloa in forum General Development Questions
    Replies: 1
    Last Post: 2007-09-13, 12:10

Posting Permissions

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