1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.cache.cluster.clusterlink;
16  
17  import com.liferay.portal.kernel.cache.cluster.BasePortalCacheClusterChannel;
18  import com.liferay.portal.kernel.cache.cluster.PortalCacheClusterEvent;
19  import com.liferay.portal.kernel.cluster.ClusterLinkUtil;
20  import com.liferay.portal.kernel.cluster.Priority;
21  import com.liferay.portal.kernel.messaging.Message;
22  
23  /**
24   * <a href="ClusterLinkPortalCacheClusterChannel.java.html"><b><i>View Source
25   * </i></b></a>
26   *
27   * @author Shuyang Zhou
28   */
29  public class ClusterLinkPortalCacheClusterChannel
30      extends BasePortalCacheClusterChannel {
31  
32      public ClusterLinkPortalCacheClusterChannel(
33          String destination, Priority priority) {
34  
35          _destination = destination;
36          _priority = priority;
37      }
38  
39      public void dispatchEvent(PortalCacheClusterEvent portalCacheClusterEvent) {
40          Message message = new Message();
41  
42          message.setDestinationName(_destination);
43          message.setPayload(portalCacheClusterEvent);
44  
45          ClusterLinkUtil.sendMulticastMessage(message, _priority);
46      }
47  
48      private String _destination;
49      private Priority _priority;
50  
51  }