Hi Georg,

On 11.03.19 10:28, Georg Kallidis wrote:
> It started like this, that I thought it might be better to use a stream's 
> method tryAdvance in TurbinePipeline.invokeNext (to begin with setting 
> instead of valves.iterator valves.stream in TP.invoke call to state.set) - 
> but this resulted into a endless loop/stackoverflow. After this using bulk 
> stream/foreach would make ValveContext's invokeNext useless (or better it 
> have to be removed ). 

I understand that the invokeNext method exists to give valves a way of
stopping execution if they see fit. It is of not much use otherwise.

Another question was: Is ThreadLocal of use here
> really? The mechanism of using a ThreadLocal<Iterator<Valve>> might be 
> quite robust, although a valves stream seemed better. Could we not use a 
> stream instead of CopyOnWriteArrayList for valves? But if valves are 
> thread safe, do we need ThreadLocal at all?

The iterator keeps the state of a single request, so keeping it
thread-local is essential. I moved from synchronized methods to
CopyOnWriteArrayList to achieve a lock-free operation. This made
parallel execution about 30% faster.

If you make any changes, be sure to compare performance with
org.apache.turbine.pipeline.PipelineTest.testPipelinePerformance()

> Is it worth the effort?

I don't think so.

Bye, Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to