On Mon, 20 Apr 2009 18:02:15 +1000, Brett Henderson <[email protected]>
wrote:
> [email protected] wrote:
>> Hello,
>>
>> I am trying to use the EntityBuffer -class but seem to be doing
something
>> wrong here.
>>
>> I did:
>>
>> XMReader task = new ...
>> EntityBuffer  buffer = new EntityBuffer(BUFFERCAPACITY);
>>
>> task.setSink(buffer);
>> buffer.setSink(sink);
>>
>> buffer.run();
>> task.run();
>>
>>
>> It seems that this hangs indefinately waiting for entities to
>> come in from the buffer.
>> Do I need to call some special method or use a special
>> manager-class to make the buffer start it's Executor or Thread?
>>   
> The key reason for using EntityBuffer is to separating processing into 
> multiple threads.  It is a key class implementing the --buffer task 
> whose main reason for existing is to spread the pipeline execution 
> across multiple threads and therefore CPU cores.
> 
> So, the reason you're having a problem is because the buffer.run() 
> method must be run in a separate thread to the task feeding data into 
> it.  The input thread calling the process method will block when the 
> buffer becomes full.  Likewise, the buffer.run thread will block until 
> data becomes available.  If you call both from the same thread the first 
> one will never complete.

Okay. I was not aware that the method putting these together had to
start the second thread. I'll look at ActiveTaskManager to plug these
tasks together then.

It was ment as an experiment if importing gets faster if I don't
have to block, waiting for the next entity to be read between 2
writes into my sink.

Thanks for the extensive answer. :)

Marcus

_______________________________________________
osmosis-dev mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/osmosis-dev

Reply via email to