1 24 25 package org.objectweb.cjdbc.controller.cache.result.entries; 26 27 import java.util.Date ; 28 29 import org.objectweb.cjdbc.common.sql.SelectRequest; 30 import org.objectweb.cjdbc.controller.cache.result.AbstractResultCache; 31 import org.objectweb.cjdbc.controller.virtualdatabase.ControllerResultSet; 32 33 40 public class ResultCacheEntryEager extends AbstractResultCacheEntry 41 { 42 private AbstractResultCache cache; 43 private long timeout; 44 private long deadline; 45 46 54 public ResultCacheEntryEager(AbstractResultCache cache, 55 SelectRequest request, ControllerResultSet result, long timeout) 56 { 57 super(request, result); 58 this.cache = cache; 59 if (timeout > 0) 60 this.deadline = System.currentTimeMillis() + timeout; 61 else 62 this.deadline = NO_DEADLINE; 63 } 64 65 68 public void invalidate() 69 { 70 state = CACHE_INVALID; 71 if (cache != null) 72 cache.removeFromCache(request); 73 if (result != null) 74 result = null; 75 cache = null; 76 } 77 78 81 public String getType() 82 { 83 return "Eager"; 84 } 85 86 89 public String [] toStringTable() 90 { 91 return new String []{request.getSQL(), getType(), getState(), 92 new Date (getDeadline()).toString(), "" + getSizeOfResult()}; 93 } 94 95 100 public long getDeadline() 101 { 102 return deadline; 103 } 104 105 110 public long getTimeout() 111 { 112 return timeout; 113 } 114 } | Popular Tags |