I'll assume that you can compare and contrast by looking at the original posting, so here's how you create and use objects now:
Container
Sample1 obj1 = theContainer.create(new SampleImple(10));
Sample1 obj2 = theContainer.create(new SampleImple(10));
Sample1 obj3 = theContainer.clone(new SampleImple(), obj1);
Sample1 obj4 = theContainer.clone(new SampleImple(), obj2);
It no longer matters whether they are @Pessimistic or @Optimistic (the default) - the syntax remains the same. Here we have two objects, obj1 and obj2 and two clones (copies) of them, obj3 and obj4. They're all recoverable (state will not survive a machine crash), since that's the default behaviour for Container, but that can be changed via the constructor which allows for PERSISTENT or RECOVERABLE to be specified at creation time.
You can probably guess where further improvements are going to happen. For a start, the fact that the clone method takes a "blank" instance to copy the state into is necessary, but it would be better if it could be inferred. In addition, there are some state management aspects of the implementation that need tidying up because they currently escape through into the application. However, these are both fairly straightforward aspects to fix and the plan is to get them finalised soon. But for now, these changes should be sufficient to try things out. Enjoy!
No comments:
Post a Comment