More JavaDoc

This commit is contained in:
Trustin Lee 2008-08-10 15:34:17 +00:00
parent 5cd1d72571
commit f34a018218
5 changed files with 35 additions and 4 deletions

View File

@ -35,6 +35,9 @@ import java.util.concurrent.Executor;
*/ */
public class ImmediateExecutor implements Executor { public class ImmediateExecutor implements Executor {
/**
* The default instance.
*/
public static final ImmediateExecutor INSTANCE = new ImmediateExecutor(); public static final ImmediateExecutor INSTANCE = new ImmediateExecutor();
public void execute(Runnable command) { public void execute(Runnable command) {

View File

@ -43,10 +43,17 @@ public class MapBackedSet<E> extends AbstractSet<E> implements Serializable {
private final Map<E, Boolean> map; private final Map<E, Boolean> map;
/**
* Creates a new instance which wraps the specified {@code map}.
*/
public MapBackedSet(Map<E, Boolean> map) { public MapBackedSet(Map<E, Boolean> map) {
this.map = map; this.map = map;
} }
/**
* Creates a new instance which wraps the specified {@code map} and
* adds all elements of the specified collection.
*/
public MapBackedSet(Map<E, Boolean> map, Collection<E> c) { public MapBackedSet(Map<E, Boolean> map, Collection<E> c) {
this.map = map; this.map = map;
addAll(c); addAll(c);

View File

@ -26,7 +26,7 @@ import org.jboss.netty.logging.InternalLogger;
import org.jboss.netty.logging.InternalLoggerFactory; import org.jboss.netty.logging.InternalLoggerFactory;
/** /**
* {@link Runnable} that changes the current thread name and reverts it back * Meta {@link Runnable} that changes the current thread name and reverts it back
* when its execution ends. * when its execution ends.
* *
* @author The Netty Project (netty-dev@lists.jboss.org) * @author The Netty Project (netty-dev@lists.jboss.org)
@ -42,6 +42,11 @@ public class NamePreservingRunnable implements Runnable {
private final String newName; private final String newName;
private final Runnable runnable; private final Runnable runnable;
/**
* Creates a new instance which wraps the specified {@code runnable}
* and changes the thread name to the specified thread name when the
* specified {@code runnable} is running.
*/
public NamePreservingRunnable(Runnable runnable, String newName) { public NamePreservingRunnable(Runnable runnable, String newName) {
this.runnable = runnable; this.runnable = runnable;
this.newName = newName; this.newName = newName;
@ -63,8 +68,9 @@ public class NamePreservingRunnable implements Runnable {
} }
/** /**
* Wraps {@link Thread#setName(String)} to catch a possible {@link Exception}s such as * Wraps {@link Thread#setName(String)} to catch a possible
* {@link SecurityException} in sandbox environments, such as applets * {@link Exception} such as a {@link SecurityException} in a sandbox
* environment, such as an applet
*/ */
private void setName(Thread thread, String name) { private void setName(Thread thread, String name) {
try { try {

View File

@ -37,10 +37,18 @@ import java.io.InputStream;
*/ */
public class SwitchableInputStream extends FilterInputStream { public class SwitchableInputStream extends FilterInputStream {
/**
* Creates a new instance without initializing the reference to the
* underlying stream.
*/
public SwitchableInputStream() { public SwitchableInputStream() {
super(null); super(null);
} }
/**
* Creates a new instance with the initial reference to the underlying
* stream.
*/
public void switchStream(InputStream in) { public void switchStream(InputStream in) {
this.in = in; this.in = in;
} }

View File

@ -32,7 +32,11 @@ import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
/** /**
* Generates a time-based {@link UUID}. * Generates a time-based {@link UUID}. Please note that this generator
* uses a pseudo HMAC which is generated based on various VM properties.
* Therefore, the pseudo HMAC can change for each VM instance even if you
* launch the VM in the same machine. Its purpose is to generate a unique
* ID for one VM at most.
* *
* @author The Netty Project (netty-dev@lists.jboss.org) * @author The Netty Project (netty-dev@lists.jboss.org)
* @author Trustin Lee (tlee@redhat.com) * @author Trustin Lee (tlee@redhat.com)
@ -123,6 +127,9 @@ public class TimeBasedUuidGenerator {
} }
} }
/**
* Returns a new time-based {@link UUID}.
*/
public static UUID generate() { public static UUID generate() {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
int clockSeq = TimeBasedUuidGenerator.SEQUENCE.getAndIncrement(); int clockSeq = TimeBasedUuidGenerator.SEQUENCE.getAndIncrement();