001    /**
002     * Copyright (c) 2000-present 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.cluster;
016    
017    import java.util.List;
018    import java.util.concurrent.TimeUnit;
019    
020    /**
021     * @author Shuyang Zhou
022     */
023    public interface ClusterExecutor {
024    
025            public void addClusterEventListener(
026                    ClusterEventListener clusterEventListener);
027    
028            public void destroy();
029    
030            public FutureClusterResponses execute(ClusterRequest clusterRequest);
031    
032            public void execute(
033                    ClusterRequest clusterRequest,
034                    ClusterResponseCallback clusterResponseCallback);
035    
036            public void execute(
037                    ClusterRequest clusterRequest,
038                    ClusterResponseCallback clusterResponseCallback, long timeout,
039                    TimeUnit timeUnit);
040    
041            public List<ClusterEventListener> getClusterEventListeners();
042    
043            public List<Address> getClusterNodeAddresses();
044    
045            public List<ClusterNode> getClusterNodes();
046    
047            public ClusterNode getLocalClusterNode();
048    
049            public Address getLocalClusterNodeAddress();
050    
051            public void initialize();
052    
053            public boolean isClusterNodeAlive(Address address);
054    
055            public boolean isClusterNodeAlive(String clusterNodeId);
056    
057            public boolean isEnabled();
058    
059            public void removeClusterEventListener(
060                    ClusterEventListener clusterEventListener);
061    
062    }