List of usage examples for com.liferay.portal.kernel.servlet PortalSessionContext get
public static HttpSession get(String sessionId)
From source file:com.liferay.monitoring.web.internal.portlet.action.EditSessionMVCActionCommand.java
License:Open Source License
protected void invalidateSession(ActionRequest actionRequest) throws Exception { String sessionId = ParamUtil.getString(actionRequest, "sessionId"); try {/*from w w w . jav a2 s . c o m*/ PortletSession portletSession = actionRequest.getPortletSession(); String portletSessionId = portletSession.getId(); if (!portletSessionId.equals(sessionId)) { HttpSession userSession = PortalSessionContext.get(sessionId); if (userSession != null) { userSession.invalidate(); return; } if (!_clusterExecutor.isEnabled()) { return; } try { MethodHandler methodHandler = new MethodHandler(_invalidateSessionMethodKey, sessionId); ClusterRequest clusterRequest = ClusterRequest.createMulticastRequest(methodHandler, true); clusterRequest.setFireAndForget(true); _clusterExecutor.execute(clusterRequest); } catch (Throwable t) { _log.error("Unable to notify cluster ", t); } } } catch (Exception e) { _log.error("Unable to invalidate session", e); } }
From source file:com.liferay.monitoring.web.internal.portlet.action.EditSessionMVCActionCommand.java
License:Open Source License
private static void _invalidateSession(String sessionId) { HttpSession userSession = PortalSessionContext.get(sessionId); if (userSession != null) { boolean eanbled = ClusterInvokeThreadLocal.isEnabled(); ClusterInvokeThreadLocal.setEnabled(true); try {/*from w ww . jav a2s . c o m*/ userSession.invalidate(); } finally { ClusterInvokeThreadLocal.setEnabled(eanbled); } } }
From source file:com.liferay.portlet.monitoring.action.EditSessionAction.java
License:Open Source License
protected void invalidateSession(ActionRequest actionRequest) throws Exception { String sessionId = ParamUtil.getString(actionRequest, "sessionId"); HttpSession userSession = PortalSessionContext.get(sessionId); if (userSession != null) { try {/*from ww w.j av a2 s .c o m*/ if (!actionRequest.getPortletSession().getId().equals(sessionId)) { userSession.invalidate(); } } catch (Exception e) { _log.error(e); } } }