本文整理汇总了Java中org.apache.axis2.clustering.ClusteringAgent类的典型用法代码示例。如果您正苦于以下问题:Java ClusteringAgent类的具体用法?Java ClusteringAgent怎么用?Java ClusteringAgent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClusteringAgent类属于org.apache.axis2.clustering包,在下文中一共展示了ClusteringAgent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendClusterMessage
import org.apache.axis2.clustering.ClusteringAgent; //导入依赖的package包/类
/**
* Send out policy status change notification to other nodes.
*
* @param clusterMessage
* @param isSync
*/
private void sendClusterMessage(PolicyStatusClusterMessage clusterMessage, boolean isSync) {
try {
if (log.isDebugEnabled()) {
log.debug("Sending policy status change cluster message to all other nodes");
}
ClusteringAgent clusteringAgent = EntitlementConfigHolder.getInstance()
.getConfigurationContextService()
.getServerConfigContext()
.getAxisConfiguration()
.getClusteringAgent();
if (clusteringAgent != null) {
clusteringAgent.sendMessage(clusterMessage, isSync);
} else {
log.error("Clustering Agent not available.");
}
} catch (ClusteringFault clusteringFault) {
log.error("Error while sending policy status change cluster message", clusteringFault);
}
}
示例2: replicateAssociationInfo
import org.apache.axis2.clustering.ClusteringAgent; //导入依赖的package包/类
private void replicateAssociationInfo(AssociationClusterMessage associationInfoData) {
if (log.isDebugEnabled()) {
log.debug("Starting to replicate association : " + associationInfoData.getAssociation().getHandle());
}
ClusteringAgent agent = IdentityProviderServiceComponent.getConfigContext().getAxisConfiguration().getClusteringAgent();
if (log.isDebugEnabled()) {
log.debug("Clustering Agent: " + agent);
}
if (agent != null) {
try {
agent.sendMessage(associationInfoData, true);
} catch (ClusteringFault e) {
log.error("Unable to send cluster message :" + e.getMessage(), e);
}
}
if (log.isDebugEnabled()) {
log.debug("Completed replicating association : " + associationInfoData.getAssociation().getHandle());
}
}
示例3: loadWellKnownMembers
import org.apache.axis2.clustering.ClusteringAgent; //导入依赖的package包/类
private void loadWellKnownMembers(ClusteringAgent clusteringAgent, OMElement clusterElement) {
clusteringAgent.setMembers(new ArrayList<Member>());
Parameter membershipSchemeParam = clusteringAgent.getParameter("membershipScheme");
if (membershipSchemeParam != null) {
String membershipScheme = ((String) membershipSchemeParam.getValue()).trim();
if (membershipScheme.equals(ClusteringConstants.MembershipScheme.WKA_BASED)) {
List<Member> members = new ArrayList<Member>();
OMElement membersEle =
clusterElement.getFirstChildWithName(new QName("members"));
if (membersEle != null) {
for (Iterator iter = membersEle.getChildrenWithLocalName("member"); iter.hasNext();) {
OMElement memberEle = (OMElement) iter.next();
String hostName =
memberEle.getFirstChildWithName(new QName("hostName")).getText().trim();
String port =
memberEle.getFirstChildWithName(new QName("port")).getText().trim();
members.add(new Member(replaceVariables(hostName),
Integer.parseInt(replaceVariables(port))));
}
}
clusteringAgent.setMembers(members);
}
}
}
示例4: start
import org.apache.axis2.clustering.ClusteringAgent; //导入依赖的package包/类
/**
* Will create a configuration context from the avialable data and then it
* will start the listener manager
*
* @throws AxisFault if something went wrong
*/
protected void start() throws AxisFault {
if (configContext == null) {
configContext = getConfigurationContext();
}
if (!started) {
ClusteringAgent clusteringAgent =
configContext.getAxisConfiguration().getClusteringAgent();
String avoidInit = ClusteringConstants.Parameters.AVOID_INITIATION;
if (clusteringAgent != null &&
clusteringAgent.getParameter(avoidInit) != null &&
((String) clusteringAgent.getParameter(avoidInit).getValue()).equalsIgnoreCase("true")) {
clusteringAgent.setConfigurationContext(configContext);
clusteringAgent.init();
}
listenerManager.startSystem(configContext);
started = true;
}
}
示例5: initCluster
import org.apache.axis2.clustering.ClusteringAgent; //导入依赖的package包/类
/**
* Initializes the ClusterManager for this ConfigurationContext
*
* @throws AxisFault
*/
public void initCluster() throws AxisFault {
ClusteringAgent clusteringAgent = axisConfiguration.getClusteringAgent();
if (clusteringAgent != null) {
StateManager stateManaget = clusteringAgent.getStateManager();
if (stateManaget != null) {
stateManaget.setConfigurationContext(this);
}
NodeManager nodeManager = clusteringAgent.getNodeManager();
if (nodeManager != null) {
nodeManager.setConfigurationContext(this);
}
if (shouldClusterBeInitiated(clusteringAgent)) {
clusteringAgent.setConfigurationContext(this);
clusteringAgent.init();
}
}
}
示例6: needPropertyDifferences
import org.apache.axis2.clustering.ClusteringAgent; //导入依赖的package包/类
/**
* @return true if we need to store property differences for this
* context in this scenario.
*/
private boolean needPropertyDifferences() {
// Don't store property differences if there are no
// cluster members.
ConfigurationContext cc = getRootContext();
if (cc == null) {
return false;
}
// Add the property differences only if Context replication is enabled,
// and there are members in the cluster
ClusteringAgent clusteringAgent = cc.getAxisConfiguration().getClusteringAgent();
if (clusteringAgent == null ||
clusteringAgent.getStateManager() == null) {
return false;
}
return true;
}
示例7: getMembers
import org.apache.axis2.clustering.ClusteringAgent; //导入依赖的package包/类
public GroupMember[] getMembers(String groupName) throws Exception {
ClusteringAgent clusteringAgent = getClusteringAgent();
GroupManagementAgent groupManagementAgent =
clusteringAgent.getGroupManagementAgent(groupName);
if (groupManagementAgent == null) {
handleException("No GroupManagementAgent defined for domain " + groupName);
return null;
}
List<Member> members = groupManagementAgent.getMembers();
GroupMember[] groupMembers = new GroupMember[members.size()];
int i = 0;
for (Member member : members) {
GroupMember groupMember = new GroupMember();
groupMember.setHostName(member.getHostName());
groupMember.setHttpPort(member.getHttpPort());
groupMember.setHttpsPort(member.getHttpsPort());
Properties properties = member.getProperties();
groupMember.setBackendServerURL(properties.getProperty("backendServerURL"));
groupMember.setMgConsoleURL(properties.getProperty("mgtConsoleURL"));
groupMembers[i] = groupMember;
i++;
}
return groupMembers;
}
示例8: addServiceMappingToCluster
import org.apache.axis2.clustering.ClusteringAgent; //导入依赖的package包/类
public static Boolean addServiceMappingToCluster(String mapping, String epr) throws AxisFault {
Boolean isMappingAdded = false;
try {
ClusteringAgent agent = getClusteringAgent();
if(agent != null) {
agent.sendMessage(new ServiceMappingAddRequest(mapping, epr), true);
isMappingAdded = true;
}
if (log.isDebugEnabled()) {
log.debug("sent cluster command to to get Active tenants on cluster");
}
} catch (AxisFault f) {
String msg = "Error in getting active tenant by cluster commands";
log.error(msg, f);
throw new AxisFault(msg);
}
return isMappingAdded;
}
示例9: addVirtualHostsToCluster
import org.apache.axis2.clustering.ClusteringAgent; //导入依赖的package包/类
public static Boolean addVirtualHostsToCluster(String hostName, String uri, String webappPath) throws AxisFault {
Boolean isMappingAdded = false;
try {
ClusteringAgent agent = getClusteringAgent();
if(agent != null) {
agent.sendMessage(new VirtualHostAddRequest(hostName, uri, webappPath), true);
isMappingAdded = true;
}
if (log.isDebugEnabled()) {
log.debug("sent cluster command to to get Active tenants on cluster");
}
} catch (AxisFault f) {
String msg = "Error in getting active tenant by cluster commands";
log.error(msg, f);
throw new AxisFault(msg);
}
return isMappingAdded;
}
示例10: deleteServiceMappingToCluster
import org.apache.axis2.clustering.ClusteringAgent; //导入依赖的package包/类
public static Boolean deleteServiceMappingToCluster(String mapping) throws AxisFault {
Boolean isMappingAdded = false;
try {
ClusteringAgent agent = getClusteringAgent();
if(agent != null) {
agent.sendMessage(new ServiceMappingDeleteRequest(mapping), true);
isMappingAdded = true;
}
if (log.isDebugEnabled()) {
log.debug("sent cluster command to to get Active tenants on cluster");
}
} catch (AxisFault f) {
String msg = "Error in getting active tenant by cluster commands";
log.error(msg, f);
throw new AxisFault(msg);
}
return isMappingAdded;
}
示例11: deleteVirtualHostsToCluster
import org.apache.axis2.clustering.ClusteringAgent; //导入依赖的package包/类
public static Boolean deleteVirtualHostsToCluster(String hostName) throws AxisFault {
Boolean isMappingAdded = false;
try {
ClusteringAgent agent = getClusteringAgent();
if(agent != null) {
agent.sendMessage(new VirtualHostDeleteMapping(hostName), true);
isMappingAdded = true;
}
if (log.isDebugEnabled()) {
log.debug("sent cluster command to to get Active tenants on cluster");
}
} catch (AxisFault f) {
String msg = "Error in getting active tenant by cluster commands";
log.error(msg, f);
throw new AxisFault(msg);
}
return isMappingAdded;
}
示例12: sendClusterMessage
import org.apache.axis2.clustering.ClusteringAgent; //导入依赖的package包/类
/**
* Sends a cluster message to other members of the cluster.If message transmission fails it will
* create a thread which will attempt retry transmission for a predefined amount of retry attempts.
*
* @param message The message to be transmitted
*/
public static void sendClusterMessage(ClusteringMessage message) {
ClusteringAgent agent = createClusteringAgent();
if (agent == null) {
//log.error("Unable to send the clustering message as a clustering agent was not obtained.");
if (log.isDebugEnabled()) {
log.debug(String.format("Failed to send cluster message :%s ", message));
}
return;
}
try {
agent.sendMessage(message, true);
if (log.isDebugEnabled()) {
log.debug(String.format("Successfully transmitted cluster message :%s", message));
}
} catch (ClusteringFault e) {
if (log.isDebugEnabled()) {
log.error("Unable to send the clustering message.The system will now attempt to retry " +
"sending the message", e);
}
}
}
示例13: sendSessionInvalidationClusterMessage
import org.apache.axis2.clustering.ClusteringAgent; //导入依赖的package包/类
public void sendSessionInvalidationClusterMessage(String sessionIndex) {
SessionClusterMessage clusterMessage = new SessionClusterMessage();
clusterMessage.setMessageId(UUID.randomUUID());
clusterMessage.setSessionIndex(sessionIndex);
ClusteringAgent clusteringAgent = SAML2SSOAuthFEDataHolder.getInstance()
.getConfigurationContextService().getServerConfigContext().getAxisConfiguration()
.getClusteringAgent();
if (clusteringAgent != null) {
int numberOfRetries = 0;
while (numberOfRetries < 60) {
try {
clusteringAgent.sendMessage(clusterMessage, true);
log.info("Sent [" + clusterMessage + "]");
break;
} catch (ClusteringFault e) {
numberOfRetries++;
if (numberOfRetries < 60) {
log.warn(
"Could not send SSOSessionInvalidationClusterMessage. Retry will be attempted in 2s. Request: "
+ clusterMessage, e);
} else {
log.error(
"Could not send SSOSessionInvalidationClusterMessage. Several retries failed. Request:"
+ clusterMessage, e);
}
try {
Thread.sleep(2000);
} catch (InterruptedException ignored) {
}
}
}
}
}
示例14: sendAddSubscriptionClusterMessage
import org.apache.axis2.clustering.ClusteringAgent; //导入依赖的package包/类
/**
* This is to send clusterMessage to inform other nodes about subscription added to the system, so that everyone can add new one.
* @param topicName
* @param subsciptionID
* @param tenantID
* @param tenantName
* @throws ClusteringFault
*/
public static void sendAddSubscriptionClusterMessage(String topicName,String subsciptionID,
int tenantID, String tenantName) throws ClusteringFault{
ConfigurationContextService configContextService = (ConfigurationContextService) PrivilegedCarbonContext
.getThreadLocalCarbonContext().getOSGiService(ConfigurationContextService.class);
ConfigurationContext configContext = configContextService.getServerConfigContext();
ClusteringAgent agent = configContext.getAxisConfiguration().getClusteringAgent();
agent.sendMessage(new SubscriptionClusterMessage(topicName,subsciptionID,tenantID, tenantName), false);
}
示例15: getClusterManager
import org.apache.axis2.clustering.ClusteringAgent; //导入依赖的package包/类
protected ClusteringAgent getClusterManager(ConfigurationContext configCtx) {
TribesClusteringAgent tribesClusterManager = new TribesClusteringAgent();
tribesClusterManager.setConfigurationContext(configCtx);
DefaultNodeManager configurationManager = new DefaultNodeManager();
tribesClusterManager.setNodeManager(configurationManager);
DefaultStateManager contextManager = new DefaultStateManager();
tribesClusterManager.setStateManager(contextManager);
return tribesClusterManager;
}