本文整理汇总了Java中org.jgroups.JChannel.getProtocolStack方法的典型用法代码示例。如果您正苦于以下问题:Java JChannel.getProtocolStack方法的具体用法?Java JChannel.getProtocolStack怎么用?Java JChannel.getProtocolStack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jgroups.JChannel
的用法示例。
在下文中一共展示了JChannel.getProtocolStack方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerChannel
import org.jgroups.JChannel; //导入方法依赖的package包/类
/**
* Registers an already created channel with the given MBeanServer. Wraps instance of JChannel
* with DynamicMBean and delegates all calls to the actual JChannel wrapped.
* <p>
* Optionally, this method will also wrap each protocol in the given channel with DynamicMBean
* and register it as well.
*
* @param channel
* @param server
* @param domain
* Has to be a JMX ObjectName of the domain, e.g. DefaultDomain:name=JGroups
* @param register_protocols
*/
public static void registerChannel(JChannel channel, MBeanServer server, String domain,
String cluster_name, boolean register_protocols) throws Exception {
if(channel == null)
throw new NullPointerException("channel cannot be null");
if (cluster_name == null)
cluster_name=channel.getClusterName();
if (cluster_name == null)
cluster_name = "null";
cluster_name=ObjectName.quote(cluster_name);
if (register_protocols) {
ProtocolStack stack = channel.getProtocolStack();
List<Protocol> protocols = stack.getProtocols();
for (Protocol p : protocols) {
if (p.getClass().isAnnotationPresent(MBean.class)) {
String jmx_name=getProtocolRegistrationName(cluster_name,domain,p);
register(p, server, jmx_name);
}
}
}
register(channel, server, getChannelRegistrationName(channel, domain, cluster_name));
}
示例2: unregisterChannel
import org.jgroups.JChannel; //导入方法依赖的package包/类
public static void unregisterChannel(JChannel c, MBeanServer server, String domain, String clusterName)
throws Exception {
if(clusterName != null)
clusterName=ObjectName.quote(clusterName);
ProtocolStack stack = c.getProtocolStack();
List<Protocol> protocols = stack.getProtocols();
for (Protocol p : protocols) {
if (p.getClass().isAnnotationPresent(MBean.class)) {
try {
String obj_name=getProtocolRegistrationName(clusterName, domain, p);
unregister(p, server, obj_name);
} catch (MBeanRegistrationException e) {
log.warn("MBean unregistration failed: " + e.getCause());
}
}
}
unregister(c, server, getChannelRegistrationName(c, domain, clusterName));
}
示例3: replaceStateTransferProtocolWith
import org.jgroups.JChannel; //导入方法依赖的package包/类
protected void replaceStateTransferProtocolWith(JChannel ch, Class<?> state_transfer_class) throws Exception {
ProtocolStack stack=ch.getProtocolStack();
if(stack.findProtocol(state_transfer_class) != null)
return; // protocol of the right class is already in stack
Protocol prot=stack.findProtocol(STATE_TRANSFER.class, StreamingStateTransfer.class);
Protocol new_state_transfer_protcol=(Protocol)state_transfer_class.newInstance();
if(prot != null) {
stack.replaceProtocol(prot, new_state_transfer_protcol);
}
else { // no state transfer protocol found in stack
Protocol flush=stack.findProtocol(FLUSH.class);
if(flush != null)
stack.insertProtocol(new_state_transfer_protcol, ProtocolStack.BELOW, FLUSH.class);
else
stack.insertProtocolAtTop(new_state_transfer_protcol);
}
}
示例4: setBundling
import org.jgroups.JChannel; //导入方法依赖的package包/类
private static void setBundling(JChannel ch, int max_bytes, long timeout) {
ProtocolStack stack=ch.getProtocolStack();
TP transport=stack.getTransport();
transport.setMaxBundleSize(max_bytes);
transport.setMaxBundleTimeout(timeout);
GMS gms=(GMS)stack.findProtocol(GMS.class);
gms.setViewAckCollectionTimeout(LATENCY * 2);
gms.setJoinTimeout(LATENCY * 2);
}
示例5: modifyStack
import org.jgroups.JChannel; //导入方法依赖的package包/类
private static void modifyStack(JChannel ch) {
ProtocolStack stack=ch.getProtocolStack();
GMS gms=(GMS)stack.findProtocol(GMS.class);
if(gms != null)
gms.setLogCollectMessages(false);
}
示例6: modifyGMS
import org.jgroups.JChannel; //导入方法依赖的package包/类
protected static void modifyGMS(JChannel c) {
ProtocolStack stack=c.getProtocolStack();
GMS gms=(GMS)stack.findProtocol(GMS.class);
if(gms != null)
gms.setLogCollectMessages(false);
}