[jboss-dev-forums] [Design of JBoss Serialization] - Re: Does JBossSerialization improves performance for Entrnai

kumar_iitm do-not-reply at jboss.com
Thu Feb 15 14:38:42 EST 2007


As the DataOutputStream also writes the primitives by converting them into bytes and writing the bytes into stream, we thought of converting them ahead and writing the byteArray.

we use some thing like this

public byte[] convertInt(int value) {
        return new byte[]{
                (byte) (value >>> 24), (byte) (value >>> 16), (byte) (value >>> 8), (byte) (value >>> 0),
                (byte) 0, (byte) 0, (byte) 0, (byte) 0};
    }

and this byte[] we write into the stream in writeExternal() method. 

 public void writeExternal(final ObjectOutput out) throws IOException {
        out.writeInt(this.aData.length);
        out.write(this.aData);
 }



This Externalizable object is a subclass of another parent object and we serialize that parent object like this.

PartenObject po = new ParentObject();
....setters
...


ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);

objectOutpuStream.writeObject(po);

But we see much overhead when we call this writeObject() method.

So are there any optimizations in Jboss Serialization in this redard..





View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017188#4017188

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017188



More information about the jboss-dev-forums mailing list