com.hankcs.hanlp.utility.GlobalObjectPool Maven / Gradle / Ivy
/*
*
* Hankcs
* [email protected]
* 2016-09-07 AM11:49
*
*
* Copyright (c) 2008-2016, 码农场. All Right Reserved, http://www.hankcs.com/
* This source is subject to Hankcs. Please contact Hankcs to get more information.
*
*/
package com.hankcs.hanlp.utility;
import java.lang.ref.SoftReference;
import java.util.HashMap;
import java.util.Map;
/**
* 全局对象缓存池
* 用于储存那些体积庞当的模型,如果该模型已经被加载过一次,那么就不需要重新加载。同时,如果JVM内存不够,并且没有任何强引用时,允许垃圾
* 回收器回收这些模型。
*
* @author hankcs
*/
@SuppressWarnings("unchecked")
public class GlobalObjectPool
{
/**
* 缓存池
*/
private static Map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy