Package org.jgroups

Examples of org.jgroups.Header


    }


    public static void testPutHeaderIfAbsent() {
        Headers hdrs=createHeaders(3);
        Header hdr=hdrs.putHeaderIfAbsent(FRAG_ID, new MyHeader());
        assert hdr == h2;
        assert hdr == hdrs.getHeader(FRAG_ID);
        assert hdrs.size() == 3;
        assert hdrs.capacity() == 3;
View Full Code Here


                ids[i]=id;
                hdrs[i]=hdr;
                return null;
            }
            if(ids[i] == id) {
                Header retval=hdrs[i];
                if(replace_if_present) {
                    hdrs[i]=hdr;
                }
                return retval;
            }
View Full Code Here

  public void test() throws Exception {

    logger.info("'org.jgroups.Header' test");
   
    byte b = 2;
    Header header = new FcHeader(b);
    logger.info(header)
  }
View Full Code Here

    public void destroy() {
    }


    public Object up(Event evt) {
        Header  h;
        Message msg;
        int     type;

        if(evt.getType() == Event.MSG) {
            msg=(Message)evt.getArg();
View Full Code Here

    private static String print(Message msg, Map<String, Header> hdrs) {
        StringBuilder sb=new StringBuilder();
        int hdrs_size=0;
        for(Map.Entry<String,Header> entry: hdrs.entrySet()) {
            String name=entry.getKey();
            Header hdr=entry.getValue();
            int size=hdr.size();
            hdrs_size+=size;
            sb.append(name).append(": ").append(" ").append(size).append(" bytes\n");
        }
        sb.append("headers=").append(hdrs_size).append(", total msg size=").append(msg.size());
        sb.append(", msg payload=").append(msg.getLength()).append("\n");
View Full Code Here

                ids[i]=id;
                hdrs[i]=hdr;
                return null;
            }
            if(ids[i] == id) {
                Header retval=hdrs[i];
                if(replace_if_present || retval == null) {
                    hdrs[i]=hdr;
                }
                return retval;
            }
View Full Code Here

        StringBuilder sb=new StringBuilder();
        int hdrs_size=0;
        for(Map.Entry<Short,Header> entry: hdrs.entrySet()) {
            Class clazz=ClassConfigurator.getProtocol(entry.getKey());
            String name=clazz != null? clazz.getSimpleName() : null;
            Header hdr=entry.getValue();
            int size=hdr.size();
            hdrs_size+=size;
            sb.append(name).append(": ").append(" ").append(size).append(" bytes\n");
        }
        sb.append("headers=").append(hdrs_size).append(", total msg size=").append(msg.size());
        sb.append(", msg payload=").append(msg.getLength()).append("\n");
View Full Code Here

    protected static GMS.GmsHeader getGMSHeader(Event evt){
        return evt.getType() == Event.MSG? getGMSHeader((Message)evt.getArg()) : null;
    }

    protected static GMS.GmsHeader getGMSHeader(Message msg){
        Header hdr = msg.getHeader(gms_id);
        if(hdr instanceof GMS.GmsHeader)
            return (GMS.GmsHeader)hdr;
        return null;
    }
View Full Code Here

    public void destroy() {
    }


    public Object up(Event evt) {
        Header  h;
        Message msg;
        int     type;

        if(evt.getType() == Event.MSG) {
            msg=(Message)evt.getArg();
View Full Code Here

                data[i]=key;
                data[i+1]=hdr;
                return null;
            }
            if(data[i].equals(key)) {
                Header retval=(Header)data[i+1];
                if(replace_if_present) {
                    data[i+1]=hdr;
                }
                return retval;
            }
View Full Code Here

TOP

Related Classes of org.jgroups.Header

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.