[jboss-dev-forums] [Design of JBoss Remoting, Unified Invokers] - Re: Encryption in Remoting

clebert.suconic@jboss.com do-not-reply at jboss.com
Tue Aug 15 11:30:47 EDT 2006


I just think you shouldn't be calling .close in your streamings at all:

Can't you just do:


public void write(Object dataObject, OutputStream output) throws IOException
  |    { 
  |       if(cipher == null)
  |          throw new IllegalStateException("Cipher is null for algo="+ this.cipherAlgorithm);
  |       output.flush();  
  |        
  |       CipherOutputStream cos = new CipherOutputStream(output, cipher);
  |        
  |       SerializationManager sm = SerializationStreamFactory.getManagerInstance(getSerializationType()
  | );
  |       ObjectOutputStream oos = sm.createOutput(cos);
  |       
  |       if(wrappedMarshaller != null)
  |       { 
  |          wrappedMarshaller.write(dataObject, oos);
  |       }
  |       else
  |       {
  |          super.write(dataObject, oos);
  |       } 
  |       oos.flush(); 
  |       // cos.close();  pp remove this and let GC take care of these instances
  |       // oos.close(); //There is a need to close cos
  |    }
  | 	

Take a look on the other marshallers... they always keep the streaming opened and only use flush();



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

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



More information about the jboss-dev-forums mailing list