| | |
| | | List<PrefixedDataAvailable> list = pool.get(className) ; |
| | | if(list == null){ |
| | | list = new ArrayList<>() ; |
| | | }else{ |
| | | pool.put(className, list) ; |
| | | }else if(list.size() > 0){ |
| | | obj = list.get(0) ; |
| | | list.remove(0) ; |
| | | } |
| | | |
| | | if(obj != null){ |
| | | list.remove(0) ; |
| | | return obj ; |
| | | }else{ |
| | | if(obj == null){ |
| | | try { |
| | | obj = (PrefixedDataAvailable)clazz.getDeclaredConstructor().newInstance() ; |
| | | //obj = (PrefixedDataAvailable)clazz.newInstance(); |
| | | } catch (Exception e) { |
| | | throw new Exception( "由" + className + "生成实例失败!"); |
| | | } |
| | | return obj ; |
| | | } |
| | | return obj ; |
| | | } |
| | | |
| | | /** |