All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jgroups.tests.bla3 Maven / Gradle / Ivy

Go to download

This artifact provides a single jar that contains all classes required to use remote Jakarta Enterprise Beans and Jakarta Messaging, including all dependencies. It is intended for use by those not using maven, maven users should just import the Jakarta Enterprise Beans and Jakarta Messaging BOM's instead (shaded JAR's cause lots of problems with maven, as it is very easy to inadvertently end up with different versions on classes on the class path).

There is a newer version: 35.0.0.Beta1
Show newest version
package org.jgroups.tests;

/**
 * @author Bela Ban
 * @since x.y
 */
public class bla3 {
 /*   protected static final MessageFactory msg_factory=new DefaultMessageFactory();
    protected static final int            FRAG_SIZE=500;


    public static void main(String[] args) throws Exception {
        byte[] array=new byte[1200];
        for(int i=0,num=0; i < array.length/4; i+=4,num++)
            Bits.writeInt(num, array, i);

        Message original_msg=new BytesMessage(null, array, 0, array.length);

        int serialized_size=original_msg.size();
        ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(serialized_size);
        List fragments=Util.computeFragOffsets(0, serialized_size, FRAG_SIZE);
        for(Range r: fragments) {
            Message frag=new FragmentedMessage(original_msg, (int)r.low, (int)r.high);
            frag.writeTo(out);
        }

        ByteArrayDataInputStream in=new ByteArrayDataInputStream(out.buffer(), 0, out.position());
        Message[] msgs=new FragmentedMessage[fragments.size()];
        for(int i=0; i < msgs.length; i++) {
            FragmentedMessage m=new FragmentedMessage();
            m.readFrom(in);
            msgs[i]=m;
        }

        InputStream seq=new SequenceInputStream(Util.enumerate(msgs, 0, msgs.length,
                                                               m -> new ByteArrayDataInputStream(m.getArray(),
                                                                                                 m.getOffset(),
                                                                                                 m.getLength())));
        DataInput input=new DataInputStream(seq);
        Message new_msg=msg_factory.create(original_msg.getType());
        new_msg.readFrom(input);
        assert original_msg.getLength() == new_msg.getLength();

        byte[] arr=new_msg.getArray();
        for(int i=0; i < arr.length/4; i+=4) {
            int val=Bits.readInt(arr, i);
            System.out.printf("val=%d\n", val);
        }
    }*/

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy