1 package org.shiftone.cache.decorator.miss; 2 3 4 5 import org.shiftone.cache.util.Log; 6 7 8 12 public class TestMissHandler implements MissHandler 13 { 14 15 private static final Log LOG = new Log(TestMissHandler.class); 16 private int inFetchObjectCount = 0; 17 18 public TestMissHandler() 19 { 20 LOG.info("new"); 21 } 22 23 24 public Object fetchObject(Object key) 25 { 26 27 synchronized (this) 28 { 29 LOG.info("begin fetchObject"); 30 31 inFetchObjectCount++; 32 } 33 34 try 35 { 36 Thread.sleep(1000); 37 } 38 catch (Exception e) {} 39 40 synchronized (this) 41 { 42 LOG.info("end fetchObject"); 43 44 inFetchObjectCount--; 45 } 46 47 return "value for : " + key; 48 } 49 } 50 | Popular Tags |