1 88 89 package org.openejb.server.ejbd; 90 91 92 93 import org.openejb.DeploymentInfo; 94 95 import org.openejb.client.EJBRequest; 96 97 import org.openejb.util.FastThreadLocal; 98 99 100 101 104 public class CallContext { 105 106 107 108 113 114 protected static final FastThreadLocal threads = new FastThreadLocal(); 115 116 117 118 123 124 protected DeploymentInfo deploymentInfo; 125 126 127 128 133 134 protected EJBRequest request; 135 136 137 138 143 144 public CallContext(){ 145 146 } 147 148 149 150 155 156 public void reset() { 157 158 deploymentInfo = null; 159 160 request = null; 161 162 } 163 164 165 166 175 176 public DeploymentInfo getDeploymentInfo() { 177 178 return deploymentInfo; 179 180 } 181 182 183 184 193 194 public void setDeploymentInfo(DeploymentInfo info) { 195 196 deploymentInfo = info; 197 198 } 199 200 201 202 211 212 public EJBRequest getEJBRequest(){ 213 214 return request; 215 216 } 217 218 219 220 229 230 public void setEJBRequest(EJBRequest request){ 231 232 this.request = request; 233 234 } 235 236 237 238 249 250 public static void setCallContext(CallContext ctx) { 251 252 if ( ctx == null ) { 253 254 ctx = (CallContext)threads.get(); 255 256 if ( ctx != null ) ctx.reset(); 257 258 } else { 259 260 threads.set( ctx ); 261 262 } 263 264 } 265 266 267 268 277 278 public static CallContext getCallContext( ) { 279 280 CallContext ctx = (CallContext)threads.get(); 281 282 if ( ctx == null ) { 283 284 ctx = new CallContext(); 285 286 threads.set( ctx ); 287 288 } 289 290 return ctx; 291 292 } 293 294 } 295 296 297 298 299 | Popular Tags |