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.poller.comet;
016    
017    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018    
019    /**
020     * @author Edward Han
021     * @author Raymond Aug??
022     */
023    public class CometHandlerPoolUtil {
024    
025            public static void closeCometHandler(String sessionId)
026                    throws CometException {
027    
028                    getCometHandlerPool().closeCometHandler(sessionId);
029            }
030    
031            public static void closeCometHandlers() throws CometException {
032                    getCometHandlerPool().closeCometHandlers();
033            }
034    
035            public static CometHandler getCometHandler(String sessionId) {
036                    return getCometHandlerPool().getCometHandler(sessionId);
037            }
038    
039            public static CometHandlerPool getCometHandlerPool() {
040                    PortalRuntimePermission.checkGetBeanProperty(
041                            CometHandlerPoolUtil.class);
042    
043                    return _cometHandlerPool;
044            }
045    
046            public static void startCometHandler(
047                            CometSession cometSession, CometHandler cometHandler)
048                    throws CometException {
049    
050                    getCometHandlerPool().startCometHandler(cometSession, cometHandler);
051            }
052    
053            public void setCometHandlerPool(CometHandlerPool cometHandlerPool) {
054                    PortalRuntimePermission.checkSetBeanProperty(getClass());
055    
056                    _cometHandlerPool = cometHandlerPool;
057            }
058    
059            private static CometHandlerPool _cometHandlerPool;
060    
061    }