1879N/A * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 1472N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * or visit www.oracle.com if you need additional information or have any 0N/A // Controls the cache policy for successful lookups only 0N/A "sun.net.inetaddr.ttl";
0N/A // Controls the cache policy for negative lookups only 0N/A "networkaddress.cache.negative.ttl";
0N/A "sun.net.inetaddr.negative.ttl";
0N/A /* default value for positive lookups */ 0N/A /* The Java-level namelookup cache policy for successful lookups: 0N/A * -1: caching forever 0N/A * any positive value: the number of seconds to cache an address for 0N/A * default value is forever (FOREVER), as we let the platform do the 0N/A * caching. For security reasons, this caching is made forever when 0N/A * a security manager is set. 0N/A /* The Java-level namelookup cache policy for negative lookups: 0N/A * -1: caching forever 0N/A * any positive value: the number of seconds to cache an address for 0N/A * default value is 0. It can be set to some other value for 0N/A * performance reasons. 0N/A * Whether or not the cache policy for successful lookups was set 0N/A * using a property (cmd line). 0N/A * Whether or not the cache policy for negative lookups was set 0N/A * using a property (cmd line). 0N/A /* No properties defined for positive caching. If there is no 0N/A * security manager then use the default positive cache value. 0N/A public static synchronized int get() {
0N/A * Sets the cache policy for successful lookups if the user has not 0N/A * already specified a cache policy for it using a 0N/A * @param newPolicy the value in seconds for how long the lookup 0N/A * When setting the new value we may want to signal that the 0N/A * cache should be flushed, though this doesn't seem strictly 0N/A * Sets the cache policy for negative lookups if the user has not 0N/A * already specified a cache policy for it using a 0N/A * @param newPolicy the value in seconds for how long the lookup 0N/A * When setting the new value we may want to signal that the 0N/A * cache should be flushed, though this doesn't seem strictly 0N/A // Negative caching does not seem to have any security 0N/A // checkValue(newPolicy, negativeCachePolicy); 0N/A * If malicious code gets a hold of this method, prevent 0N/A * setting the cache policy to something laxer or some 0N/A * invalid negative value.