Author: remy.maucherat(a)jboss.com
Date: 2008-11-24 08:34:13 -0500 (Mon, 24 Nov 2008)
New Revision: 861
Modified:
trunk/PATCHES.txt
trunk/java/javax/el/CompositeELResolver.java
trunk/java/org/apache/catalina/core/StandardThreadExecutor.java
trunk/webapps/docs/changelog.xml
Log:
- Port two patches.
- Add dynamic config for the default executor.
Modified: trunk/PATCHES.txt
===================================================================
--- trunk/PATCHES.txt 2008-11-20 18:37:18 UTC (rev 860)
+++ trunk/PATCHES.txt 2008-11-24 13:34:13 UTC (rev 861)
@@ -18,3 +18,7 @@
711711, 711714, 711716, 711720:
Useless session access time refactoring
+
+719602
+Dynamic change for maxThreads in the bare bones thread pool, which go against its
simplicity goal
+(an executor should be used instead)
Modified: trunk/java/javax/el/CompositeELResolver.java
===================================================================
--- trunk/java/javax/el/CompositeELResolver.java 2008-11-20 18:37:18 UTC (rev 860)
+++ trunk/java/javax/el/CompositeELResolver.java 2008-11-24 13:34:13 UTC (rev 861)
@@ -19,158 +19,169 @@
import java.beans.FeatureDescriptor;
import java.util.Iterator;
+import java.util.NoSuchElementException;
public class CompositeELResolver extends ELResolver {
- private int size;
+ private int size;
- private ELResolver[] resolvers;
+ private ELResolver[] resolvers;
- public CompositeELResolver() {
- this.size = 0;
- this.resolvers = new ELResolver[2];
- }
+ public CompositeELResolver() {
+ this.size = 0;
+ this.resolvers = new ELResolver[2];
+ }
- public void add(ELResolver elResolver) {
- if (elResolver == null) {
- throw new NullPointerException();
- }
+ public void add(ELResolver elResolver) {
+ if (elResolver == null) {
+ throw new NullPointerException();
+ }
- if (this.size >= this.resolvers.length) {
- ELResolver[] nr = new ELResolver[this.size * 2];
- System.arraycopy(this.resolvers, 0, nr, 0, this.size);
- this.resolvers = nr;
- }
- this.resolvers[this.size++] = elResolver;
- }
+ if (this.size >= this.resolvers.length) {
+ ELResolver[] nr = new ELResolver[this.size * 2];
+ System.arraycopy(this.resolvers, 0, nr, 0, this.size);
+ this.resolvers = nr;
+ }
+ this.resolvers[this.size++] = elResolver;
+ }
- public Object getValue(ELContext context, Object base, Object property)
- throws NullPointerException, PropertyNotFoundException, ELException {
- context.setPropertyResolved(false);
- int sz = this.size;
- Object result = null;
- for (int i = 0; i < sz; i++) {
- result = this.resolvers[i].getValue(context, base, property);
- if (context.isPropertyResolved()) {
- return result;
- }
- }
- return null;
- }
+ public Object getValue(ELContext context, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException {
+ context.setPropertyResolved(false);
+ int sz = this.size;
+ Object result = null;
+ for (int i = 0; i < sz; i++) {
+ result = this.resolvers[i].getValue(context, base, property);
+ if (context.isPropertyResolved()) {
+ return result;
+ }
+ }
+ return null;
+ }
- public void setValue(ELContext context, Object base, Object property,
- Object value) throws NullPointerException,
- PropertyNotFoundException, PropertyNotWritableException,
- ELException {
- context.setPropertyResolved(false);
- int sz = this.size;
- for (int i = 0; i < sz; i++) {
- this.resolvers[i].setValue(context, base, property, value);
- if (context.isPropertyResolved()) {
- return;
- }
- }
- }
+ public void setValue(ELContext context, Object base, Object property,
+ Object value) throws NullPointerException,
+ PropertyNotFoundException, PropertyNotWritableException,
+ ELException {
+ context.setPropertyResolved(false);
+ int sz = this.size;
+ for (int i = 0; i < sz; i++) {
+ this.resolvers[i].setValue(context, base, property, value);
+ if (context.isPropertyResolved()) {
+ return;
+ }
+ }
+ }
- public boolean isReadOnly(ELContext context, Object base, Object property)
- throws NullPointerException, PropertyNotFoundException, ELException {
- context.setPropertyResolved(false);
- int sz = this.size;
- boolean readOnly = false;
- for (int i = 0; i < sz; i++) {
- readOnly = this.resolvers[i].isReadOnly(context, base, property);
- if (context.isPropertyResolved()) {
- return readOnly;
- }
- }
- return false;
- }
+ public boolean isReadOnly(ELContext context, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException {
+ context.setPropertyResolved(false);
+ int sz = this.size;
+ boolean readOnly = false;
+ for (int i = 0; i < sz; i++) {
+ readOnly = this.resolvers[i].isReadOnly(context, base, property);
+ if (context.isPropertyResolved()) {
+ return readOnly;
+ }
+ }
+ return false;
+ }
- public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object
base) {
- return new FeatureIterator(context, base, this.resolvers, this.size);
- }
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context,
Object base) {
+ return new FeatureIterator(context, base, this.resolvers, this.size);
+ }
- public Class<?> getCommonPropertyType(ELContext context, Object base) {
- int sz = this.size;
- Class<?> commonType = null, type = null;
- for (int i = 0; i < sz; i++) {
- type = this.resolvers[i].getCommonPropertyType(context, base);
- if (type != null
- && (commonType == null || commonType.isAssignableFrom(type))) {
- commonType = type;
- }
- }
- return commonType;
- }
+ public Class<?> getCommonPropertyType(ELContext context, Object base) {
+ int sz = this.size;
+ Class<?> commonType = null, type = null;
+ for (int i = 0; i < sz; i++) {
+ type = this.resolvers[i].getCommonPropertyType(context, base);
+ if (type != null
+ && (commonType == null || commonType.isAssignableFrom(type)))
{
+ commonType = type;
+ }
+ }
+ return commonType;
+ }
- public Class<?> getType(ELContext context, Object base, Object property)
- throws NullPointerException, PropertyNotFoundException, ELException {
- context.setPropertyResolved(false);
- int sz = this.size;
- Class<?> type;
- for (int i = 0; i < sz; i++) {
- type = this.resolvers[i].getType(context, base, property);
- if (context.isPropertyResolved()) {
- return type;
- }
- }
- return null;
- }
+ public Class<?> getType(ELContext context, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException {
+ context.setPropertyResolved(false);
+ int sz = this.size;
+ Class<?> type;
+ for (int i = 0; i < sz; i++) {
+ type = this.resolvers[i].getType(context, base, property);
+ if (context.isPropertyResolved()) {
+ return type;
+ }
+ }
+ return null;
+ }
- private final static class FeatureIterator implements Iterator<FeatureDescriptor>
{
+ private final static class FeatureIterator implements
Iterator<FeatureDescriptor> {
- private final ELContext context;
+ private final ELContext context;
- private final Object base;
+ private final Object base;
- private final ELResolver[] resolvers;
+ private final ELResolver[] resolvers;
- private final int size;
+ private final int size;
- private Iterator itr;
+ private Iterator<FeatureDescriptor> itr;
- private int idx;
+ private int idx;
- public FeatureIterator(ELContext context, Object base,
- ELResolver[] resolvers, int size) {
- this.context = context;
- this.base = base;
- this.resolvers = resolvers;
- this.size = size;
+ private FeatureDescriptor next;
- this.idx = 0;
- this.guaranteeIterator();
- }
-
- private void guaranteeIterator() {
- while (this.itr == null && this.idx < this.size) {
- this.itr = this.resolvers[this.idx].getFeatureDescriptors(
- this.context, this.base);
- this.idx++;
- }
- }
+ public FeatureIterator(ELContext context, Object base,
+ ELResolver[] resolvers, int size) {
+ this.context = context;
+ this.base = base;
+ this.resolvers = resolvers;
+ this.size = size;
- public boolean hasNext() {
- return this.itr != null;
- }
+ this.idx = 0;
+ this.guaranteeIterator();
+ }
+
+ private void guaranteeIterator() {
+ while (this.itr == null && this.idx < this.size) {
+ this.itr = this.resolvers[this.idx].getFeatureDescriptors(
+ this.context, this.base);
+ this.idx++;
+ }
+ }
- public FeatureDescriptor next() {
- Object result = null;
- if (this.itr != null) {
- if (this.itr.hasNext()) {
- result = this.itr.next();
- if (!this.itr.hasNext()) {
- this.itr = null;
- this.guaranteeIterator();
- }
- }
- }
- return (FeatureDescriptor) result;
- }
+ public boolean hasNext() {
+ if (this.next != null)
+ return true;
+ if (this.itr != null){
+ while (this.next == null && itr.hasNext()) {
+ this.next = itr.next();
+ }
+ } else {
+ return false;
+ }
+ if (this.next == null) {
+ this.itr = null;
+ this.guaranteeIterator();
+ }
+ return hasNext();
+ }
- public void remove() {
- throw new UnsupportedOperationException();
- }
- }
+ public FeatureDescriptor next() {
+ if (!hasNext())
+ throw new NoSuchElementException();
+ FeatureDescriptor next = this.next;
+ this.next = null;
+ return next;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ }
+
}
Modified: trunk/java/org/apache/catalina/core/StandardThreadExecutor.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardThreadExecutor.java 2008-11-20 18:37:18
UTC (rev 860)
+++ trunk/java/org/apache/catalina/core/StandardThreadExecutor.java 2008-11-24 13:34:13
UTC (rev 861)
@@ -130,14 +130,23 @@
public void setMaxIdleTime(int maxIdleTime) {
this.maxIdleTime = maxIdleTime;
+ if (executor != null) {
+ executor.setKeepAliveTime(maxIdleTime, TimeUnit.MILLISECONDS);
+ }
}
public void setMaxThreads(int maxThreads) {
this.maxThreads = maxThreads;
+ if (executor != null) {
+ executor.setMaximumPoolSize(maxThreads);
+ }
}
public void setMinSpareThreads(int minSpareThreads) {
this.minSpareThreads = minSpareThreads;
+ if (executor != null) {
+ executor.setCorePoolSize(minSpareThreads);
+ }
}
public void setName(String name) {
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2008-11-20 18:37:18 UTC (rev 860)
+++ trunk/webapps/docs/changelog.xml 2008-11-24 13:34:13 UTC (rev 861)
@@ -42,6 +42,12 @@
<fix>
Create configBase also when dealing with directory deployment. (markt)
</fix>
+ <fix>
+ Pass attribute changes to the executor to allow dynamic configuration. (markt)
+ </fix>
+ <fix>
+ <bug>42077</bug>: In javax.el iterators, don't return null
elements. Based on a patch by Mathias Broekelmann. (markt)
+ </fix>
</changelog>
</subsection>
</section>