1 55 56 package org.jboss.axis.session; 57 58 import java.util.Enumeration ; 59 import java.util.Hashtable ; 60 61 66 public class SimpleSession implements Session 67 { 68 private Hashtable rep = null; 69 70 74 private int timeout = -1; 75 private long lastTouched; 76 77 80 public SimpleSession() 81 { 82 lastTouched = System.currentTimeMillis(); 83 } 84 85 90 public Object get(String key) 91 { 92 if (rep == null) 93 return null; 94 lastTouched = System.currentTimeMillis(); 95 return rep.get(key); 96 } 97 98 104 public void set(String key, Object value) 105 { 106 synchronized (this) 107 { 108 if (rep == null) 109 rep = new Hashtable (); 110 } 111 lastTouched = System.currentTimeMillis(); 112 rep.put(key, value); 113 } 114 115 120 public void remove(String key) 121 { 122 if (rep != null) 123 rep.remove(key); 124 lastTouched = System.currentTimeMillis(); 125 } 126 127 130 public Enumeration getKeys() 131 { 132 if (rep != null) 133 return rep.keys(); 134 return null; 135 } 136 137 144 public void setTimeout(int timeout) 145 { 146 this.timeout = timeout; 147 } 148 149 public int getTimeout() 150 { 151 return timeout; 152 } 153 154 157 public void touch() 158 { 159 lastTouched = System.currentTimeMillis(); 160 } 161 162 public long getLastAccessTime() 163 { 164 return lastTouched; 165 } 166 167 175 public synchronized Object getLockObject() 176 { 177 if (rep == null) 178 { 179 rep = new Hashtable (); 180 } 181 return rep; 182 } 183 } 184 | Popular Tags |