Java Code Examples for sun.security.util.Cache#newSoftMemoryCache()

The following examples show how to use sun.security.util.Cache#newSoftMemoryCache() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SSLSessionContextImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
SSLSessionContextImpl() {
    cacheLimit = getDefaultCacheLimit();    // default cache size
    timeout = 86400;                        // default, 24 hours

    // use soft reference
    sessionCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
    sessionHostPortCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
}
 
Example 2
Source File: LDAPCertStore.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>CertStore</code> with the specified parameters.
 * For this class, the parameters object must be an instance of
 * <code>LDAPCertStoreParameters</code>.
 *
 * @param params the algorithm parameters
 * @exception InvalidAlgorithmParameterException if params is not an
 *   instance of <code>LDAPCertStoreParameters</code>
 */
public LDAPCertStore(CertStoreParameters params)
        throws InvalidAlgorithmParameterException {
    super(params);
    if (!(params instanceof LDAPCertStoreParameters))
      throw new InvalidAlgorithmParameterException(
        "parameters must be LDAPCertStoreParameters");

    LDAPCertStoreParameters lparams = (LDAPCertStoreParameters) params;

    // Create InitialDirContext needed to communicate with the server
    createInitialDirContext(lparams.getServerName(), lparams.getPort());

    // Create CertificateFactory for use later on
    try {
        cf = CertificateFactory.getInstance("X.509");
    } catch (CertificateException e) {
        throw new InvalidAlgorithmParameterException(
            "unable to create CertificateFactory for X.509");
    }
    if (LIFETIME == 0) {
        valueCache = Cache.newNullCache();
    } else if (LIFETIME < 0) {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE);
    } else {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE, LIFETIME);
    }
}
 
Example 3
Source File: LDAPCertStore.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>CertStore</code> with the specified parameters.
 * For this class, the parameters object must be an instance of
 * <code>LDAPCertStoreParameters</code>.
 *
 * @param params the algorithm parameters
 * @exception InvalidAlgorithmParameterException if params is not an
 *   instance of <code>LDAPCertStoreParameters</code>
 */
public LDAPCertStore(CertStoreParameters params)
        throws InvalidAlgorithmParameterException {
    super(params);
    if (!(params instanceof LDAPCertStoreParameters))
      throw new InvalidAlgorithmParameterException(
        "parameters must be LDAPCertStoreParameters");

    LDAPCertStoreParameters lparams = (LDAPCertStoreParameters) params;

    // Create InitialDirContext needed to communicate with the server
    createInitialDirContext(lparams.getServerName(), lparams.getPort());

    // Create CertificateFactory for use later on
    try {
        cf = CertificateFactory.getInstance("X.509");
    } catch (CertificateException e) {
        throw new InvalidAlgorithmParameterException(
            "unable to create CertificateFactory for X.509");
    }
    if (LIFETIME == 0) {
        valueCache = Cache.newNullCache();
    } else if (LIFETIME < 0) {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE);
    } else {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE, LIFETIME);
    }
}
 
Example 4
Source File: SSLSessionContextImpl.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
SSLSessionContextImpl() {
    cacheLimit = getDefaultCacheLimit();    // default cache size
    timeout = 86400;                        // default, 24 hours

    // use soft reference
    sessionCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
    sessionHostPortCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
}
 
Example 5
Source File: LDAPCertStore.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>CertStore</code> with the specified parameters.
 * For this class, the parameters object must be an instance of
 * <code>LDAPCertStoreParameters</code>.
 *
 * @param params the algorithm parameters
 * @exception InvalidAlgorithmParameterException if params is not an
 *   instance of <code>LDAPCertStoreParameters</code>
 */
public LDAPCertStore(CertStoreParameters params)
        throws InvalidAlgorithmParameterException {
    super(params);
    if (!(params instanceof LDAPCertStoreParameters))
      throw new InvalidAlgorithmParameterException(
        "parameters must be LDAPCertStoreParameters");

    LDAPCertStoreParameters lparams = (LDAPCertStoreParameters) params;

    // Create InitialDirContext needed to communicate with the server
    createInitialDirContext(lparams.getServerName(), lparams.getPort());

    // Create CertificateFactory for use later on
    try {
        cf = CertificateFactory.getInstance("X.509");
    } catch (CertificateException e) {
        throw new InvalidAlgorithmParameterException(
            "unable to create CertificateFactory for X.509");
    }
    if (LIFETIME == 0) {
        valueCache = Cache.newNullCache();
    } else if (LIFETIME < 0) {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE);
    } else {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE, LIFETIME);
    }
}
 
