当前位置: 首页>>代码示例>>Java>>正文


Java InetAddressCachePolicy类代码示例

本文整理汇总了Java中sun.net.InetAddressCachePolicy的典型用法代码示例。如果您正苦于以下问题:Java InetAddressCachePolicy类的具体用法?Java InetAddressCachePolicy怎么用?Java InetAddressCachePolicy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InetAddressCachePolicy类属于sun.net包,在下文中一共展示了InetAddressCachePolicy类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get

import sun.net.InetAddressCachePolicy; //导入依赖的package包/类
/**
 * Query the cache for the specific host. If found then
 * return its CacheEntry, or null if not found.
 */
public CacheEntry get(String host) {
    int policy = getPolicy();
    if (policy == InetAddressCachePolicy.NEVER) {
        return null;
    }
    CacheEntry entry = cache.get(host);

    // check if entry has expired
    if (entry != null && policy != InetAddressCachePolicy.FOREVER) {
        if (entry.expiration >= 0 &&
            entry.expiration < System.currentTimeMillis()) {
            cache.remove(host);
            entry = null;
        }
    }

    return entry;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:InetAddress.java

示例2: get

import sun.net.InetAddressCachePolicy; //导入依赖的package包/类
/**
 * Query the cache for the specific host. If found then
 * return its CacheEntry, or null if not found.
 */
public CacheEntry get(String host) {
    int policy = getPolicy();
    if (policy == InetAddressCachePolicy.NEVER) {
	return null;
    }
    CacheEntry entry = (CacheEntry)cache.get(host);

    // check if entry has expired
    if (entry != null && policy != InetAddressCachePolicy.FOREVER) {
	if (entry.expiration >= 0 && 
	    entry.expiration < System.currentTimeMillis()) {
	    cache.remove(host);
	    entry = null;
	}
    }

    return entry;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:23,代码来源:InetAddress.java

示例3: getPolicy

import sun.net.InetAddressCachePolicy; //导入依赖的package包/类
private int getPolicy() {
    if (type == Type.Positive) {
        return InetAddressCachePolicy.get();
    } else {
        return InetAddressCachePolicy.getNegative();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:InetAddress.java

示例4: setSecurityManager0

import sun.net.InetAddressCachePolicy; //导入依赖的package包/类
private static synchronized
   void setSecurityManager0(final SecurityManager s) {
SecurityManager sm = getSecurityManager();
       if (sm != null) {
	    // ask the currently installed security manager if we
	    // can replace it.
	    sm.checkPermission(new RuntimePermission
			     ("setSecurityManager"));
}

if ((s != null) && (s.getClass().getClassLoader() != null)) {
    // New security manager class is not on bootstrap classpath.
    // Cause policy to get initialized before we install the new
    // security manager, in order to prevent infinite loops when
    // trying to initialize the policy (which usually involves
    // accessing some security and/or system properties, which in turn
    // calls the installed security manager's checkPermission method
    // which will loop infinitely if there is a non-system class
    // (in this case: the new security manager class) on the stack).
    AccessController.doPrivileged(new PrivilegedAction() {
	public Object run() {
	    s.getClass().getProtectionDomain().implies
		(SecurityConstants.ALL_PERMISSION);
	    return null;
	}
    });
}

security = s;
InetAddressCachePolicy.setIfNotSet(InetAddressCachePolicy.FOREVER);
   }
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:32,代码来源:System.java

示例5: getPolicy

import sun.net.InetAddressCachePolicy; //导入依赖的package包/类
private int getPolicy() {
    if (type == Type.Positive) {
	return InetAddressCachePolicy.get();
    } else {
	return InetAddressCachePolicy.getNegative();
    }
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:8,代码来源:InetAddress.java

示例6: getDnsCachePolicy

import sun.net.InetAddressCachePolicy; //导入依赖的package包/类
public static int getDnsCachePolicy()
        throws NoSuchFieldException, IllegalAccessException {
    return InetAddressCachePolicy.get();
}
 
开发者ID:alibaba,项目名称:java-dns-cache-manipulator,代码行数:5,代码来源:InetAddressCacheUtil.java

示例7: getDnsNegativeCachePolicy

import sun.net.InetAddressCachePolicy; //导入依赖的package包/类
public static int getDnsNegativeCachePolicy()
        throws NoSuchFieldException, IllegalAccessException {
    return InetAddressCachePolicy.getNegative();
}
 
开发者ID:alibaba,项目名称:java-dns-cache-manipulator,代码行数:5,代码来源:InetAddressCacheUtil.java


注:本文中的sun.net.InetAddressCachePolicy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。