1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.kernel.cache.cluster;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  
20  /**
21   * <a href="PortalCacheClusterLinkUtil.java.html"><b><i>View Source</i></b></a>
22   *
23   * @author Shuyang Zhou
24   */
25  public class PortalCacheClusterLinkUtil {
26  
27      public static PortalCacheClusterLink getPortalCacheClusterLink() {
28          if (_portalCacheClusterLink == null) {
29              if (_log.isWarnEnabled()) {
30                  _log.warn(
31                      "PortalCacheClusterLinkUtil has not been initialized.");
32              }
33  
34              return null;
35          }
36  
37          return _portalCacheClusterLink;
38      }
39  
40      public static long getSubmittedEventNumber() {
41          if (_portalCacheClusterLink == null) {
42              if (_log.isWarnEnabled()) {
43                  _log.warn(
44                      "PortalCacheClusterLinkUtil has not been initialized.");
45              }
46  
47              return -1;
48          }
49  
50          return _portalCacheClusterLink.getSubmittedEventNumber();
51      }
52  
53      public static void sendEvent(
54          PortalCacheClusterEvent portalCacheClusterEvent) {
55  
56          if (_portalCacheClusterLink == null) {
57              if (_log.isWarnEnabled()) {
58                  _log.warn(
59                      "PortalCacheClusterLinkUtil has not been initialized.");
60              }
61  
62              return;
63          }
64  
65          _portalCacheClusterLink.sendEvent(portalCacheClusterEvent);
66      }
67  
68      public void setPortalCacheClusterLink(
69          PortalCacheClusterLink portalCacheClusterLink) {
70  
71          _portalCacheClusterLink = portalCacheClusterLink;
72      }
73  
74      private static Log _log = LogFactoryUtil.getLog(
75          PortalCacheClusterLinkUtil.class);
76  
77      private static PortalCacheClusterLink _portalCacheClusterLink;
78  
79  }