Example 6
Source File: LDAPCertStore.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>CertStore</code> with the specified parameters.
 * For this class, the parameters object must be an instance of
 * <code>LDAPCertStoreParameters</code>.
 *
 * @param params the algorithm parameters
 * @exception InvalidAlgorithmParameterException if params is not an
 *   instance of <code>LDAPCertStoreParameters</code>
 */
public LDAPCertStore(CertStoreParameters params)
        throws InvalidAlgorithmParameterException {
    super(params);
    if (!(params instanceof LDAPCertStoreParameters))
      throw new InvalidAlgorithmParameterException(
        "parameters must be LDAPCertStoreParameters");

    LDAPCertStoreParameters lparams = (LDAPCertStoreParameters) params;

    // Create InitialDirContext needed to communicate with the server
    createInitialDirContext(lparams.getServerName(), lparams.getPort());

    // Create CertificateFactory for use later on
    try {
        cf = CertificateFactory.getInstance("X.509");
    } catch (CertificateException e) {
        throw new InvalidAlgorithmParameterException(
            "unable to create CertificateFactory for X.509");
    }
    if (LIFETIME == 0) {
        valueCache = Cache.newNullCache();
    } else if (LIFETIME < 0) {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE);
    } else {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE, LIFETIME);
    }
}
 
Example 7
Source File: SSLSessionContextImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
SSLSessionContextImpl() {
    cacheLimit = getDefaultCacheLimit();    // default cache size
    timeout = 86400;                        // default, 24 hours

    // use soft reference
    sessionCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
    sessionHostPortCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
}
 
Example 8
Source File: SSLSessionContextImpl.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
SSLSessionContextImpl() {
    cacheLimit = getDefaultCacheLimit();    // default cache size
    timeout = 86400;                        // default, 24 hours

    // use soft reference
    sessionCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
    sessionHostPortCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
}
 
Example 9
Source File: LDAPCertStore.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>CertStore</code> with the specified parameters.
 * For this class, the parameters object must be an instance of
 * <code>LDAPCertStoreParameters</code>.
 *
 * @param params the algorithm parameters
 * @exception InvalidAlgorithmParameterException if params is not an
 *   instance of <code>LDAPCertStoreParameters</code>
 */
public LDAPCertStore(CertStoreParameters params)
        throws InvalidAlgorithmParameterException {
    super(params);
    if (!(params instanceof LDAPCertStoreParameters))
      throw new InvalidAlgorithmParameterException(
        "parameters must be LDAPCertStoreParameters");

    LDAPCertStoreParameters lparams = (LDAPCertStoreParameters) params;

    // Create InitialDirContext needed to communicate with the server
    createInitialDirContext(lparams.getServerName(), lparams.getPort());

    // Create CertificateFactory for use later on
    try {
        cf = CertificateFactory.getInstance("X.509");
    } catch (CertificateException e) {
        throw new InvalidAlgorithmParameterException(
            "unable to create CertificateFactory for X.509");
    }
    if (LIFETIME == 0) {
        valueCache = Cache.newNullCache();
    } else if (LIFETIME < 0) {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE);
    } else {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE, LIFETIME);
    }
}
 
Example 10
Source File: SSLSessionContextImpl.java    From openjsse with GNU General Public License v2.0 5 votes vote down vote up
SSLSessionContextImpl() {
    cacheLimit = getDefaultCacheLimit();    // default cache size
    timeout = 86400;                        // default, 24 hours

    // use soft reference
    sessionCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
    sessionHostPortCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
}
 
Example 11
Source File: LDAPCertStore.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>CertStore</code> with the specified parameters.
 * For this class, the parameters object must be an instance of
 * <code>LDAPCertStoreParameters</code>.
 *
 * @param params the algorithm parameters
 * @exception InvalidAlgorithmParameterException if params is not an
 *   instance of <code>LDAPCertStoreParameters</code>
 */
public LDAPCertStore(CertStoreParameters params)
        throws InvalidAlgorithmParameterException {
    super(params);
    if (!(params instanceof LDAPCertStoreParameters))
      throw new InvalidAlgorithmParameterException(
        "parameters must be LDAPCertStoreParameters");

    LDAPCertStoreParameters lparams = (LDAPCertStoreParameters) params;

    // Create InitialDirContext needed to communicate with the server
    createInitialDirContext(lparams.getServerName(), lparams.getPort());

    // Create CertificateFactory for use later on
    try {
        cf = CertificateFactory.getInstance("X.509");
    } catch (CertificateException e) {
        throw new InvalidAlgorithmParameterException(
            "unable to create CertificateFactory for X.509");
    }
    if (LIFETIME == 0) {
        valueCache = Cache.newNullCache();
    } else if (LIFETIME < 0) {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE);
    } else {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE, LIFETIME);
    }
}
 
