001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.cache;
016    
017    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018    
019    import java.io.Serializable;
020    
021    /**
022     * @author Brian Wing Shun Chan
023     * @author Michael Young
024     */
025    public class MultiVMPoolUtil {
026    
027            public static void clear() {
028                    getMultiVMPool().clear();
029            }
030    
031            public static <K extends Serializable, V extends Serializable>
032                    PortalCache<K, V> getCache(String name) {
033    
034                    return (PortalCache<K, V>)getMultiVMPool().getCache(name);
035            }
036    
037            public static <K extends Serializable, V extends Serializable>
038                    PortalCache<K, V> getCache(String name, boolean blocking) {
039    
040                    return (PortalCache<K, V>)getMultiVMPool().getCache(name, blocking);
041            }
042    
043            public static MultiVMPool getMultiVMPool() {
044                    PortalRuntimePermission.checkGetBeanProperty(MultiVMPoolUtil.class);
045    
046                    return _multiVMPool;
047            }
048    
049            public static void removeCache(String name) {
050                    getMultiVMPool().removeCache(name);
051            }
052    
053            public void setMultiVMPool(MultiVMPool multiVMPool) {
054                    PortalRuntimePermission.checkSetBeanProperty(getClass());
055    
056                    _multiVMPool = multiVMPool;
057            }
058    
059            private static MultiVMPool _multiVMPool;
060    
061    }