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 SingleVMPoolUtil {
026    
027            public static void clear() {
028                    getSingleVMPool().clear();
029            }
030    
031            public static <K extends Serializable, V> PortalCache<K, V> getCache(
032                    String name) {
033    
034                    return (PortalCache<K, V>)getSingleVMPool().getCache(name);
035            }
036    
037            public static <K extends Serializable, V> PortalCache<K, V> getCache(
038                    String name, boolean blocking) {
039    
040                    return (PortalCache<K, V>)getSingleVMPool().getCache(name, blocking);
041            }
042    
043            public static SingleVMPool getSingleVMPool() {
044                    PortalRuntimePermission.checkGetBeanProperty(SingleVMPoolUtil.class);
045    
046                    return _singleVMPool;
047            }
048    
049            public static void removeCache(String name) {
050                    getSingleVMPool().removeCache(name);
051            }
052    
053            public void setSingleVMPool(SingleVMPool singleVMPool) {
054                    PortalRuntimePermission.checkSetBeanProperty(getClass());
055    
056                    _singleVMPool = singleVMPool;
057            }
058    
059            private static SingleVMPool _singleVMPool;
060    
061    }