Author: trustin
Date: Thu Nov 4 08:31:00 2004
New Revision: 56604
Modified:
incubator/directory/seda/trunk/src/java/org/apache/seda/decoder/DefaultDecoderManager.java
incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPListenerManager.java
incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPClientKey.java
incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPListenerManager.java
incubator/directory/seda/trunk/src/java/org/apache/seda/output/OutputMonitorAdapter.java
incubator/directory/seda/trunk/src/java/org/apache/seda/output/UDPOutputManager.java
incubator/directory/seda/trunk/src/java/org/apache/seda/thread/AbstractThreadPool.java
incubator/directory/seda/trunk/src/test/org/apache/seda/ProtocolTestCase.java
incubator/directory/seda/trunk/src/test/org/apache/seda/decoder/DefaultDecoderManagerTest.java
incubator/directory/seda/trunk/src/test/org/apache/seda/examples/DiscardProtocolProviderTest.java
incubator/directory/seda/trunk/src/test/org/apache/seda/examples/EchoProtocolProviderTest.java
Log:
Removed unused fields and local variables.
Modified:
incubator/directory/seda/trunk/src/java/org/apache/seda/decoder/DefaultDecoderManager.java
==============================================================================
---
incubator/directory/seda/trunk/src/java/org/apache/seda/decoder/DefaultDecoderManager.java
(original)
+++
incubator/directory/seda/trunk/src/java/org/apache/seda/decoder/DefaultDecoderManager.java
Thu Nov 4 08:31:00 2004
@@ -64,9 +64,6 @@
/** map of decoders for client keys */
private final Map decoders = new HashMap();
- /** map of DecoderFactory for different protos using proto name as key */
- private final Map factories = new HashMap(2);
-
/** the monitor used for this decoder manager */
private DecoderManagerMonitor monitor;
Modified:
incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPListenerManager.java
==============================================================================
---
incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPListenerManager.java
(original)
+++
incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPListenerManager.java
Thu Nov 4 08:31:00 2004
@@ -25,10 +25,8 @@
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.util.EventObject;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.Map;
import java.util.Set;
import org.apache.seda.event.ConnectEvent;
@@ -57,9 +55,6 @@
/** selector used to select a acceptable socket channel */
private final Selector selector;
- /** a map of auth service names to their protocol providers */
- private final Map protocols;
-
/** the client keys for accepted connections */
private final Set clients;
@@ -93,7 +88,6 @@
this.router = router;
this.clients = new HashSet();
this.selector = Selector.open();
- this.protocols = new HashMap();
this.listeners = new HashSet();
this.hasStarted = new Boolean(false);
this.bindListeners = new HashSet();
Modified:
incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPClientKey.java
==============================================================================
---
incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPClientKey.java
(original)
+++
incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPClientKey.java
Thu Nov 4 08:31:00 2004
@@ -51,9 +51,6 @@
/** Socket connection to client */
private final DatagramSocket socket;
- /** Client address */
- private final InetSocketAddress clientAddress;
-
/** Whether or not this key has expired: the client has disconnected. */
private boolean hasExpired = false;
@@ -83,7 +80,6 @@
a_socket.getLocalPort()), clientAddress);
socket = a_socket;
- this.clientAddress = clientAddress;
}
private static String getClientId(DatagramSocket a_socket,
Modified:
incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPListenerManager.java
==============================================================================
---
incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPListenerManager.java
(original)
+++
incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPListenerManager.java
Thu Nov 4 08:31:00 2004
@@ -25,10 +25,8 @@
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.util.EventObject;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.Map;
import java.util.Set;
import org.apache.seda.ResourceException;
@@ -58,9 +56,6 @@
/** the buffer pool we get direct buffers from */
private BufferPool bp = null;
- /** a map of auth service names to their protocol providers */
- private final Map protocols;
-
/** the client keys for accepted connections */
private final Set clients;
@@ -94,7 +89,6 @@
this.router = router;
this.clients = new HashSet();
this.selector = Selector.open();
- this.protocols = new HashMap();
this.listeners = new HashSet();
this.hasStarted = new Boolean(false);
this.bindListeners = new HashSet();
Modified:
incubator/directory/seda/trunk/src/java/org/apache/seda/output/OutputMonitorAdapter.java
==============================================================================
---
incubator/directory/seda/trunk/src/java/org/apache/seda/output/OutputMonitorAdapter.java
(original)
+++
incubator/directory/seda/trunk/src/java/org/apache/seda/output/OutputMonitorAdapter.java
Thu Nov 4 08:31:00 2004
@@ -54,14 +54,6 @@
}
/* (non-Javadoc)
- * @see org.apache.seda.output.OutputMonitor#writeLockAcquired(
- * org.apache.seda.output.OutputManager,
org.apache.seda.listener.ClientKey)
- */
- public void writeLockAcquired(OutputManager manager, ClientKey key)
- {
- }
-
- /* (non-Javadoc)
* @see org.apache.seda.output.OutputMonitor#channelMissing(
* org.apache.seda.output.OutputManager,
org.apache.seda.listener.ClientKey)
*/
Modified:
incubator/directory/seda/trunk/src/java/org/apache/seda/output/UDPOutputManager.java
==============================================================================
---
incubator/directory/seda/trunk/src/java/org/apache/seda/output/UDPOutputManager.java
(original)
+++
incubator/directory/seda/trunk/src/java/org/apache/seda/output/UDPOutputManager.java
Thu Nov 4 08:31:00 2004
@@ -160,7 +160,6 @@
public void write(ClientKey key, ByteBuffer buf)
throws IOException
{
- Object lock = null;
DatagramChannel channel = (DatagramChannel) channels.get(key);
if (null == channel)
Modified:
incubator/directory/seda/trunk/src/java/org/apache/seda/thread/AbstractThreadPool.java
==============================================================================
---
incubator/directory/seda/trunk/src/java/org/apache/seda/thread/AbstractThreadPool.java
(original)
+++
incubator/directory/seda/trunk/src/java/org/apache/seda/thread/AbstractThreadPool.java
Thu Nov 4 08:31:00 2004
@@ -188,12 +188,9 @@
public final void run()
{
- Runnable runnable;
- Object item;
-
while (isStarted())
{
- runnable = localEventQueue.fetch();
+ Runnable runnable = localEventQueue.fetch();
if (runnable == FEWER_THREADS)
{
Modified:
incubator/directory/seda/trunk/src/test/org/apache/seda/ProtocolTestCase.java
==============================================================================
---
incubator/directory/seda/trunk/src/test/org/apache/seda/ProtocolTestCase.java
(original)
+++
incubator/directory/seda/trunk/src/test/org/apache/seda/ProtocolTestCase.java
Thu Nov 4 08:31:00 2004
@@ -94,7 +94,7 @@
private static String toString(byte[] buf) {
StringBuffer str = new StringBuffer(buf.length * 4);
for (int i = 0; i < buf.length; i++) {
- str.append((int) buf[i]);
+ str.append(buf[i]);
str.append(' ');
}
return str.toString();
Modified:
incubator/directory/seda/trunk/src/test/org/apache/seda/decoder/DefaultDecoderManagerTest.java
==============================================================================
---
incubator/directory/seda/trunk/src/test/org/apache/seda/decoder/DefaultDecoderManagerTest.java
(original)
+++
incubator/directory/seda/trunk/src/test/org/apache/seda/decoder/DefaultDecoderManagerTest.java
Thu Nov 4 08:31:00 2004
@@ -22,10 +22,6 @@
import junit.framework.TestCase;
-import org.apache.seda.buffer.BufferPool;
-import org.apache.seda.buffer.BufferPoolConfig;
-import org.apache.seda.buffer.DefaultBufferPool;
-import org.apache.seda.buffer.DefaultBufferPoolConfig;
import org.apache.seda.event.AbstractSubscriber;
import org.apache.seda.event.DefaultEventRouter;
import org.apache.seda.event.EventRouter;
@@ -49,11 +45,8 @@
{
private ThreadPool tpool = null;
private EventRouter router = null;
- private BufferPoolConfig bpConfig = null;
private DefaultStageConfig config = null;
- private BufferPool bp = null;
private DefaultDecoderManager decodeMan = null;
- private RequestEvent event = null;
/**
* Constructor for DefaultDecoderManagerTest.
@@ -76,8 +69,6 @@
{
super.setUp();
- bpConfig = new DefaultBufferPoolConfig("default", 10, 100, 10, 1024);
- bp = new DefaultBufferPool(bpConfig);
router = new DefaultEventRouter();
router.subscribe(new EventTypeFilter(RequestEvent.class), this);
tpool =
@@ -136,18 +127,14 @@
tpool = null;
router = null;
- bpConfig = null;
config = null;
- bp = null;
decodeMan.stop();
decodeMan = null;
- event = null;
}
public void inform(RequestEvent event)
{
System.out.println("\n\nRequestEvent Set!!!\n\n");
- this.event = event;
}
/* (non-Javadoc)
Modified:
incubator/directory/seda/trunk/src/test/org/apache/seda/examples/DiscardProtocolProviderTest.java
==============================================================================
---
incubator/directory/seda/trunk/src/test/org/apache/seda/examples/DiscardProtocolProviderTest.java
(original)
+++
incubator/directory/seda/trunk/src/test/org/apache/seda/examples/DiscardProtocolProviderTest.java
Thu Nov 4 08:31:00 2004
@@ -52,7 +52,6 @@
OutputStream out = socket.getOutputStream();
byte[] data = new byte[512];
- byte value = (byte) 0;
for (int i = data.length - 1; i >= 0; i--)
{
@@ -81,7 +80,6 @@
DatagramSocket socket = new DatagramSocket();
byte[] data = new byte[512];
- byte value = (byte) 0;
for (int i = data.length - 1; i >= 0; i--)
{
Modified:
incubator/directory/seda/trunk/src/test/org/apache/seda/examples/EchoProtocolProviderTest.java
==============================================================================
---
incubator/directory/seda/trunk/src/test/org/apache/seda/examples/EchoProtocolProviderTest.java
(original)
+++
incubator/directory/seda/trunk/src/test/org/apache/seda/examples/EchoProtocolProviderTest.java
Thu Nov 4 08:31:00 2004
@@ -91,40 +91,40 @@
public void testUDP() throws Exception
{
-// EchoUDPClient client = new EchoUDPClient();
-// client.open();
-// client.setSoTimeout(3000);
-//
-// byte[] writeBuf = new byte[16];
-//
-// for (int i = 0; i < 10; i++)
-// {
-// fillWriteBuffer(writeBuf, i);
-// client.send(writeBuf, writeBuf.length,
InetAddress.getLocalHost(), port);
-// }
-//
-// byte[] readBuf = new byte[writeBuf.length];
-//
-// for (int i = 0; i < 10; i++)
-// {
-// fillWriteBuffer(writeBuf, i);
-//
-// assertEquals(readBuf.length, client.receive(readBuf,
readBuf.length));
-// assertEquals(writeBuf, readBuf);
-// }
-//
-// client.setSoTimeout(100);
-//
-// try
-// {
-// client.receive(readBuf);
-// fail("Unexpected incoming data.");
-// }
-// catch (SocketTimeoutException e)
-// {
-// }
-//
-// client.close();
+ EchoUDPClient client = new EchoUDPClient();
+ client.open();
+ client.setSoTimeout(3000);
+
+ byte[] writeBuf = new byte[16];
+
+ for (int i = 0; i < 10; i++)
+ {
+ fillWriteBuffer(writeBuf, i);
+ client.send(writeBuf, writeBuf.length, InetAddress.getLocalHost(),
port);
+ }
+
+ byte[] readBuf = new byte[writeBuf.length];
+
+ for (int i = 0; i < 10; i++)
+ {
+ fillWriteBuffer(writeBuf, i);
+
+ assertEquals(readBuf.length, client.receive(readBuf,
readBuf.length));
+ assertEquals(writeBuf, readBuf);
+ }
+
+ client.setSoTimeout(100);
+
+ try
+ {
+ client.receive(readBuf);
+ fail("Unexpected incoming data.");
+ }
+ catch (SocketTimeoutException e)
+ {
+ }
+
+ client.close();
}
private void fillWriteBuffer(byte[] writeBuf, int i) {