You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by ML...@wawanesa.com on 2010/04/27 22:05:06 UTC

LogHandler not threadsafe


Hello,
I wrote my own handler (extends BasicHandler) that is used to log web
service requests and responses to a database.

I modelled it after the  org.apache.axis.handlers.LogHandler class, which
comes with axis (source here:
http://kickjava.com/src/org/apache/axis/handlers/LogHandler.java.htm ).

Because that class uses instance variables (e.g. startTime to be able to
write elapsed time to log), I assumed that a new instance of each handler
is created for each web service call, so the Handler itself did not need to
be threadsafe. But I am seeing some strange behaviour that could be caused
by concurrent access to the same Handler instance (e.g. requests and
responses not matching up, etc.)

Can someone tell me if my Handler implementation needs to be made
threadsafe (if so we should probably file a bug against LogHandler)?  Note
I would probably correct my code by carefully utilizing ThreadLocal
variables.

Thanks
michael lucas  |  Java/WebSphere/Portal Specialist

"Say not in grief that she is no more, but say in thankfulness that she
was. A death is not the extinguishing of a light, but the putting out of
the lamp because the dawn has come." - Rabindranath Tagore

Re: LogHandler not threadsafe

Posted by Andreas Veithen <an...@gmail.com>.
As part of the promotion of the Axis project to a top level project,
we have decided to create separate mailing lists for Axis 1 and Axis2.
For all Axis 1 related questions please subscribe and post to
axis1-java-user@axis.apache.org. Thanks!

Andreas


On Tue, Apr 27, 2010 at 22:05,  <ML...@wawanesa.com> wrote:
> Hello,
> I wrote my own handler (extends BasicHandler) that is used to log web
> service requests and responses to a database.
>
> I modelled it after the org.apache.axis.handlers.LogHandler class, which
> comes with axis (source here:
> http://kickjava.com/src/org/apache/axis/handlers/LogHandler.java.htm ).
>
> Because that class uses instance variables (e.g. startTime to be able to
> write elapsed time to log), I assumed that a new instance of each handler is
> created for each web service call, so the Handler itself did not need to be
> threadsafe. But I am seeing some strange behaviour that could be caused by
> concurrent access to the same Handler instance (e.g. requests and responses
> not matching up, etc.)
>
> Can someone tell me if my Handler implementation needs to be made threadsafe
> (if so we should probably file a bug against LogHandler)? Note I would
> probably correct my code by carefully utilizing ThreadLocal variables.
>
> Thanks
> michael lucas | Java/WebSphere/Portal Specialist
>
> "Say not in grief that she is no more, but say in thankfulness that she was.
> A death is not the extinguishing of a light, but the putting out of the lamp
> because the dawn has come." - Rabindranath Tagore

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org