*/
public Object getInstance(ThreadContext callContext)
throws OpenEJBException {
CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
Data data = (Data) deploymentInfo.getContainerData();
Stack pool = data.getPool();
if(strictPooling){
boolean acquired;
try {
if(timeout.getTime() <= 0L){
data.getSemaphore().acquire();
acquired = true;
} else {
acquired = data.getSemaphore().tryAcquire(timeout.getTime(),timeout.getUnit());
}
} catch (InterruptedException e2) {
throw new OpenEJBException("Unexpected Interruption of current thread: ",e2);
}
if(!acquired){
throw new IllegalStateException("An invocation of the Stateless Session Bean "+deploymentInfo.getEjbName()+" has timed-out");
}
}
Object bean = pool.pop();
if (bean == null) {
Class beanClass = deploymentInfo.getBeanClass();
ObjectRecipe objectRecipe = new ObjectRecipe(beanClass);