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.virtualdatabase.ControllerResultSet; 31 32 39 public class ResultCacheEntryRelaxed extends AbstractResultCacheEntry 40 { 41 private long timeout; 42 private long deadline; 43 private boolean keepIfNotDirty; 44 45 54 public ResultCacheEntryRelaxed(SelectRequest request, 55 ControllerResultSet result, long timeout, boolean keepIfNotDirty) 56 { 57 super(request, result); 58 this.timeout = timeout; 59 this.deadline = System.currentTimeMillis() + timeout; 60 this.keepIfNotDirty = keepIfNotDirty; 61 } 62 63 66 public void invalidate() 67 { 68 state = CACHE_DIRTY; 69 } 70 71 74 public String getType() 75 { 76 return "Relaxed"; 77 } 78 79 84 public long getDeadline() 85 { 86 return deadline; 87 } 88 89 94 public void setDeadline(long deadline) 95 { 96 this.deadline = deadline; 97 } 98 99 104 public long getTimeout() 105 { 106 return timeout; 107 } 108 109 112 public String [] toStringTable() 113 { 114 return new String []{request.getSQL(), getType(), getState(), 115 new Date (getDeadline()).toString(), "" + getSizeOfResult()}; 116 } 117 118 124 public boolean getKeepIfNotDirty() 125 { 126 return keepIfNotDirty; 127 } 128 129 } | Popular Tags |