You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by tr...@apache.org on 2004/11/04 16:01:37 UTC

svn commit: rev 56596 - in incubator/directory/seda/trunk/src/java/org/apache/seda: listener output

Author: trustin
Date: Thu Nov  4 07:01:35 2004
New Revision: 56596

Modified:
   incubator/directory/seda/trunk/src/java/org/apache/seda/listener/ClientKey.java
   incubator/directory/seda/trunk/src/java/org/apache/seda/output/OutputMonitor.java
   incubator/directory/seda/trunk/src/java/org/apache/seda/output/TCPOutputManager.java
   incubator/directory/seda/trunk/src/java/org/apache/seda/output/UDPOutputManager.java
Log:
Removed lock object from ClientKeys
=> OrderedThreadPool ensures I/O operations for the same channel occur in serialized manner.

Modified: incubator/directory/seda/trunk/src/java/org/apache/seda/listener/ClientKey.java
==============================================================================
--- incubator/directory/seda/trunk/src/java/org/apache/seda/listener/ClientKey.java	(original)
+++ incubator/directory/seda/trunk/src/java/org/apache/seda/listener/ClientKey.java	Thu Nov  4 07:01:35 2004
@@ -48,12 +48,6 @@
     // Private members.
     // ----------------------------------------------
 
-    /** Input channel synchronization object */
-    private final Object inputLock = new Object();
-
-    /** Output channel synchronization object */
-    private final Object outputLock = new Object();
-
     /** Unique key or client id */
     private final String clientId;
 
@@ -115,34 +109,6 @@
      */
     public abstract InetSocketAddress getRemoteAddress()
                                                 throws KeyExpiryException;
-
-    // ----------------------------------------------
-    // ClientKey lock object accessors.
-    // ----------------------------------------------
-
-    /**
-     * Gets the client's output stream lock object.
-     *
-     * @return ouput lock object.
-     * @throws KeyExpiryException to force the handling of expired keys
-     */
-    public final Object getOutputLock() throws KeyExpiryException
-    {
-        checkExpiry();
-        return outputLock;
-    }
-
-    /**
-     * Gets the client's input stream lock object.
-     *
-     * @return input lock object.
-     * @throws KeyExpiryException to force the handling of expired keys
-     */
-    public final Object getInputLock() throws KeyExpiryException
-    {
-        checkExpiry();
-        return inputLock;
-    }
 
     // ----------------------------------------------
     // Key expiration methods.

Modified: incubator/directory/seda/trunk/src/java/org/apache/seda/output/OutputMonitor.java
==============================================================================
--- incubator/directory/seda/trunk/src/java/org/apache/seda/output/OutputMonitor.java	(original)
+++ incubator/directory/seda/trunk/src/java/org/apache/seda/output/OutputMonitor.java	Thu Nov  4 07:01:35 2004
@@ -52,14 +52,6 @@
     void writeOccurred(OutputManager manager, ClientKey key);
 
     /**
-     * Monitors locks acquired to write to a client's output channel.
-     *
-     * @param manager the OutputManager write locking
-     * @param key the key of the client lock is for
-     */
-    void writeLockAcquired(OutputManager manager, ClientKey key);
-
-    /**
      * Monitors situations where a channel is no longer present for a client.
      *
      * @param manager the OutputManager detecting the missing channel

Modified: incubator/directory/seda/trunk/src/java/org/apache/seda/output/TCPOutputManager.java
==============================================================================
--- incubator/directory/seda/trunk/src/java/org/apache/seda/output/TCPOutputManager.java	(original)
+++ incubator/directory/seda/trunk/src/java/org/apache/seda/output/TCPOutputManager.java	Thu Nov  4 07:01:35 2004
@@ -172,7 +172,6 @@
     public void write(ClientKey key, ByteBuffer buf)
                throws IOException
     {
-        Object lock = null;
         SocketChannel channel = (SocketChannel) channels.get(key);
 
         if (null == channel)
@@ -181,25 +180,7 @@
             return;
         }
 
-        // Obtain output lock for write to client.
-        try
-        {
-            lock = key.getOutputLock();
-        }
-        catch (KeyExpiryException e)
-        {
-            monitor.keyExpired(this, key, e);
-            return;
-        }
-
-        // synchronize on client output stream lock object.
-        synchronized (lock)
-        {
-            monitor.writeLockAcquired(this, key);
-            channel.write(buf);
-            lock.notifyAll();
-        }
-
+        channel.write(buf);
         monitor.writeOccurred(this, key);
     }
 

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 07:01:35 2004
@@ -169,25 +169,7 @@
             return;
         }
 
-        // Obtain output lock for write to client.
-        try
-        {
-            lock = key.getOutputLock();
-        }
-        catch (KeyExpiryException e)
-        {
-            monitor.keyExpired(this, key, e);
-            return;
-        }
-
-        // synchronize on client output stream lock object.
-        synchronized (lock)
-        {
-            monitor.writeLockAcquired(this, key);
-            channel.send(buf, key.getRemoteAddress());
-            lock.notifyAll();
-        }
-
+        channel.send(buf, key.getRemoteAddress());
         monitor.writeOccurred(this, key);
     }