Moved ImmediateExecutor and its test class to org.jboss.netty.handler.ssl because it's used only there. Actually there was another unrelated reference, so I simply forked.

This commit is contained in:
Trustin Lee 2010-01-14 12:04:11 +00:00
parent 23943ac256
commit 4d9b3346c5
4 changed files with 18 additions and 8 deletions

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations * License for the specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jboss.netty.util.internal; package org.jboss.netty.handler.ssl;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
@ -26,12 +26,12 @@ import java.util.concurrent.Executor;
* @version $Rev$, $Date$ * @version $Rev$, $Date$
* *
*/ */
public class ImmediateExecutor implements Executor { final class ImmediateExecutor implements Executor {
/** /**
* The default instance. * The default instance.
*/ */
public static final ImmediateExecutor INSTANCE = new ImmediateExecutor(); static final ImmediateExecutor INSTANCE = new ImmediateExecutor();
public void execute(Runnable command) { public void execute(Runnable command) {
command.run(); command.run();

View File

@ -50,7 +50,6 @@ import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.handler.codec.frame.FrameDecoder; import org.jboss.netty.handler.codec.frame.FrameDecoder;
import org.jboss.netty.logging.InternalLogger; import org.jboss.netty.logging.InternalLogger;
import org.jboss.netty.logging.InternalLoggerFactory; import org.jboss.netty.logging.InternalLoggerFactory;
import org.jboss.netty.util.internal.ImmediateExecutor;
/** /**
* Adds <a href="http://en.wikipedia.org/wiki/Transport_Layer_Security">SSL * Adds <a href="http://en.wikipedia.org/wiki/Transport_Layer_Security">SSL

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations * License for the specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jboss.netty.util.internal; package org.jboss.netty.handler.ssl;
import static org.junit.Assert.*; import static org.junit.Assert.*;

View File

@ -21,7 +21,6 @@ import static org.junit.Assert.*;
import java.security.Permission; import java.security.Permission;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import org.jboss.netty.util.internal.ImmediateExecutor;
import org.junit.Test; import org.junit.Test;
@ -47,7 +46,7 @@ public class ThreadRenamingRunnableTest {
@Test @Test
public void testWithoutSecurityManager() throws Exception { public void testWithoutSecurityManager() throws Exception {
final String oldThreadName = Thread.currentThread().getName(); final String oldThreadName = Thread.currentThread().getName();
Executor e = ImmediateExecutor.INSTANCE; Executor e = new ImmediateExecutor();
e.execute(new ThreadRenamingRunnable( e.execute(new ThreadRenamingRunnable(
new Runnable() { new Runnable() {
public void run() { public void run() {
@ -62,7 +61,7 @@ public class ThreadRenamingRunnableTest {
@Test @Test
public void testWithSecurityManager() throws Exception { public void testWithSecurityManager() throws Exception {
final String oldThreadName = Thread.currentThread().getName(); final String oldThreadName = Thread.currentThread().getName();
Executor e = ImmediateExecutor.INSTANCE; Executor e = new ImmediateExecutor();
System.setSecurityManager(new SecurityManager() { System.setSecurityManager(new SecurityManager() {
@Override @Override
@ -92,4 +91,16 @@ public class ThreadRenamingRunnableTest {
assertEquals(oldThreadName, Thread.currentThread().getName()); assertEquals(oldThreadName, Thread.currentThread().getName());
} }
} }
private static class ImmediateExecutor implements Executor {
ImmediateExecutor() {
super();
}
public void execute(Runnable command) {
command.run();
}
}
} }