当前位置: 首页>>代码示例>>Java>>正文


Java JChannel.getProtocolStack方法代码示例

本文整理汇总了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));
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:38,代码来源:JmxConfigurator.java

示例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));
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:21,代码来源:JmxConfigurator.java

示例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);
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:18,代码来源:StateTransferTest2.java

示例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);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:10,代码来源:MessageBundlingTest.java

示例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);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:7,代码来源:RpcDispatcherInterruptTest.java

示例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);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:7,代码来源:ReplicatedHashMapStartupTest.java


注:本文中的org.jgroups.JChannel.getProtocolStack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。