Package org.apache.shiro.session
Interface SessionListener
-
- All Known Implementing Classes:
SessionListenerAdapter
public interface SessionListener
Interface to be implemented by components that wish to be notified of events that occur during aSession
's life cycle.- Since:
- 0.9
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
onExpiration(Session session)
Notification callback that occurs when the corresponding Session has expired.void
onStart(Session session)
Notification callback that occurs when the corresponding Session has started.void
onStop(Session session)
Notification callback that occurs when the corresponding Session has stopped, either programmatically viaSession.stop()
or automatically upon a subject logging out.
-
-
-
Method Detail
-
onStart
void onStart(Session session)
Notification callback that occurs when the corresponding Session has started.- Parameters:
session
- the session that has started.
-
onStop
void onStop(Session session)
Notification callback that occurs when the corresponding Session has stopped, either programmatically viaSession.stop()
or automatically upon a subject logging out.- Parameters:
session
- the session that has stopped.
-
onExpiration
void onExpiration(Session session)
Notification callback that occurs when the corresponding Session has expired. Note: this method is almost never called at the exact instant that theSession
expires. Almost all session management systems, including Shiro's implementations, lazily validate sessions - either when they are accessed or during a regular validation interval. It would be too resource intensive to monitor every single session instance to know the exact instant it expires. If you need to perform time-based logic when a session expires, it is best to write it based on the session'slastAccessTime
and not the time when this method is called.- Parameters:
session
- the session that has expired.
-
-