Example usage for com.liferay.portal.kernel.cluster ClusterInvokeThreadLocal isEnabled

List of usage examples for com.liferay.portal.kernel.cluster ClusterInvokeThreadLocal isEnabled

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.cluster ClusterInvokeThreadLocal isEnabled.

Prototype

public static boolean isEnabled() 

Source Link

Usage

From source file:com.liferay.journal.util.impl.JournalContentImpl.java

License:Open Source License

@Override
public void clearCache(long groupId, String articleId, String ddmTemplateKey) {

    _portalCacheIndexer.removeKeys(JournalContentKeyIndexEncoder.encode(groupId, articleId, ddmTemplateKey));

    if (ClusterInvokeThreadLocal.isEnabled()) {
        try {//  w  w  w.j a  v a2 s  . com
            ClusterableInvokerUtil.invokeOnCluster(ClusterInvokeAcceptor.class, this, _clearCacheMethod,
                    new Object[] { groupId, articleId, ddmTemplateKey });
        } catch (Throwable t) {
            ReflectionUtil.throwException(t);
        }
    }
}

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 {//w w w.j  a  v a2  s . c o  m
            userSession.invalidate();
        } finally {
            ClusterInvokeThreadLocal.setEnabled(eanbled);
        }
    }
}