jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java
changeset 6117 471ae95609d5
parent 5506 202f599c92aa
child 6301 c90a67d75c9f
equal deleted inserted replaced
6116:3880a05ff32e 6117:471ae95609d5
   496             throw new IndexOutOfBoundsException();
   496             throw new IndexOutOfBoundsException();
   497         // ## Fix IOUtil.write so that we can avoid this array copy
   497         // ## Fix IOUtil.write so that we can avoid this array copy
   498         return write0(Util.subsequence(srcs, offset, length));
   498         return write0(Util.subsequence(srcs, offset, length));
   499     }
   499     }
   500 
   500 
       
   501     // package-private
       
   502     int sendOutOfBandData(byte b) throws IOException {
       
   503         synchronized (writeLock) {
       
   504             ensureWriteOpen();
       
   505             int n = 0;
       
   506             try {
       
   507                 begin();
       
   508                 synchronized (stateLock) {
       
   509                     if (!isOpen())
       
   510                         return 0;
       
   511                     writerThread = NativeThread.current();
       
   512                 }
       
   513                 for (;;) {
       
   514                     n = sendOutOfBandData(fd, b);
       
   515                     if ((n == IOStatus.INTERRUPTED) && isOpen())
       
   516                         continue;
       
   517                     return IOStatus.normalize(n);
       
   518                 }
       
   519             } finally {
       
   520                 writerCleanup();
       
   521                 end((n > 0) || (n == IOStatus.UNAVAILABLE));
       
   522                 synchronized (stateLock) {
       
   523                     if ((n <= 0) && (!isOutputOpen))
       
   524                         throw new AsynchronousCloseException();
       
   525                 }
       
   526                 assert IOStatus.check(n);
       
   527             }
       
   528         }
       
   529     }
       
   530 
   501     protected void implConfigureBlocking(boolean block) throws IOException {
   531     protected void implConfigureBlocking(boolean block) throws IOException {
   502         IOUtil.configureBlocking(fd, block);
   532         IOUtil.configureBlocking(fd, block);
   503     }
   533     }
   504 
   534 
   505     public SocketAddress localAddress() {
   535     public SocketAddress localAddress() {
   955 
   985 
   956     private static native int checkConnect(FileDescriptor fd,
   986     private static native int checkConnect(FileDescriptor fd,
   957                                            boolean block, boolean ready)
   987                                            boolean block, boolean ready)
   958         throws IOException;
   988         throws IOException;
   959 
   989 
       
   990     private static native int sendOutOfBandData(FileDescriptor fd, byte data)
       
   991         throws IOException;
       
   992 
   960     static {
   993     static {
   961         Util.load();
   994         Util.load();
   962         nd = new SocketDispatcher();
   995         nd = new SocketDispatcher();
   963     }
   996     }
   964 
   997