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


Java Util.parseCommaDelimitedStrings方法代码示例

本文整理汇总了Java中org.jgroups.util.Util.parseCommaDelimitedStrings方法的典型用法代码示例。如果您正苦于以下问题:Java Util.parseCommaDelimitedStrings方法的具体用法?Java Util.parseCommaDelimitedStrings怎么用?Java Util.parseCommaDelimitedStrings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jgroups.util.Util的用法示例。


在下文中一共展示了Util.parseCommaDelimitedStrings方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _getProperty

import org.jgroups.util.Util; //导入方法依赖的package包/类
private static String _getProperty(String var, String default_value) {
    if(var == null)
        return null;
    List<String> list=Util.parseCommaDelimitedStrings(var);
    if(list == null || list.isEmpty()) {
        list=new ArrayList<String>(1);
        list.add(var);
    }
    String retval=null;
    for(String prop: list) {
        try {
            retval=ApplicationProperties.getProperty(prop);
            if(retval != null)
                return retval;
        }
        catch(Throwable e) {
        }
    }
    return default_value;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:21,代码来源:JGroupsUtils.java

示例2: onInfo

import org.jgroups.util.Util; //导入方法依赖的package包/类
public void onInfo(Map<String, String> information) {
    String view=information.get("view");
    Collection<String> list;
    if(view != null) {
        list=Util.parseCommaDelimitedStrings(view);
        if(list != null) {
            num_servers=list.size();
            if(mainFrame != null)
                setTitle();
            servers.clear();
            servers.addAll(list);
            newView(view);
        }
        else {
            String targets=information.get("endpoints");
            if(targets != null) {
                list=Util.parseCommaDelimitedStrings(targets);
                if(list != null) {
                    num_servers=list.size();
                    if(mainFrame != null)
                        setTitle();
                    servers.clear();
                    servers.addAll(list);
                }
            }
        }
    }

   
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:31,代码来源:StompChat.java

示例3: onInfo

import org.jgroups.util.Util; //导入方法依赖的package包/类
public void onInfo(Map<String, String> information) {
    String view=information.get("view");
    Collection<String> list;
    if(view != null) {
        list=Util.parseCommaDelimitedStrings(view);
        if(list != null) {
            num_servers=list.size();
            if(mainFrame != null)
                setTitle();
            servers.clear();
            servers.addAll(list);
        }
        else {
            String targets=information.get("endpoints");
            if(targets != null) {
                list=Util.parseCommaDelimitedStrings(targets);
                if(list != null) {
                    num_servers=list.size();
                    if(mainFrame != null)
                        setTitle();
                    servers.clear();
                    servers.addAll(list);
                }
            }
        }
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:28,代码来源:StompDraw.java

示例4: sizes

import org.jgroups.util.Util; //导入方法依赖的package包/类
@Property(description="Max times to block for the listed messages sizes (Message.getLength()). Example: \"1000:10,5000:30,10000:500\"")
public void setMaxBlockTimes(String str) {
    if(str == null) return;
    Long prev_key=null, prev_val=null;
    List<String> vals=Util.parseCommaDelimitedStrings(str);
    if(max_block_times == null)
        max_block_times=new TreeMap<>();
    for(String tmp: vals) {
        int index=tmp.indexOf(':');
        if(index == -1)
            throw new IllegalArgumentException("element '" + tmp + "'  is missing a ':' separator");
        Long key=Long.parseLong(tmp.substring(0, index).trim());
        Long val=Long.parseLong(tmp.substring(index +1).trim());

        // sanity checks:
        if(key < 0 || val < 0)
            throw new IllegalArgumentException("keys and values must be >= 0");

        if(prev_key != null) {
            if(key <= prev_key)
                throw new IllegalArgumentException("keys are not sorted: " + vals);
        }
        prev_key=key;

        if(prev_val != null) {
            if(val <= prev_val)
                throw new IllegalArgumentException("values are not sorted: " + vals);
        }
        prev_val=val;
        max_block_times.put(key, val);
    }
    if(log.isDebugEnabled())
        log.debug("max_block_times: " + max_block_times);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:35,代码来源:FlowControl.java

示例5: onMessage

import org.jgroups.util.Util; //导入方法依赖的package包/类
public void onMessage(Map<String, String> headers, byte[] buf, int offset, int length) {
    if(buf == null)
        return;
    String destination=headers.get("destination");
    if(destination != null && destination.equals(clients_dest)) {
        String new_client=headers.get("client-joined");
        if(new_client != null) {
            synchronized(clients) {
                if(clients.add(new_client)) {
                    num_clients=clients.size();
                    setTitle();
                }
            }

            stomp_client.send(clients_dest, null, 0, 0, "clients", getAllClients());
        }

        String left_client=headers.get("client-left");
        if(left_client != null) {
            synchronized(clients) {
                if(clients.remove(left_client)) {
                    num_clients=clients.size();
                    setTitle();
                }
            }
        }

        String all_clients=headers.get("clients");
        if(all_clients != null) {
            List<String> list=Util.parseCommaDelimitedStrings(all_clients);
            if(list != null) {
                synchronized(clients) {
                    if(clients.addAll(list)) {
                        num_clients=clients.size();
                        setTitle();
                    }
                }
            }
        }

        return;
    }

    try {
        DrawCommand comm=(DrawCommand)Util.streamableFromByteBuffer(DrawCommand.class, buf, offset, length);
        switch(comm.mode) {
            case DrawCommand.DRAW:
                if(panel != null)
                    panel.drawPoint(comm);
                break;
            case DrawCommand.CLEAR:
                clearPanel();
                break;
            default:
                System.err.println("***** received invalid draw command " + comm.mode);
                break;
        }
    }
    catch(Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:63,代码来源:StompDraw.java


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