diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/SelectorManager.java b/jetty-io/src/main/java/org/eclipse/jetty/io/SelectorManager.java index 8d7df5d232f..beab3976376 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/SelectorManager.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/SelectorManager.java @@ -34,7 +34,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.eclipse.jetty.util.Name; +import org.eclipse.jetty.util.annotation.Name; import org.eclipse.jetty.util.TypeUtil; import org.eclipse.jetty.util.component.AbstractLifeCycle; import org.eclipse.jetty.util.component.AggregateLifeCycle; @@ -61,7 +61,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa this((Runtime.getRuntime().availableProcessors() + 1) / 2); } - protected SelectorManager(@Name("selectors") int selectors) + protected SelectorManager(@Name(value="selectors") int selectors) { _selectors = new ManagedSelector[selectors]; setIdleCheckPeriod(1000); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java index 7bb876ee548..dd6065fcc44 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java @@ -20,7 +20,7 @@ import java.util.concurrent.Executor; import org.eclipse.jetty.io.AsyncConnection; import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.StandardByteBufferPool; -import org.eclipse.jetty.util.Name; +import org.eclipse.jetty.util.annotation.Name; import org.eclipse.jetty.util.component.AggregateLifeCycle; import org.eclipse.jetty.util.component.Dumpable; import org.eclipse.jetty.util.log.Log; @@ -73,7 +73,7 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Co /* ------------------------------------------------------------ */ /** */ - public AbstractConnector(@Name("acceptors") int acceptors) + public AbstractConnector(@Name(value="acceptors") int acceptors) { if (acceptors > 2 * Runtime.getRuntime().availableProcessors()) LOG.warn("Acceptors should be <=2*availableProcessors: " + this); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java index 1776684f00d..d5aa890f078 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java @@ -69,6 +69,7 @@ import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.TypeUtil; import org.eclipse.jetty.util.URIUtil; import org.eclipse.jetty.util.annotation.Managed; +import org.eclipse.jetty.util.annotation.Name; import org.eclipse.jetty.util.component.AggregateLifeCycle; import org.eclipse.jetty.util.component.Dumpable; import org.eclipse.jetty.util.log.Log; @@ -1204,7 +1205,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server. * @see javax.servlet.ServletContext#removeAttribute(java.lang.String) */ @Managed("Remove context attribute") - public void removeAttribute( @Managed("attribute name") String name) + public void removeAttribute( @Name(value = "name", description="attribute name") String name) { checkManagedAttribute(name,null); _attributes.removeAttribute(name); @@ -1218,7 +1219,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server. * @see javax.servlet.ServletContext#setAttribute(java.lang.String, java.lang.Object) */ @Managed("Set context attribute") - public void setAttribute(@Managed("attribute name") String name, @Managed("attribute value") Object value) + public void setAttribute(@Name(value = "name", description="attribute name") String name, @Name(value = "value", description="attribute value") Object value) { checkManagedAttribute(name,value); _attributes.setAttribute(name,value); diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/Name.java b/jetty-util/src/main/java/org/eclipse/jetty/util/Name.java deleted file mode 100644 index 0d67ddbee7f..00000000000 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/Name.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.eclipse.jetty.util; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(ElementType.PARAMETER) -@Retention(RetentionPolicy.RUNTIME) -public @interface Name -{ - String value(); -} diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/annotation/Managed.java b/jetty-util/src/main/java/org/eclipse/jetty/util/annotation/Managed.java index bf9dc1bec6d..9c7f23e0c1a 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/annotation/Managed.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/annotation/Managed.java @@ -1,4 +1,16 @@ package org.eclipse.jetty.util.annotation; +//======================================================================== +//Copyright 2011-2012 Mort Bay Consulting Pty. Ltd. +//------------------------------------------------------------------------ +//All rights reserved. This program and the accompanying materials +//are made available under the terms of the Eclipse Public License v1.0 +//and Apache License v2.0 which accompanies this distribution. +//The Eclipse Public License is available at +//http://www.eclipse.org/legal/epl-v10.html +//The Apache License v2.0 is available at +//http://www.opensource.org/licenses/apache2.0.php +//You may elect to redistribute this code under either of these licenses. +//======================================================================== import java.lang.annotation.Documented; import java.lang.annotation.ElementType; @@ -8,7 +20,7 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Documented -@Target( { ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER } ) +@Target( { ElementType.TYPE, ElementType.METHOD, ElementType.FIELD } ) public @interface Managed { String value() default "Not Specified"; diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/annotation/Name.java b/jetty-util/src/main/java/org/eclipse/jetty/util/annotation/Name.java new file mode 100644 index 00000000000..19354924049 --- /dev/null +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/annotation/Name.java @@ -0,0 +1,28 @@ +package org.eclipse.jetty.util.annotation; +//======================================================================== +//Copyright 2011-2012 Mort Bay Consulting Pty. Ltd. +//------------------------------------------------------------------------ +//All rights reserved. This program and the accompanying materials +//are made available under the terms of the Eclipse Public License v1.0 +//and Apache License v2.0 which accompanies this distribution. +//The Eclipse Public License is available at +//http://www.eclipse.org/legal/epl-v10.html +//The Apache License v2.0 is available at +//http://www.opensource.org/licenses/apache2.0.php +//You may elect to redistribute this code under either of these licenses. +//======================================================================== + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Target( { ElementType.PARAMETER } ) +public @interface Name +{ + String value(); + String description() default "not specified"; +}