Example 12
Source File: SSLSessionContextImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
SSLSessionContextImpl() {
    cacheLimit = getDefaultCacheLimit();    // default cache size
    timeout = 86400;                        // default, 24 hours

    // use soft reference
    sessionCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
    sessionHostPortCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
}
 
Example 13
Source File: LDAPCertStore.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>CertStore</code> with the specified parameters.
 * For this class, the parameters object must be an instance of
 * <code>LDAPCertStoreParameters</code>.
 *
 * @param params the algorithm parameters
 * @exception InvalidAlgorithmParameterException if params is not an
 *   instance of <code>LDAPCertStoreParameters</code>
 */
public LDAPCertStore(CertStoreParameters params)
        throws InvalidAlgorithmParameterException {
    super(params);
    if (!(params instanceof LDAPCertStoreParameters))
      throw new InvalidAlgorithmParameterException(
        "parameters must be LDAPCertStoreParameters");

    LDAPCertStoreParameters lparams = (LDAPCertStoreParameters) params;

    // Create InitialDirContext needed to communicate with the server
    createInitialDirContext(lparams.getServerName(), lparams.getPort());

    // Create CertificateFactory for use later on
    try {
        cf = CertificateFactory.getInstance("X.509");
    } catch (CertificateException e) {
        throw new InvalidAlgorithmParameterException(
            "unable to create CertificateFactory for X.509");
    }
    if (LIFETIME == 0) {
        valueCache = Cache.newNullCache();
    } else if (LIFETIME < 0) {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE);
    } else {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE, LIFETIME);
    }
}
 
Example 14
Source File: SSLSessionContextImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
SSLSessionContextImpl() {
    cacheLimit = getDefaultCacheLimit();    // default cache size
    timeout = 86400;                        // default, 24 hours

    // use soft reference
    sessionCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
    sessionHostPortCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
}
 
Example 15
Source File: LDAPCertStore.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>CertStore</code> with the specified parameters.
 * For this class, the parameters object must be an instance of
 * <code>LDAPCertStoreParameters</code>.
 *
 * @param params the algorithm parameters
 * @exception InvalidAlgorithmParameterException if params is not an
 *   instance of <code>LDAPCertStoreParameters</code>
 */
public LDAPCertStore(CertStoreParameters params)
        throws InvalidAlgorithmParameterException {
    super(params);
    if (!(params instanceof LDAPCertStoreParameters))
      throw new InvalidAlgorithmParameterException(
        "parameters must be LDAPCertStoreParameters");

    LDAPCertStoreParameters lparams = (LDAPCertStoreParameters) params;

    // Create InitialDirContext needed to communicate with the server
    createInitialDirContext(lparams.getServerName(), lparams.getPort());

    // Create CertificateFactory for use later on
    try {
        cf = CertificateFactory.getInstance("X.509");
    } catch (CertificateException e) {
        throw new InvalidAlgorithmParameterException(
            "unable to create CertificateFactory for X.509");
    }
    if (LIFETIME == 0) {
        valueCache = Cache.newNullCache();
    } else if (LIFETIME < 0) {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE);
    } else {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE, LIFETIME);
    }
}
 
Example 16
Source File: SSLSessionContextImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
SSLSessionContextImpl() {
    cacheLimit = getDefaultCacheLimit();    // default cache size
    timeout = 86400;                        // default, 24 hours

    // use soft reference
    sessionCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
    sessionHostPortCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
}
 
Example 17
Source File: LDAPCertStore.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>CertStore</code> with the specified parameters.
 * For this class, the parameters object must be an instance of
 * <code>LDAPCertStoreParameters</code>.
 *
 * @param params the algorithm parameters
 * @exception InvalidAlgorithmParameterException if params is not an
 *   instance of <code>LDAPCertStoreParameters</code>
 */
public LDAPCertStore(CertStoreParameters params)
        throws InvalidAlgorithmParameterException {
    super(params);
    if (!(params instanceof LDAPCertStoreParameters))
      throw new InvalidAlgorithmParameterException(
        "parameters must be LDAPCertStoreParameters");

    LDAPCertStoreParameters lparams = (LDAPCertStoreParameters) params;

    // Create InitialDirContext needed to communicate with the server
    createInitialDirContext(lparams.getServerName(), lparams.getPort());

    // Create CertificateFactory for use later on
    try {
        cf = CertificateFactory.getInstance("X.509");
    } catch (CertificateException e) {
        throw new InvalidAlgorithmParameterException(
            "unable to create CertificateFactory for X.509");
    }
    if (LIFETIME == 0) {
        valueCache = Cache.newNullCache();
    } else if (LIFETIME < 0) {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE);
    } else {
        valueCache = Cache.newSoftMemoryCache(DEFAULT_CACHE_SIZE, LIFETIME);
    }
}
 
