On Wed, 2008-03-12 at 21:22 -0300, Arlindo Luis Marcon Junior wrote:
> Hi All...
>
> Doubt:
> Is possible to have a "new Thread" inside one service deployed in Axis2?
> Example: I have a Web Service which attend many clientes,,, with
> scope="request"...
> In other words,,, many instances of the same service,,, one instance for
> each cliente...
> And I need "one" ( only one ) Thread ( or something like this ) to
> perform some tasks for me ( like monitoring my environment )...
Yes, certainly it is.
>
> Question:
> Is possible do it?
> If Yes, where/how I could start, and stop, this Thread?
The easy way would be to statically initialize this thread, and make it
loop around a statically initialized thread-safe queue. Check out the
singleton design pattern, and the java.util.concurrency package.
> Or has other "elegant" manner to do it?
What there is kind of all there is, unless you bootstrap the servlet
container yourself -- which is not suggested.
Cheers,
Scott S. McCoy