cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: LoggingInInterceptor consuming time for big messages
Date Mon, 29 Feb 2016 16:25:09 GMT
Upgrade to a newer version of CXF.  You are obviously using an old version.  2 years ago, the
LoggingInInterceptor was updated to only read in up to the “limit” number of bytes instead
of the entire stream.

Dan



> On Feb 29, 2016, at 8:22 AM, rohandm <rohandm@gmail.com> wrote:
> 
> We are currently using LoggingInInterceptor/LoggingOutInterceptor to log soap
> messages in our application however these interceptors takes a significant
> amount of time especially on the IOUtils.copy(is, bos)  call. Is their any
> way to call this part of the code in a separate thread without having the
> InputStream closed on us or Are there any other alternatives to improve
> performance here?
> 
> 
> InputStream is = message.getContent(InputStream.class);
>        if (is != null) {
>            CachedOutputStream bos = new CachedOutputStream();
>            try {
>                IOUtils.copy(is, bos);
> 
>                bos.flush();
>                is.close();
> 
>                message.setContent(InputStream.class, bos.getInputStream());
>                if (bos.getTempFile() != null) {
>                    //large thing on disk...
>                    buffer.getMessage().append("\nMessage (saved to tmp
> file):\n");
>                    buffer.getMessage().append("Filename: " +
> bos.getTempFile().getAbsolutePath() + "\n");
>                }
>                if (bos.size() > limit) {
>                    buffer.getMessage().append("(message truncated to " +
> limit + " bytes)\n");
>                }
>                writePayload(buffer.getPayload(), bos, encoding, ct); 
> 
>                bos.close();
>            } catch (Exception e) {
>                throw new Fault(e);
>            }
>        }
>        log(buffer.toString());
> 
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/LoggingInInterceptor-consuming-time-for-big-messages-tp5766419.html
> Sent from the cxf-user mailing list archive at Nabble.com.

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Mime
View raw message