001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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    }