Example 18
Source File: SSLSessionContextImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
SSLSessionContextImpl() {
    cacheLimit = getDefaultCacheLimit();    // default cache size
    timeout = 86400;                        // default, 24 hours

    // use soft reference
    sessionCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
    sessionHostPortCache = Cache.newSoftMemoryCache(cacheLimit, timeout);
}
 
Example 19
Source File: StatusResponseManager.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Create a StatusResponseManager with default parameters.
 */
StatusResponseManager() {
    int cap = AccessController.doPrivileged(
            new GetIntegerAction("jdk.tls.stapling.cacheSize",
                DEFAULT_CACHE_SIZE));
    cacheCapacity = cap > 0 ? cap : 0;

    int life = AccessController.doPrivileged(
            new GetIntegerAction("jdk.tls.stapling.cacheLifetime",
                DEFAULT_CACHE_LIFETIME));
    cacheLifetime = life > 0 ? life : 0;

    String uriStr = GetPropertyAction
            .privilegedGetProperty("jdk.tls.stapling.responderURI");
    URI tmpURI;
    try {
        tmpURI = ((uriStr != null && !uriStr.isEmpty()) ?
                new URI(uriStr) : null);
    } catch (URISyntaxException urise) {
        tmpURI = null;
    }
    defaultResponder = tmpURI;

    respOverride = GetBooleanAction
            .privilegedGetProperty("jdk.tls.stapling.responderOverride");
    ignoreExtensions = GetBooleanAction
            .privilegedGetProperty("jdk.tls.stapling.ignoreExtensions");

    threadMgr = new ScheduledThreadPoolExecutor(DEFAULT_CORE_THREADS,
            new ThreadFactory() {
        @Override
        public Thread newThread(Runnable r) {
            Thread t = Executors.defaultThreadFactory().newThread(r);
            t.setDaemon(true);
            return t;
        }
    }, new ThreadPoolExecutor.DiscardPolicy());
    threadMgr.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
    threadMgr.setContinueExistingPeriodicTasksAfterShutdownPolicy(
            false);
    threadMgr.setKeepAliveTime(5000, TimeUnit.MILLISECONDS);
    threadMgr.allowCoreThreadTimeOut(true);
    responseCache = Cache.newSoftMemoryCache(
            cacheCapacity, cacheLifetime);
}
 
Example 20
Source File: StatusResponseManager.java    From openjsse with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a StatusResponseManager with default parameters.
 */
StatusResponseManager() {
    int cap = AccessController.doPrivileged(
            new GetIntegerAction("jdk.tls.stapling.cacheSize",
                DEFAULT_CACHE_SIZE));
    cacheCapacity = cap > 0 ? cap : 0;

    int life = AccessController.doPrivileged(
            new GetIntegerAction("jdk.tls.stapling.cacheLifetime",
                DEFAULT_CACHE_LIFETIME));
    cacheLifetime = life > 0 ? life : 0;

    String uriStr = GetPropertyAction
            .privilegedGetProperty("jdk.tls.stapling.responderURI");
    URI tmpURI;
    try {
        tmpURI = ((uriStr != null && !uriStr.isEmpty()) ?
                new URI(uriStr) : null);
    } catch (URISyntaxException urise) {
        tmpURI = null;
    }
    defaultResponder = tmpURI;

    respOverride = AccessController.doPrivileged(
            new GetBooleanAction("jdk.tls.stapling.responderOverride"));
    ignoreExtensions = AccessController.doPrivileged(
            new GetBooleanAction("jdk.tls.stapling.ignoreExtensions"));

    threadMgr = new ScheduledThreadPoolExecutor(DEFAULT_CORE_THREADS,
            new ThreadFactory() {
        @Override
        public Thread newThread(Runnable r) {
            Thread t = Executors.defaultThreadFactory().newThread(r);
            t.setDaemon(true);
            return t;
        }
    }, new ThreadPoolExecutor.DiscardPolicy());
    threadMgr.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
    threadMgr.setContinueExistingPeriodicTasksAfterShutdownPolicy(
            false);
    threadMgr.setKeepAliveTime(5000, TimeUnit.MILLISECONDS);
    threadMgr.allowCoreThreadTimeOut(true);
    responseCache = Cache.newSoftMemoryCache(
            cacheCapacity, cacheLifetime);
}