1 11 package org.eclipse.jdt.internal.core; 12 13 import java.text.NumberFormat ; 14 import java.util.Date ; 15 16 public class VerboseElementCache extends ElementCache { 17 18 private Object beingAdded; 19 private String name; 20 21 public VerboseElementCache(int size, String name) { 22 super(size); 23 this.name = name; 24 } 25 26 protected boolean makeSpace(int space) { 27 if (this.beingAdded == null) return super.makeSpace(space); 28 String fillingRatio = toStringFillingRation(this.name); 29 boolean result = super.makeSpace(space); 30 String newFillingRatio = toStringFillingRation(this.name); 31 if (!fillingRatio.equals(newFillingRatio)) { 32 System.out.println(Thread.currentThread() + " " + new Date (System.currentTimeMillis()).toString()); System.out.println(Thread.currentThread() + " MADE SPACE FOR " + fillingRatio + " (NOW " + NumberFormat.getInstance().format(fillingRatio()) + "% full)"); System.out.println(Thread.currentThread() + " WHILE OPENING "+ ((JavaElement) this.beingAdded).toStringWithAncestors()); System.out.println(); 36 } 37 return result; 38 } 39 40 public Object put(Object key, Object value) { 41 try { 42 if (this.beingAdded == null) 43 this.beingAdded = key; 44 return super.put(key, value); 45 } finally { 46 if (key.equals(this.beingAdded)) 47 this.beingAdded = null; 48 } 49 } 50 51 } 52 | Popular Tags |