1 17 18 package org.apache.tomcat.util.buf; 19 20 import java.io.Serializable ; 21 22 24 35 public final class TimeStamp implements Serializable { 36 private long creationTime = 0L; 37 private long lastAccessedTime = creationTime; 38 private long thisAccessedTime = creationTime; 39 private boolean isNew = true; 40 private long maxInactiveInterval = -1; 41 private boolean isValid = false; 42 MessageBytes name; 43 int id=-1; 44 45 Object parent; 46 47 public TimeStamp() { 48 } 49 50 52 57 public void touch(long time) { 58 this.lastAccessedTime = this.thisAccessedTime; 59 this.thisAccessedTime = time; 60 this.isNew=false; 61 } 62 63 65 69 public MessageBytes getName() { 70 if( name==null ) name=MessageBytes.newInstance(); return name; 72 } 73 74 77 public int getId() { 78 return id; 79 } 80 81 public void setId( int id ) { 82 this.id=id; 83 } 84 85 89 public void setParent( Object o ) { 90 parent=o; 91 } 92 93 public Object getParent() { 94 return parent; 95 } 96 97 public void setCreationTime(long time) { 98 this.creationTime = time; 99 this.lastAccessedTime = time; 100 this.thisAccessedTime = time; 101 } 102 103 104 public long getLastAccessedTime() { 105 return lastAccessedTime; 106 } 107 108 public long getThisAccessedTime() { 109 return thisAccessedTime; 110 } 111 112 115 public long getMaxInactiveInterval() { 116 return maxInactiveInterval; 117 } 118 119 public void setMaxInactiveInterval(long interval) { 120 maxInactiveInterval = interval; 121 } 122 123 public boolean isValid() { 124 return isValid; 125 } 126 127 public void setValid(boolean isValid) { 128 this.isValid = isValid; 129 } 130 131 public boolean isNew() { 132 return isNew; 133 } 134 135 public void setNew(boolean isNew) { 136 this.isNew = isNew; 137 } 138 139 public long getCreationTime() { 140 return creationTime; 141 } 142 143 145 public void recycle() { 146 creationTime = 0L; 147 lastAccessedTime = 0L; 148 maxInactiveInterval = -1; 149 isNew = true; 150 isValid = false; 151 id=-1; 152 if( name!=null) name.recycle(); 153 } 154 155 } 156 157 | Popular Tags |