Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 282580 - HttpConfiguration minThreads and maxThreads values require ConfigAdmin
Summary: HttpConfiguration minThreads and maxThreads values require ConfigAdmin
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Compendium (show other bugs)
Version: 3.5   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.6 M3   Edit
Assignee: Thomas Watson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-06 16:50 EDT by James Branigan CLA
Modified: 2015-07-27 09:27 EDT (History)
3 users (show)

See Also:


Attachments
Patch to add -D for thread pool size to HttpConfiguration (3.46 KB, patch)
2009-07-07 15:13 EDT, James Branigan CLA
tjwatson: iplog+
Details | Diff
updated patch (2.68 KB, patch)
2009-09-15 12:25 EDT, Thomas Watson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Branigan CLA 2009-07-06 16:50:41 EDT
Build ID: I20090430-2300

Steps To Reproduce:
If you look at the minThreads and maxThreads values in HttpConfiguration, you will notice that they are only read in the update method.  This is unfortunate, as it requires that ConfigurationAdmin be loaded in order to set the values.

It would be far better if these values could be set, like the port numbers, by using a -D option.  This would allow people to use the HttpService and control the pool size, without requiring them to bring in ConfigurationAdmin.
Comment 1 Simon Kaegi CLA 2009-07-07 09:33:09 EDT
Do you mean HttpServerManager?

A couple things...
1) The updated method is used when configuring via Config Admin, JettyConfigurator, or via system properties. We just use the same approach of sending in a dictionary to do the configuring.
2) minThreads/maxThreads is not one of the supported configuration parameters so in that case you need to use a JettyCustomizer and make it available in a fragment to allow you to do the er... customization you want.

Comment 2 James Branigan CLA 2009-07-07 09:49:45 EDT
We're just using the HttpService implementation out of org.eclipse.equinox.http.

There is no jetty code in our system at this time.

Right now my declarative service just specifies that it needs an HttpService instance.  One gets passed in, and I register my servlet.  I can use -D options to override the ports this way, but I can't make the thread pool size change.

We're on an embedded platform where space is very tight, so I'm not eager to add in config admin just to set these values.
Comment 3 Simon Kaegi CLA 2009-07-07 10:57:07 EDT
re: org.eclipse.equinox.http
Ah... naturally -- forgot what constraints you guys are up against.

If you want to work on a patch to configure via properties I think it sounds reasonable and we could definitely look at working with your patch and committing it.
Comment 4 Thomas Watson CLA 2009-07-07 14:02:58 EDT
I agree with Simon, if you have a patch we will be glad to work with you to get it into 3.6.  Moving to compendium where the http service impls live.
Comment 5 James Branigan CLA 2009-07-07 14:08:01 EDT
Ok, Before I get going on the patch, can we agree on what the -D options should be named.  I'd suggest...

org.osgi.service.http.minThreads and org.osgi.service.http.maxThreads
Comment 6 BJ Hargrave CLA 2009-07-07 14:17:30 EDT
(In reply to comment #5)
> Ok, Before I get going on the patch, can we agree on what the -D options should
> be named.  I'd suggest...
> 
> org.osgi.service.http.minThreads and org.osgi.service.http.maxThreads
> 

Those names look like they are OSGi standardized names which they are not.

Since these names apply to the Equinox implementation, they should start with equinox (or whatever the standard equinox property prefix is.)
Comment 7 James Branigan CLA 2009-07-07 14:21:33 EDT
I came up with those names by following the style of the other properties in the HttpConfiguration class that are already externalized through -D options.

	protected final static String enviroKeyHttpPort = "org.osgi.service.http.port"; //$NON-NLS-1$
	protected final static String enviroKeyHttpsPort = "org.osgi.service.http.port.secure"; //$NON-NLS-1$
	protected final static String enviroKeyHttpAddress = "org.eclipse.equinox.http.address"; //$NON-NLS-1$

Are these keys in the OSGi spec?

Can someone on the compendium team suggest the proper equinox prefix, if we don't use the osgi prefix?
Comment 8 Thomas Watson CLA 2009-07-07 14:27:44 EDT
BJ is correct.  Properties beginning with org.osgi.* are osgi spec'ed (org.osgi.service.http.port and org.osgi.service.http.port.secure are documented in the compendium specification).  You should use something similar to the http.address option which starts with org.eclipse.equinox:

org.eclipse.equinox.http.minThreads
org.eclipse.equinox.http.maxThreads
Comment 9 James Branigan CLA 2009-07-07 15:13:26 EDT
Created attachment 140993 [details]
Patch to add -D for thread pool size to HttpConfiguration

Here is my first pass at fixing the problem.  Please let me know if it needs further work.
Comment 10 Thomas Watson CLA 2009-07-08 09:29:31 EDT
Thanks James, I will take a look at the patch and target it for M1.
Comment 11 Thomas Watson CLA 2009-08-06 17:15:36 EDT
This missed M1.  I will look at this early in M2.
Comment 12 Thomas Watson CLA 2009-09-15 12:25:24 EDT
Created attachment 147220 [details]
updated patch

I had issues applying this patch to HEAD.  It appears that this patch is against some other repository.  Anyway I manually created a patch against our repository based on the original patch you provided.

The current implementation for min threads seems to limit the min threads to 5.  If I specify 2 then 5 threads still get created.  If I specify 8 then 8 threads get created.  Is that acceptable behavior for you?
Comment 13 Thomas Watson CLA 2009-09-15 12:27:12 EDT
Sorry, I WILL release this next week after M2.  Please open a separate defect if a minimum of 5 threads is not acceptable.
Comment 14 Thomas Watson CLA 2009-09-22 17:01:51 EDT
patch released for M3.
Comment 15 John Reysa CLA 2010-10-04 00:04:46 EDT
Thomas, I am using org.eclipse.equinox.http.jetty.
Is there a corresponding 
org.eclipse.equinox.http.jetty.maxThreads   and
org.eclipse.equinox.http.jetty.minThreads
I don't see it in the api.
I also tried setting -Djava.home to a directory
and put a jetty.xml file in ${java.home}/etc/ but 
that didn't seem to work either.  Any suggestions?
Also, what is the default min/maxthreads for 
org.eclipse.equinox.http.jetty?
Comment 16 Thomas Watson CLA 2015-07-27 09:27:32 EDT
(In reply to John Reysa from comment #15)
> Thomas, I am using org.eclipse.equinox.http.jetty.
> Is there a corresponding 
> org.eclipse.equinox.http.jetty.maxThreads   and
> org.eclipse.equinox.http.jetty.minThreads
> I don't see it in the api.
> I also tried setting -Djava.home to a directory
> and put a jetty.xml file in ${java.home}/etc/ but 
> that didn't seem to work either.  Any suggestions?
> Also, what is the default min/maxthreads for 
> org.eclipse.equinox.http.jetty?

Sorry for the unreasonable time it took to answer.  This bug was about the small embedded http service implementation Equinox used to maintain.  We no longer have this implementation and only maintain the http service that is backed by jetty.