On 07.09.11 14:25, Georg Kallidis wrote:
> I changed the instance settings to
> 
>           private OutputStreamWriter getWriter() {
>                       return (OutputStreamWriter) threadLocal.get();
>               }
> 
>           private void setWriter(OutputStreamWriter writer) {
>                       threadLocal.set(writer);
>               }
> 
>               private static ThreadLocal<OutputStreamWriter> threadLocal =
> new ThreadLocal<OutputStreamWriter>();
> 
> and the method
> 
>           public void handleRequest(Context context, String filename,
>                                     OutputStream output)
>                   throws TurbineException
>           {
>               String charset  = getCharSet(context);
> 
>               try
>               {
>                       if (getWriter() == null)
>                               setWriter(new OutputStreamWriter(output,
> charset));
> 
>                   executeRequest(context, filename, getWriter());
>               }
>               catch (Exception e)
>               {
>                   renderingError(filename, e);
>               }
>               finally
>               {
>                   try
>                   {
>                       if (getWriter() != null)
>                       {
>                               getWriter().flush();
>                         setWriter(null);
> 
>                       }
>                   }
>                   catch (Exception ignored)
>                   {
>                       // do nothing.
>                   }
>               }
>           }
> 
> and this should solve the concurrency issue.

Would you please open a JIRA ticket and attach the patch? You need to
check the CLA checkbox to submit this formally.

Bye, Thomas.


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

Reply via email to