In order to allow compression to work with EJB 2.x invocations I created my own 
Compression marshaller and unmarshaller which descend from original classes. 

The default constructor for both classes now call the constructor that takes 
one parameter of type Marshaller/UnMarshaller with new 
InvocationMarshaller()/InvocationUnMarshaller().

I also did new versions of read/write methods which I use to test different 
variants for calling GZip streams.

>From my experiments I can tell that switching 

 oos.flush(); and gzos.finish();

does not help. 

I'm still getting exceptions for incorrect version in the stream. But I also 
found a solution which is in the code below.

In order to workaround the other problem with OutOfMemory exception I created 
new GZip input/output stream classes that descend from the original Java 
classes.

in my Output stream I added new finish method

 public void finish() throws IOException
  |         {
  |             super.finish();
  |             def.end(); // This will release all resources used by zlib 
  |         }
  |     }

in the input stream I added new method

         public void end() throws IOException
  |         {
  |             while (available() > 0) { // This tell the gzip input stream to 
read the extra trailer put by finish method in output stream. This all removes 
the need to use buffered stream like in 2.x branch
  |                 read();
  |             }
  |             inf.end();
  |         }
  | 

and I call this new method at the end of read method.

this way I can use original java GZip classes without having to relay on 
external libraries.

- inf and def are protected fields in Java 1.5 and 1.6

If you want I can provide you with full source code so you can use it to create 
the necessary updates in 2.x and 2.2 branches.

Doychin

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4199342
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to