test/sun/net/InetAddress/nameservice/simple/CacheTest.java

Print this page




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 4292867
  26  * @summary Check that InetAddress doesn't continue to throw UHE
  27  *          after the name service has recovered and the negative ttl
  28  *          on the initial lookup has expired.
  29  *
  30  * @build CacheTest SimpleNameService SimpleNameServiceDescriptor
  31  * @run main/othervm/timeout=200 -Dsun.net.spi.nameservice.provider.1=simple,sun CacheTest
  32  */
  33 import java.net.InetAddress;
  34 import java.net.UnknownHostException;
  35 import java.security.Security;
  36 
  37 public class CacheTest {
  38 
  39 
  40     public static void main(String args[]) throws Exception {
  41 
  42         /*
  43          * First check the ttl on negative lookups is in the <15 second
  44          * range. If the ttl is <=0 it means we cache forever or always
  45          * consult the name service. For ttl > 15 the test would take
  46          * too long so we skip it (need to coordinate jtreg timeout
  47          * with negative ttl)
  48          */
  49         String ttlProp = "networkaddress.cache.negative.ttl";
  50         int ttl = 0;




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 4292867
  26  * @summary Check that InetAddress doesn't continue to throw UHE
  27  *          after the name service has recovered and the negative ttl
  28  *          on the initial lookup has expired.
  29  * @compile -XDignore.symbol.file=true SimpleNameService.java
  30  *                                     SimpleNameServiceDescriptor.java
  31  * @run main/othervm/timeout=200 -Dsun.net.spi.nameservice.provider.1=simple,sun CacheTest
  32  */
  33 import java.net.InetAddress;
  34 import java.net.UnknownHostException;
  35 import java.security.Security;
  36 
  37 public class CacheTest {
  38 
  39 
  40     public static void main(String args[]) throws Exception {
  41 
  42         /*
  43          * First check the ttl on negative lookups is in the <15 second
  44          * range. If the ttl is <=0 it means we cache forever or always
  45          * consult the name service. For ttl > 15 the test would take
  46          * too long so we skip it (need to coordinate jtreg timeout
  47          * with negative ttl)
  48          */
  49         String ttlProp = "networkaddress.cache.negative.ttl";
  50         int ttl = 0;