-
1. Re: Clustered Stateful Beans throw ClassCastException
keyurva Feb 10, 2005 1:52 PM (in response to keyurva)Correction: TestBean implements Test as well as Serializable
-
2. Re: Clustered Stateful Beans throw ClassCastException
bill.burke Feb 10, 2005 2:09 PM (in response to keyurva)REALLY Stupid bug on my part. I didn't test things well enough for clustering.
Apologies and THANKS FOR FINDING THIS!!!
It is fixed now in CVS. -
3. Re: Clustered Stateful Beans throw ClassCastException
keyurva Feb 10, 2005 5:36 PM (in response to keyurva)Thanks, Bill... I'll check it out...
One more question: does a clustered SFSB need to explicitly implement Serializable?...
Also, similar to how ejbPassivate and ejbActivate allow me to selectively serialize and deserialize non-serializable fields such as Connections; are there similar callback methods available for selective (custom) state replication? -
4. Re: Clustered Stateful Beans throw ClassCastException
bill.burke Feb 10, 2005 6:01 PM (in response to keyurva)Yes, SFSB must be Serializable
Yes, there are passivate and activate callbacks:
Look at the callback tutorial (or the testsuite)
@PrePassivate void myPassivationCode() {...}
@PostActivate void myActivationCode() {...} -
5. Re: Clustered Stateful Beans throw ClassCastException
keyurva Feb 10, 2005 7:20 PM (in response to keyurva)I just updated my code from CVS but the callback tutorial is not there...
There is a "Callbacks and Callback Listeners" link on the tutorials index page but the link is broken... I also looked into the tutorial folder but it's not there.
Can you add this tutorial to CVS?
Thanks,
Keyur -
6. Re: Clustered Stateful Beans throw ClassCastException
keyurva Feb 10, 2005 8:35 PM (in response to keyurva)My bad... I only did an update and not a checkout earlier... I checked out now and it's there.
Thanks. -
7. Re: Clustered Stateful Beans throw ClassCastException
keyurva Feb 14, 2005 1:20 PM (in response to keyurva)Bill - the callbacks that you talk about are EJB lifecycle callbacks... But are any of these callback methods called for state replication in a cluster...
For example, is there a callback method which gets called just before the changed node writes the state and is there a callback method which gets called just after the other nodes have read the changed state?
Thanks,
Keyur -
8. Re: Clustered Stateful Beans throw ClassCastException
bill.burke Feb 14, 2005 1:30 PM (in response to keyurva)very great point.
How about?
private void writeObject(java.io.ObjectOutputStream out)
throws IOException
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException;
or implementing Externalizable? -
9. Re: Clustered Stateful Beans throw ClassCastException
bill.burke Feb 14, 2005 1:32 PM (in response to keyurva)maybe I should ask, what kinds of things do you want to do with this callback? Fields should be marked as transient that you don't want replicated. You can recreate these fields using Serialization callbacks or PostActivate
-
10. Re: Clustered Stateful Beans throw ClassCastException
keyurva Feb 14, 2005 1:54 PM (in response to keyurva)Here's my post on the cluster forum which explains what I wanna do:
http://jboss.com/index.html?module=bb&op=viewtopic&t=59919
Basically, I want to convert the NonSer to its DTO representation just before the changed node writes the state and convert the DTO back to NonSer when the other nodes read the changed state.
As far as writeObject and readObject methods are concerned, I tried that earlier and it resulted in a very bizarre behavior... The writeObject method was called on the bean by the container after every client call... And the most interesting part was that the readObject method was called on the proxy object at the client!... I could not make head or tail about this one![/url]