|
I'm CC:ing this to sail-dev as well, since most of my response is
oriented around the SAIL side of things, rather than the otrunk side. I implemented a solution on my local computer. Before I check anything in, I wanted to run it past everyone to see what they say. I used java.util.Timer to enable periodic automatic saving, like Scott suggested, in both OTrunkStep in pas-otrunk, and SailOTViewer in sail-otrunk. I set it to save every 1 minute. The old behavior of saving on exit/step close still exists. If the userDb isn't dirty (ie nothing has been changed by the user since the last save), then it skips saving anything. All of this I feel fine about. Then, in the SAIL EMF stuff, I had to make a couple changes which I'm a little more concerned about. 1) In the ISock interface, I add a new method: boolean add(T o, boolean replace); 2) I updated EMFSock and MemorySock to implement the new method by replacing add(T o) with add(T o, boolean replace), and then implementing add(T o) to call the new add method with a default of false which will use the existing behavior. (And MemorySock ignores the replace parameter altogether). 3) In EMFSock, if replace is true, it gets the most recent sockEntry (eSock.get(eSock.size()-1)) and then modifies it with the new value that was passed in. If replace is false, then the old behavior applies -- it creates a new sockEntry and adds it to the Sock. Originally, I had just modified EMFSock to do the "replace" behavior automatically when working with a rim of name "ot.learner.data". This worked fine when starting with a clean slate, but when I tried it in a situation where there was exisiting learner data, it would grab the most recent sockEntry and modify it. Unfortunately, that sockEntry was in the data passed down from the SDS, so it was never stored into the current session bundle (and therefore never saved back to the SDS -- bad!). By adding in the boolean parameter to add(), I could therefore ensure that the first time data was saved it would force the creation of a sockEntry, and then later saves could update that sockEntry. So my questions are: - Is there a way to detect whether a sock entry comes from the current sessionBundle (thus possibly avoiding the need to modify ISock)? - Are there any repercussions to modifying the ISock interface that I didn't think about/cover? - Are EMFSock and MemorySock the only classes implementing ISock right now? If nobody has any objections for now, I'll go ahead and check in my code. The current behavior should be retained for all but the OTrunk steps. Thanks! -- Aaron Scott Cytacki wrote: I think the timer thread is best idea. This is similar to a word processor saving things on a regular basis.You can use the java.util.Timer class for this. That way if anyone else is using a timer it _might_ reuse the thread. This type of approach would be helpful to udl authors as well so they would have a backup when things crash. But in that case they aren't saving into a rim, they are just saving a file. One issue you'll have to deal with is the sock entry model. In order to save the data it will need to be put into a sock, and that means a new sock entry. Which means during a session there will be multiple copies of the same ot.learner.data. A few solutions: - bypass the agent service and generate a session bundle directly if the data has changed and then save that to disk. - add some new "hint" to the rim/sock/sock entry design. This hint would say that this rim is for storing a large chunk of data so each change to it should replace the previous value instead of adding a new one. Then persistence implementation (emf in this case), could do its best to deal with this. How things should be handled across multiple sessions is a bit tricky here. - add a special case to the emf persistence implementation so it handles ot.learner.data labeled rims like the hint above. It is probably best to do something quick like the last solution, and then discuss this at the tels or sail meeting to see if anyone has opinions about it. Even in the medium term I would vote for the last solution. It is hacky, but I think once we get moving on the jackrabbit/CMS stuff, our method of using rims/socks/sock entries will get replaced by something different. So it isn't worth the effort to do it more cleanly. Scott Aaron Unger wrote: --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "SAIL-Dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/SAIL-Dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
- [SAIL-Dev] Re: Problem with session backup persistence Aaron Unger
- [SAIL-Dev] Re: Problem with session backup persistence Scott Cytacki
