users@glassfish.java.net

Re: How to manage threads that process web service requests?

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Thu, 29 Nov 2007 14:33:04 -0500

Hi,

glassfish_at_javadesktop.org wrote:
> Hi,
>
> I want to have some controle about the threads that are used to process the request for a certian web service that runs in glassfish E.g. I like to controle the number of threads that are used for a certian service.
>
> So how can I do this?

By default, you cannot isolate application using thread pool. But you
can enable the following mechanism:

http://weblogs.java.net/blog/jfarcand/archive/2007/06/improving_ajax_1.html

You can probably apply the same trick for JAXWS.

>
> When usinig a JAXWS service in JDK 6 I can configure the endpoint with an instance of Executor wich gives me controle over the thread pool for this service. I've seen a thread pool configuration option in the admin console but I can't find out how to associate a web service with a thread pool. Is it possible to define my own thread pool implementation?
>

In Grizzly, you can switch the thread pool easily by wrapping an
Executor with the following interface:

https://glassfish.dev.java.net/source/browse/glassfish/appserv-http-engine/src/java/com/sun/enterprise/web/connector/grizzly/Pipeline.java?rev=1.11&view=markup

An example of such implementation can be found here:

https://glassfish.dev.java.net/source/browse/glassfish/appserv-http-engine/src/java/com/sun/enterprise/web/connector/grizzly/ThreadPoolExecutorPipeline.java?rev=1.12&view=markup

Once you have your own Pipeline implementation, you can enable it by doing:

% jar your implementation into a jar (ex: myThreadPool.jar)
% copy the jar under ${glassfish.home}/lib
% add, in domain.xml:


<jvm-options>-Dcom.sun.enterprise.web.connector.grizzly.pipelineClass=name
of your class (like com.sun.grizzly.MyPipeline)
</jvm-options>

% Re-start Glassfish.

Let me know if that's not what you want :-)

Thanks

-- Jeanfrancois


> thanks in advance
> [Message sent by forum member 'wierob' (wierob)]
>
> http://forums.java.net/jive/thread.jspa?messageID=247868
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>