< prev index next >

src/java.base/share/classes/sun/net/ExtendedOptionsImpl.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -25,19 +25,13 @@
 
 package sun.net;
 
 import java.net.*;
 import jdk.net.*;
-import java.io.IOException;
 import java.io.FileDescriptor;
 import java.security.PrivilegedAction;
 import java.security.AccessController;
-import java.lang.reflect.Field;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.HashMap;
-import java.util.Collections;
 
 /**
  * Contains the native implementation for extended socket options
  * together with some other static utilities
  */

@@ -78,15 +72,33 @@
             throw new IllegalArgumentException(s);
         }
     }
 
     private static native void init();
+    private static volatile boolean checkedQuickAck;
+    private static volatile boolean isQuickAckAvailable;
+    /**
+     * Tells whether SO_QUICKACK is supported.
+     * @return 
+     */
+    public static boolean isQuickAckAvailable() {
+        if (!checkedQuickAck) {
+            isQuickAckAvailable = isQuickAckAvailable0();
+            checkedQuickAck = true;
+        }
+        return isQuickAckAvailable;
+    }
 
     /*
      * Extension native implementations
      *
      * SO_FLOW_SLA
      */
     public static native void setFlowOption(FileDescriptor fd, SocketFlow f);
     public static native void getFlowOption(FileDescriptor fd, SocketFlow f);
     public static native boolean flowSupported();
+    
+    /* SO_QUICKACK */
+    public static native void setQuickAckOption(FileDescriptor fd, boolean on);
+    public static native Object getQuickAckOption(FileDescriptor fd);
+    private static native boolean isQuickAckAvailable0();
 }
< prev index next >