camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leandro Franchi <leandro.fran...@gmail.com>
Subject Re: File do ActiveMQ
Date Fri, 14 Dec 2012 18:33:52 GMT
Hi Christian,

You're right!

I was using Java Wrapper do start/stop the java program as a linux
service. Sometimes the wrapper starts two program instances, I don't
know why but on this time that error occurs because one instance read
and delete the file at the same time the another instance are reading
the file.

I'll have to understand why I've 2 instances running, and how to
prevent this situation.

Thanks so much Christian!


I hope the best
Leandro Franchi

On 12/11/12, Christian Müller <christian.mueller@gmail.com> wrote:
> I think I found the issue:
>
> org.apache.camel.component.file.GenericFileConverter:
>
> 88   Reader reader = genericFileToReader(file, exchange);
> 89   // we dont want a reader back, so use the type converter registry to
> find a suitable converter
> 90   TypeConverter readerTc = registry.lookup(type, Reader.class);
> 91   if (readerTc != null) {
> 92       // use the reader based type converter
> 93       return readerTc.convertTo(type, exchange, reader);
> 94   }
>
> If you have a look into the "genericFileToReader()" method you can see that
> it returns null, if the file doesn't exist. In this case, in line 93 the
> type converter (IOConverter in this case) is called which will fail
>
> IOConverter:
> 259    @Converter
> 260    public static byte[] toByteArray(Reader reader, Exchange exchange)
> throws IOException {
> 261        return toByteArray(IOHelper.buffered(reader), exchange);
> 262    }
>
> IOHelper
> 116    public static BufferedReader buffered(Reader reader) {
> 117        ObjectHelper.notNull(reader, "reader");
> 118        return (reader instanceof BufferedReader) ?
> (BufferedReader)reader : new BufferedReader(reader);
> 119    }
>
> Is it possible the file doesn't exist anymore if Camel tries to read it?
>
> Best,
> Christian
>
> On Wed, Nov 7, 2012 at 11:15 AM, Leandro Franchi
> <leandro.franchi@gmail.com>wrote:
>
>> switchFileFrontendCounterProce**ssor
>>
>


-- 
*Leandro Franchi*
http://www.frango10.com

Mime
View raw message