Emma Liu 6 Vuodet sitten Great article! Thanks Mariano. Kirjaudu sisään äänestääksesi. Vastaa nimellä... Peruuta Mariano Alvaro Emma Liu 6 Vuodet sitten Thanks a lot Emma! Kirjaudu sisään äänestääksesi. Vastaa nimellä... Peruuta
Mariano Alvaro Emma Liu 6 Vuodet sitten Thanks a lot Emma! Kirjaudu sisään äänestääksesi. Vastaa nimellä... Peruuta
Corné Aussems 2 Vuodet sitten - Muokattu A 7.4 MultiVMPool version import com.liferay.portal.kernel.cache.MultiVMPool; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.liferay.portal.kernel.module.util.SystemBundleUtil; import com.liferay.portal.kernel.cache.PortalCache; import com.liferay.portal.kernel.util.PortalUtil; 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); BundleContext bundleContext = SystemBundleUtil.getBundleContext(); ServiceReference serviceReference = bundleContext.getServiceReference(MultiVMPool.class.name) return bundleContext.getService(serviceReference) } try { // Get local cluster node information String localClusterNode = ClusterExecutorUtil.getLocalClusterNode(); boolean isMaster = ClusterMasterExecutorUtil.isMaster(); // Check if clustering information is available if (localClusterNode != null) { println("=== Execution in: " + localClusterNode); } else { println("=== Clustering information is not available."); } println("=== isMaster: " + isMaster); MultiVMPool multiVMPool = getMultiVMPool(); if (multiVMPool != null) { now = new Date() println(now) PortalCache<String, String> portalCache1 = multiVMPool.getPortalCache("CACHE-TEST-1"); println("=== Value for testKey before: " + portalCache1.get("testKey")); portalCache1.put("testKey", "testValue:"+now); println("=== Value for testKey after: " + portalCache1.get("testKey")); } else { println("MultiVMPool service is not available."); } } catch (Exception e) { println(e) } Kirjaudu sisään äänestääksesi. Vastaa nimellä... Peruuta