Cleaning up after a portlet
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > WebSphere > WebSphere Portal Server > Cleaning up after a portlet




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Cleaning up after a portlet  
Brian J. Sayatovic


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-28-05 11:04 PM

We're plaving some objects in the session that tie back to resources in our
backend that need to be cleaned up.  My current approach is to use the
HttpSessionBindingListener on the PortletSession.  When a special value is
unbound, it is interpreted as the session expiring, and the attached cleanup
logic is invoked.

One of the limitations of this is that other values in the session may have
already been unbound.  order of unbinding is not guaranteed, so I have to
keep references to anythign I need to clean up within the one special
object.

I'm also not confident in how safe this is.  I know when a session expihies
this will happen.  Also, it will happen when a session is invalidated, which
we do on logout.  what about when the server is gracefully shutting down?
In other words, I'm not sure I know how many ways the cleanup hook ight get
bypassed.

Someone recently suggested looking into the PortletSessionListener.  This
appears to be a much more explicit event.  However, some documentation I
found () says it doesn't handle server shutdown:

>logout()

When the user ends the session with the portal, the portal server calls the
logout() method to inform the portlet that the user's session instance is
terminating. The portlet should then clean up any resources for the portlet
user instance. This could include cleaning up, if necessary, the
authentication state of the user or cookies that might have been placed on
the browser by the portlet. At a minimum, any state on the backend
application should be cleaned up or marked as terminated to prevent any
remaining cookies on a subsequent request from being used.

Note: You cannot rely on the logout method being called when the portal is
shut down because the application server can destroy portlets and servlets
before the sessions are cleaned up. Therefore, the portlet is not available
at the time when the logout method should be called. If there are necessary
cleanup actions that a portlet must take when the portal server is shut
down, these must be done in the destroy method.











[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:59 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register