Hi pramod,
Specifiaction
setAttribute
public void setAttribute(java.lang.String name,
java.lang.Object value)Binds an object to this session, using the name specified. If an object of the same name is already bound to the session, the object is replaced.
After this method executes, and
1. if the new object implements HttpSessionBindingListener, the container calls HttpSessionBindingListener.valueBound. The container then notifies any HttpSessionAttributeListeners in the web application.
2. If an object was already bound to this session of this name that implements HttpSessionBindingListener, its HttpSessionBindingListener.valueUnbound method is called.
3. If the value passed in is null, this has the same effect as calling removeAttribute().
Parameters:
name - the name to which the object is bound; cannot be null
value - the object to be bound
Throws:
IllegalStateException - if this method is called on an invalidated session
I am again re-emphasizing that step2 1,2,3 are mutually exclusive if conditions. That means they have no-depedencies.
I DON"T THINK SPECIFICATION DICTATING THE ORDER THERE.
ORDER WILL BE SPECIFIED IF THERE ARE DEPENDENCIES.
For example, If you take point (1). There it is combination of two atomic steps.
1.
1.1 if the new object implements HttpSessionBindingListener, the container
calls HttpSessionBindingListener.valueBound.
1.2 The container then notifies any HttpSessionAttributeListeners in the
web application.
***** HERE 1.2 can't execute before 1.1 This is order
Hence Websphere is a robust application server.
Proof for step 1 automicity (on websphere) Check with this listener Now call:
Result is : [8/10/07 19:51:17:453 IST] 00000020 SystemOut O
B [8/10/07 19:51:17:453 IST] 00000020 SystemOut O
Attribute added: (name = key,one) [8/10/07 19:51:17:453 IST] 00000020 SystemOut O UB
[8/10/07 19:51:17:453 IST] 00000020 SystemOut O
B [8/10/07 19:51:17:453 IST] 00000020 SystemOut O
Attribute replaced: (name = key,one) [8/10/07 19:51:17:453 IST] 00000020 SystemOut O UB
[8/10/07 19:51:17:453 IST] 00000020 SystemOut O Attribute removed: (name = key,two)
[8/10/07 19:51:17:453 IST] 00000020 SystemOut O Attribute removed: (name = key,null)
Thats all guys,
This is my opinion. Any contradictions invited.
because discussion can only makes us clear with this.