On Mon, Aug 23, 2010 at 4:27 PM, Ronald Klop <ronald-mailingl...@base.nl> wrote:
> class OtherAppNotifier implements Runnable {
>  public void run() {
>      ... doe something...
>  }
> }
>
> In your servlet:
>
> doGet() {
>   processUserRequest();
>   new Thread(new OtherAppNotifier()).start();
> }
>

Thats my point I thought new Thread() was something I couldn't do (by JEE specs)

> You can also use java.util.TimerTask or some other threadpool thing if this
> spawns too many threads. But try the simple case first to make it working
> before optimizing it.

Yeah I've quite a few timerTasks running.

> Ronald.
>
> Op maandag, 23 augustus 2010 16:11 schreef Wesley Acheson
> <wesley.ache...@gmail.com>:
>>
>>  Hi,
>>
>> As far as I'm aware your not supposed to extend Thread in JEE. I've
>> seen similar questions on Stack Overflow where it was suggested you
>> may use your containers Thread pool. This sounds like a terrible idea
>> for portability.
>>
>> So take the following example.
>>
>> 1 A request for something specific is made to tomcat. That specific
>> request needs to two actions.
>> 2 Process the users request.
>> 3 Notify another application over http
>>
>> Now If the notification fails in step 3 the users request still needs
>> to process and not to error so we would like to send the notification
>> as a background task.  This is pretty easy with Threads but we
>> shouldn't extend Thread according to the specifications.
>>
>> Questions:
>> 1 Should this be delegated to the container?
>> 2 If it should be delegated to the container how would I/we achieve
>> this in tomcat 6.
>> 3 If it shouldn't be delegated to the container where should I ask how
>> to achieve a background task, because it isn't a tomcat question.
>> (Disclaimer: If you really want to give me the answer I won't mind :P
>> )
>>
>> Regards,
>>
>> Wesley
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
>>
>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to