jdk/src/share/classes/sun/nio/ch/AsynchronousServerSocketChannelImpl.java
changeset 18212 22f8c33b0690
parent 18192 fa6bd0992104
child 23010 6dadb192ad81
equal deleted inserted replaced
18211:74aeb4741e3d 18212:22f8c33b0690
    49     implements Cancellable, Groupable
    49     implements Cancellable, Groupable
    50 {
    50 {
    51     protected final FileDescriptor fd;
    51     protected final FileDescriptor fd;
    52 
    52 
    53     // the local address to which the channel's socket is bound
    53     // the local address to which the channel's socket is bound
    54     protected volatile SocketAddress localAddress = null;
    54     protected volatile InetSocketAddress localAddress = null;
    55 
    55 
    56     // need this lock to set local address
    56     // need this lock to set local address
    57     private final Object stateLock = new Object();
    57     private final Object stateLock = new Object();
    58 
    58 
    59     // close support
    59     // close support
   171 
   171 
   172     @Override
   172     @Override
   173     public final SocketAddress getLocalAddress() throws IOException {
   173     public final SocketAddress getLocalAddress() throws IOException {
   174         if (!isOpen())
   174         if (!isOpen())
   175             throw new ClosedChannelException();
   175             throw new ClosedChannelException();
   176         return localAddress;
   176         return Net.getRevealedLocalAddress(localAddress);
   177     }
   177     }
   178 
   178 
   179     @Override
   179     @Override
   180     public final <T> AsynchronousServerSocketChannel setOption(SocketOption<T> name,
   180     public final <T> AsynchronousServerSocketChannel setOption(SocketOption<T> name,
   181                                                                T value)
   181                                                                T value)
   249             sb.append("closed");
   249             sb.append("closed");
   250         else {
   250         else {
   251             if (localAddress == null) {
   251             if (localAddress == null) {
   252                 sb.append("unbound");
   252                 sb.append("unbound");
   253             } else {
   253             } else {
   254                 sb.append(localAddress.toString());
   254                 sb.append(Net.getRevealedLocalAddressAsString(localAddress));
   255             }
   255             }
   256         }
   256         }
   257         sb.append(']');
   257         sb.append(']');
   258         return sb.toString();
   258         return sb.toString();
   259     }
   259     }