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


Java Krb5.KDC_DEFAULT_UDP_PREF_LIMIT属性代码示例

本文整理汇总了Java中sun.security.krb5.internal.Krb5.KDC_DEFAULT_UDP_PREF_LIMIT属性的典型用法代码示例。如果您正苦于以下问题:Java Krb5.KDC_DEFAULT_UDP_PREF_LIMIT属性的具体用法?Java Krb5.KDC_DEFAULT_UDP_PREF_LIMIT怎么用?Java Krb5.KDC_DEFAULT_UDP_PREF_LIMIT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在sun.security.krb5.internal.Krb5的用法示例。


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

示例1: initStatic

/**
 * Read global settings
 */
public static void initStatic() {
    String value = AccessController.doPrivileged(
    new PrivilegedAction<String>() {
        public String run() {
            return Security.getProperty(BAD_POLICY_KEY);
        }
    });
    if (value != null) {
        value = value.toLowerCase(Locale.ENGLISH);
        String[] ss = value.split(":");
        if ("tryless".equals(ss[0])) {
            if (ss.length > 1) {
                String[] params = ss[1].split(",");
                try {
                    int tmp0 = Integer.parseInt(params[0]);
                    if (params.length > 1) {
                        tryLessTimeout = Integer.parseInt(params[1]);
                    }
                    // Assign here in case of exception at params[1]
                    tryLessMaxRetries = tmp0;
                } catch (NumberFormatException nfe) {
                    // Ignored. Please note that tryLess is recognized and
                    // used, parameters using default values
                    if (DEBUG) {
                        System.out.println("Invalid " + BAD_POLICY_KEY +
                                " parameter for tryLess: " +
                                value + ", use default");
                    }
                }
            }
            badPolicy = BpType.TRY_LESS;
        } else if ("trylast".equals(ss[0])) {
            badPolicy = BpType.TRY_LAST;
        } else {
            badPolicy = BpType.NONE;
        }
    } else {
        badPolicy = BpType.NONE;
    }


    int timeout = -1;
    int max_retries = -1;
    int udp_pref_limit = -1;

    try {
        Config cfg = Config.getInstance();
        String temp = cfg.get("libdefaults", "kdc_timeout");
        timeout = parseTimeString(temp);

        temp = cfg.get("libdefaults", "max_retries");
        max_retries = parsePositiveIntString(temp);
        temp = cfg.get("libdefaults", "udp_preference_limit");
        udp_pref_limit = parsePositiveIntString(temp);
    } catch (Exception exc) {
       // ignore any exceptions; use default values
       if (DEBUG) {
            System.out.println ("Exception in getting KDC communication " +
                                "settings, using default value " +
                                exc.getMessage());
       }
    }
    defaultKdcTimeout = timeout > 0 ? timeout : 30*1000; // 30 seconds
    defaultKdcRetryLimit =
            max_retries > 0 ? max_retries : Krb5.KDC_RETRY_LIMIT;

    if (udp_pref_limit < 0) {
        defaultUdpPrefLimit = Krb5.KDC_DEFAULT_UDP_PREF_LIMIT;
    } else if (udp_pref_limit > Krb5.KDC_HARD_UDP_LIMIT) {
        defaultUdpPrefLimit = Krb5.KDC_HARD_UDP_LIMIT;
    } else {
        defaultUdpPrefLimit = udp_pref_limit;
    }

    KdcAccessibility.reset();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:79,代码来源:KdcComm.java

示例2: initStatic

/**
 * Read global settings
 */
public static void initStatic() {
    String value = AccessController.doPrivileged(
    new PrivilegedAction<String>() {
        public String run() {
            return Security.getProperty(BAD_POLICY_KEY);
        }
    });
    if (value != null) {
        value = value.toLowerCase(Locale.ENGLISH);
        String[] ss = value.split(":");
        if ("tryless".equals(ss[0])) {
            if (ss.length > 1) {
                String[] params = ss[1].split(",");
                try {
                    int tmp0 = Integer.parseInt(params[0]);
                    if (params.length > 1) {
                        tryLessTimeout = Integer.parseInt(params[1]);
                    }
                    // Assign here in case of exception at params[1]
                    tryLessMaxRetries = tmp0;
                } catch (NumberFormatException nfe) {
                    // Ignored. Please note that tryLess is recognized and
                    // used, parameters using default values
                    if (DEBUG) {
                        System.out.println("Invalid " + BAD_POLICY_KEY +
                                " parameter for tryLess: " +
                                value + ", use default");
                    }
                }
            }
            badPolicy = BpType.TRY_LESS;
        } else if ("trylast".equals(ss[0])) {
            badPolicy = BpType.TRY_LAST;
        } else {
            badPolicy = BpType.NONE;
        }
    } else {
        badPolicy = BpType.NONE;
    }


    int timeout = -1;
    int max_retries = -1;
    int udp_pref_limit = -1;

    try {
        Config cfg = Config.getInstance();
        String temp = cfg.get("libdefaults", "kdc_timeout");
        timeout = parsePositiveIntString(temp);
        temp = cfg.get("libdefaults", "max_retries");
        max_retries = parsePositiveIntString(temp);
        temp = cfg.get("libdefaults", "udp_preference_limit");
        udp_pref_limit = parsePositiveIntString(temp);
    } catch (Exception exc) {
       // ignore any exceptions; use default values
       if (DEBUG) {
            System.out.println ("Exception in getting KDC communication " +
                                "settings, using default value " +
                                exc.getMessage());
       }
    }
    defaultKdcTimeout = timeout > 0 ? timeout : 30*1000; // 30 seconds
    defaultKdcRetryLimit =
            max_retries > 0 ? max_retries : Krb5.KDC_RETRY_LIMIT;

    if (udp_pref_limit < 0) {
        defaultUdpPrefLimit = Krb5.KDC_DEFAULT_UDP_PREF_LIMIT;
    } else if (udp_pref_limit > Krb5.KDC_HARD_UDP_LIMIT) {
        defaultUdpPrefLimit = Krb5.KDC_HARD_UDP_LIMIT;
    } else {
        defaultUdpPrefLimit = udp_pref_limit;
    }

    KdcAccessibility.reset();
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:78,代码来源:KdcComm.java


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