Author: david.lloyd(a)jboss.com
Date: 2008-11-19 20:08:06 -0500 (Wed, 19 Nov 2008)
New Revision: 4715
Modified:
remoting3/trunk/standalone/src/main/java/org/jboss/remoting/Remoting.java
Log:
Javadoc updates
Modified: remoting3/trunk/standalone/src/main/java/org/jboss/remoting/Remoting.java
===================================================================
--- remoting3/trunk/standalone/src/main/java/org/jboss/remoting/Remoting.java 2008-11-20
01:07:52 UTC (rev 4714)
+++ remoting3/trunk/standalone/src/main/java/org/jboss/remoting/Remoting.java 2008-11-20
01:08:06 UTC (rev 4715)
@@ -15,14 +15,28 @@
import org.jboss.xnio.IoUtils;
/**
- *
+ * The standalone interface into Remoting. This class contains static methods that are
useful to standalone programs
+ * for managing endpoints and services in a simple fashion.
*/
public final class Remoting {
+ /**
+ * Create an endpoint. The endpoint will create its own thread pool with a maximum
of 10 threads.
+ *
+ * @param name the name of the endpoint
+ * @return the endpoint
+ */
public static Endpoint createEndpoint(final String name) {
return createEndpoint(name, 10);
}
+ /**
+ * Create an endpoint. The endpoint will create its own thread pool with a maximum
of {@code maxThreads} threads.
+ *
+ * @param name the name of the endpoint
+ * @param maxThreads the maximum thread count
+ * @return the endpoint
+ */
public static Endpoint createEndpoint(final String name, final int maxThreads) {
final ThreadPoolExecutor executor = new ThreadPoolExecutor(0, maxThreads,
Long.MAX_VALUE, TimeUnit.NANOSECONDS, new AlwaysBlockingQueue<Runnable>(new
SynchronousQueue<Runnable>()), new ThreadPoolExecutor.AbortPolicy());
final EndpointImpl endpoint = new EndpointImpl(executor, name);
@@ -39,10 +53,30 @@
return endpoint;
}
+ /**
+ * Create an endpoint using the given {@code Executor} to execute tasks.
+ *
+ * @param executor the executor to use
+ * @param name the name of the endpoint
+ * @return the endpoint
+ */
public static Endpoint createEndpoint(final Executor executor, final String name) {
return new EndpointImpl(executor, name);
}
+ /**
+ * Create a local client from a request listener. The client will retain the sole
reference to the request listener,
+ * so when the client is closed, the listener will also be closed (unless the client
is sent to a remote endpoint).
+ *
+ * @param endpoint the endpoint to bind the request listener to
+ * @param requestListener the request listener
+ * @param requestClass the request class
+ * @param replyClass the reply class
+ * @param <I> the request type
+ * @param <O> the reply type
+ * @return a new client
+ * @throws IOException if an error occurs
+ */
public static <I, O> Client<I, O> createLocalClient(final Endpoint
endpoint, final RequestListener<I, O> requestListener, final Class<I>
requestClass, final Class<O> replyClass) throws IOException {
final Handle<RequestHandler> handle =
endpoint.createRequestHandler(requestListener, requestClass, replyClass);
try {
@@ -52,6 +86,16 @@
}
}
+ /**
+ * Create a local client source from a local service configuration. The client
source will be registered on the endpoint.
+ *
+ * @param endpoint the endpoint to bind the service to
+ * @param config the service configuration
+ * @param <I> the request type
+ * @param <O> the reply type
+ * @return a new client source
+ * @throws IOException if an error occurs
+ */
public static <I, O> ClientSource<I, O> createLocalClientSource(final
Endpoint endpoint, final LocalServiceConfiguration<I, O> config) throws IOException
{
final Handle<RequestHandlerSource> handle =
endpoint.registerService(config);
try {
Show replies by date