State Persistence


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: State Persistence

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    Flat no:502,Marris Project-A apts,Motinagar,Erragadda,Hyd.
    Posts
    3

    Question State Persistence

    Hi all,
    I am trying to implement state persistence feature to my upcoming project.But where in i am completely uncertain in implementing it as a generic componet, so that every developer in our project can include these classes to implementing this feature in their modules.
    State Persistence:State persistence is a process of storing the state of a user and some way of knowing where the user is within the process, as well as having somewhere to store ephemeral application information. Also, if the user suspends a task and then restarts it, their restart location and any other information must be retrievable.
    I have done one sample application where i have used two procedures to implementing this.First,Using Database support everytime updating the user related id, Url and state Object in database.Latter on we found that this process is taking min.of two database hits for every page landing.Second, Using session management i used to keep all the details of user in session object and finally i am doing the databse batch updation intead of doing it everytime.This process is ok.But my problem is i want make it as a generic component.Can please guide me in this regard.If any have doubts on my issue,please feel free to ask the same.
    Thanks in Advance..

    Ravikiran kakarla.

  2. #2
    Join Date
    May 2004
    Location
    Durham, UK
    Posts
    174

    State Persistant

    Hi,

    There is only a couple of ways that I can think of, depending upon the level of intrusiveness you want.

    1. Make any class which needs to be persisted call the relevant methods in order to persist itself, probabily using a observer, observable type pattern.
    In this instance you would also need to have a method of restarting the class at the given point.
    I suggest in this instance that you llow the class to determine when it is interruptable.

    2. Write a dynamic proxy class which can be used to detect and act on any passing events.

    More info can be found on this at
    http://java.sun.com/products/jfc/tsc...er2/index.html

    Hope this helps - sorry if I've got hold of the wrong end of the stick.
    Hope this helps
    Graham

    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, and if they get mad, you are a mile away and you have their shoes ;-)

    http://www.grahamrobinsonsoftware.com

  3. #3
    Join Date
    May 2004
    Location
    Flat no:502,Marris Project-A apts,Motinagar,Erragadda,Hyd.
    Posts
    3

    State Persistence issues..

    Hi Graham..
    Your suggested ways to maintain state persistence is nice.You are about to touch the problem rope.Let me explain my problem a bit more clearer.For example,while user is surfing something on a shopping cart web site and he is about submit the detailed order page, unfortunately he closes his browser.Here my component comes into picture,when the same user logs back in to the system, The system has to ask about his previous state to continue from that point.The system has to check whether particular user is having previous state.If yes,it has to allow the user to continue from that state.
    I heared that the tomcat server have fecility to maintain the users previous state and user's previous navigation graph details.
    But i don't know how i have to user the server inorder to get the result from the server.
    Can u please help out in tis regard..

    thanks
    ravikiran kakarla.

  4. #4
    Join Date
    May 2004
    Location
    Durham, UK
    Posts
    174

    State Persistant

    Hi Ravikiran,

    I'm not aware of any way of doing this automatically in tomcat - although this does not mean that there isn't one.

    The way that I have implemented this in the past is to identify the user using a unique reference stored in a cookie.

    A single controller directs the user onto each display page based on a unqiue identifier for that page, as it does this it sets up the session information reading it from the database as required.

    At the end of each screen the information is persisted.

    Hope this helps.
    Graham.
    Hope this helps
    Graham

    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, and if they get mad, you are a mile away and you have their shoes ;-)

    http://www.grahamrobinsonsoftware.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center