Created
January 24, 2023 17:00
-
-
Save CorneAussems/78eeba61181fff321078143fe4581aca to your computer and use it in GitHub Desktop.
Liferay Groovy Verify if Master
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://liferay.dev/blogs/-/blogs/how-to-diagnose-and-recover-liferay-cluster | |
import com.liferay.portal.kernel.cache.MultiVMPool; | |
import com.liferay.registry.RegistryUtil; | |
import com.liferay.registry.Registry; | |
import com.liferay.portal.kernel.cache.PortalCache; | |
import com.liferay.registry.ServiceReference; | |
import com.liferay.portal.kernel.cluster.ClusterExecutorUtil; | |
import com.liferay.portal.kernel.cluster.ClusterMasterExecutorUtil; | |
private MultiVMPool getMultiVMPool() { | |
Registry registry = RegistryUtil.getRegistry(); | |
ServiceReference serviceReference = registry.getServiceReference(MultiVMPool.class); | |
return registry.getService(serviceReference); | |
} | |
out.println("=== Execution in: " + ClusterExecutorUtil.getLocalClusterNode()); | |
out.println("=== isMaster: "+ ClusterMasterExecutorUtil.isMaster()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment