directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pro...@apache.org
Subject svn commit: r471600 - /directory/branches/mina/1.2/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
Date Mon, 06 Nov 2006 01:11:29 GMT
Author: proyal
Date: Sun Nov  5 17:11:27 2006
New Revision: 471600

URL: http://svn.apache.org/viewvc?view=rev&rev=471600
Log:
add generics

Modified:
    directory/branches/mina/1.2/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java

Modified: directory/branches/mina/1.2/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
URL: http://svn.apache.org/viewvc/directory/branches/mina/1.2/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java?view=diff&rev=471600&r1=471599&r2=471600
==============================================================================
--- directory/branches/mina/1.2/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
(original)
+++ directory/branches/mina/1.2/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
Sun Nov  5 17:11:27 2006
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.mina.transport.vmpipe;
 
@@ -23,8 +23,6 @@
 import java.net.SocketAddress;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 
 import org.apache.mina.common.IoHandler;
@@ -38,14 +36,14 @@
 /**
  * Binds the specified {@link IoHandler} to the specified
  * {@link VmPipeAddress}.
- * 
+ *
  * @author The Apache Directory Project (mina-dev@directory.apache.org)
  * @version $Rev$, $Date$
  */
 public class VmPipeAcceptor extends BaseIoAcceptor
 {
-    static final Map boundHandlers = new HashMap();
-    
+    static final Map<SocketAddress,VmPipe> boundHandlers = new HashMap<SocketAddress,
VmPipe>();
+
     private static final IoSessionConfig CONFIG = new BaseIoSessionConfig() {};
     private final IoServiceConfig defaultConfig = new BaseIoAcceptorConfig()
     {
@@ -86,48 +84,47 @@
                 throw new IOException( "Address already bound: " + address );
             }
 
-            boundHandlers.put( address, 
+            boundHandlers.put( address,
                                new VmPipe( this,
                                           ( VmPipeAddress ) address,
                                           handler, config, getListeners() ) );
         }
-        
+
         getListeners().fireServiceActivated( this, address, handler, config );
     }
-    
+
     public void unbind( SocketAddress address )
     {
         if( address == null )
             throw new NullPointerException( "address" );
 
-        VmPipe pipe = null;
+        VmPipe pipe;
         synchronized( boundHandlers )
         {
             if( !boundHandlers.containsKey( address ) )
             {
                 throw new IllegalArgumentException( "Address not bound: " + address );
             }
-            
-            pipe = ( VmPipe ) boundHandlers.remove( address );
+
+            pipe = boundHandlers.remove( address );
         }
-        
+
         getListeners().fireServiceDeactivated(
                 this, pipe.getAddress(),
                 pipe.getHandler(), pipe.getConfig() );
     }
-    
+
     public void unbindAll()
     {
         synchronized( boundHandlers )
         {
-            List addresses = new ArrayList( boundHandlers.keySet() );
-            for( Iterator i = addresses.iterator(); i.hasNext(); )
+            for( SocketAddress address : new ArrayList<SocketAddress>( boundHandlers.keySet()
) )
             {
-                unbind( ( SocketAddress ) i.next() );
+                unbind( address );
             }
         }
     }
-    
+
     public IoServiceConfig getDefaultConfig()
     {
         return defaultConfig;



Mime
View raw message