jdk/src/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java
changeset 2446 07047237e4d4
parent 2057 3acf8e5e2ca0
child 3632 399359a027de
equal deleted inserted replaced
2445:a1fa6863fc50 2446:07047237e4d4
    36 import java.util.Set;
    36 import java.util.Set;
    37 import java.util.HashSet;
    37 import java.util.HashSet;
    38 import java.util.Collections;
    38 import java.util.Collections;
    39 import java.util.concurrent.*;
    39 import java.util.concurrent.*;
    40 import java.util.concurrent.locks.*;
    40 import java.util.concurrent.locks.*;
       
    41 import sun.net.NetHooks;
    41 
    42 
    42 /**
    43 /**
    43  * Base implementation of AsynchronousSocketChannel
    44  * Base implementation of AsynchronousSocketChannel
    44  */
    45  */
    45 
    46 
   385                     throw new ConnectionPendingException();
   386                     throw new ConnectionPendingException();
   386                 if (localAddress != null)
   387                 if (localAddress != null)
   387                     throw new AlreadyBoundException();
   388                     throw new AlreadyBoundException();
   388                 InetSocketAddress isa = (local == null) ?
   389                 InetSocketAddress isa = (local == null) ?
   389                     new InetSocketAddress(0) : Net.checkAddress(local);
   390                     new InetSocketAddress(0) : Net.checkAddress(local);
       
   391                 NetHooks.beforeTcpBind(fd, isa.getAddress(), isa.getPort());
   390                 Net.bind(fd, isa.getAddress(), isa.getPort());
   392                 Net.bind(fd, isa.getAddress(), isa.getPort());
   391                 localAddress = Net.localAddress(fd);
   393                 localAddress = Net.localAddress(fd);
   392             }
   394             }
   393         } finally {
   395         } finally {
   394             end();
   396             end();