1.1 --- a/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdCache_1_3_1.java Fri Feb 15 01:49:36 2013 +0400 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,102 +0,0 @@ 1.4 -/* 1.5 - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. 1.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 - * 1.8 - * This code is free software; you can redistribute it and/or modify it 1.9 - * under the terms of the GNU General Public License version 2 only, as 1.10 - * published by the Free Software Foundation. Oracle designates this 1.11 - * particular file as subject to the "Classpath" exception as provided 1.12 - * by Oracle in the LICENSE file that accompanied this code. 1.13 - * 1.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 - * version 2 for more details (a copy is included in the LICENSE file that 1.18 - * accompanied this code). 1.19 - * 1.20 - * You should have received a copy of the GNU General Public License version 1.21 - * 2 along with this work; if not, write to the Free Software Foundation, 1.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 - * 1.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 - * or visit www.oracle.com if you need additional information or have any 1.26 - * questions. 1.27 - */ 1.28 - 1.29 -package com.sun.corba.se.impl.orbutil; 1.30 - 1.31 -import java.util.Stack; 1.32 -import java.util.Hashtable; 1.33 -import java.util.EmptyStackException; 1.34 -import java.util.Enumeration; 1.35 - 1.36 -// Really limited pool - in this case just creating several at a time... 1.37 -class RepositoryIdPool_1_3_1 extends Stack { 1.38 - 1.39 - private static int MAX_CACHE_SIZE = 4; 1.40 - private RepositoryIdCache_1_3_1 cache; 1.41 - 1.42 - public final synchronized RepositoryId_1_3_1 popId() { 1.43 - 1.44 - try { 1.45 - return (RepositoryId_1_3_1)super.pop(); 1.46 - } 1.47 - catch(EmptyStackException e) { 1.48 - increasePool(5); 1.49 - return (RepositoryId_1_3_1)super.pop(); 1.50 - } 1.51 - 1.52 - } 1.53 - 1.54 - // Pool management 1.55 - final void increasePool(int size) { 1.56 - //if (cache.size() <= MAX_CACHE_SIZE) 1.57 - for (int i = size; i > 0; i--) 1.58 - push(new RepositoryId_1_3_1()); 1.59 - /* 1.60 - // _REVISIT_ This will not work w/out either thread tracing or weak references. I am 1.61 - // betting that thread tracing almost completely negates benefit of reuse. Until either 1.62 - // 1.2 only inclusion or proof to the contrary, I'll leave it this way... 1.63 - else { 1.64 - int numToReclaim = cache.size() / 2; 1.65 - Enumeration keys = cache.keys(); 1.66 - Enumeration elements = cache.elements(); 1.67 - for (int i = numToReclaim; i > 0; i--) { 1.68 - Object key = keys.nextElement(); 1.69 - Object element = elements.nextElement(); 1.70 - 1.71 - push(element); 1.72 - cache.remove(key); 1.73 - } 1.74 - } 1.75 - */ 1.76 - } 1.77 - 1.78 - final void setCaches(RepositoryIdCache_1_3_1 cache) { 1.79 - this.cache = cache; 1.80 - } 1.81 - 1.82 -} 1.83 - 1.84 -public class RepositoryIdCache_1_3_1 extends Hashtable { 1.85 - 1.86 - private RepositoryIdPool_1_3_1 pool = new RepositoryIdPool_1_3_1(); 1.87 - 1.88 - public RepositoryIdCache_1_3_1() { 1.89 - pool.setCaches(this); 1.90 - } 1.91 - 1.92 - public final synchronized RepositoryId_1_3_1 getId(String key) { 1.93 - RepositoryId_1_3_1 repId = (RepositoryId_1_3_1)super.get(key); 1.94 - 1.95 - if (repId != null) 1.96 - return repId; 1.97 - else { 1.98 - //repId = pool.popId().init(key); 1.99 - repId = new RepositoryId_1_3_1(key); 1.100 - put(key, repId); 1.101 - return repId; 1.102 - } 1.103 - 1.104 - } 1.105 -}