users@glassfish.java.net

Re: ExecutorService in Glassfish ?

From: Sivakumar Thyagarajan <Sivakumar.Thyagarajan_at_Sun.COM>
Date: Mon, 23 Nov 2009 10:15:11 +0530

Hi

Felipe Gaścho wrote:
> I have this application that should notify several external services
> (twitter, etc..) .. and I am thinking of using Future tasks for that..
>
> what means:
>
> myCode() {
> // do business here
> // push future threads in a pool
> // respond to the client while the future tasks run out there...
> }
>
> I don't care about the results of the future tasks, if a notification
> to twitter fails for example it doesn't matter for my business....
>
> So, I was wondering if Glassfish gives me such a thread pool ..

You could consider using Connectors WorkManager. See the discussion at
Work Management Contract at
http://java.sun.com/javaee/5/docs/tutorial/doc/bnckb.html

The WorkManager does not give a rich interface such as Future but is
backed by a Thread pool. You would then write a simple resource adapter
, use a Work instance to send your notifications and submit such Work
instances to the WorkManager for execution.

Thanks
--Siva.

> (instead of my application to create it all the time....)
>
> ------------------------------------------
> Felipe Gaścho
> 10+ Java Programmer
> CEJUG Senior Adviser
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>