/** * Implementation of abstract getTarget() method. * We look for a target held in a ThreadLocal. If we don't find one, * we create one and bind it to the thread. No synchronization is required. */ @Override public Object getTarget() throws BeansException { ++this.invocationCount; Object target = this.targetInThread.get(); if (target == null) { if (logger.isDebugEnabled()) { logger.debug("No target for prototype '" + getTargetBeanName() + "' bound to thread: " + "creating one and binding it to thread '" + Thread.currentThread().getName() + "'"); } // Associate target with ThreadLocal. target = newPrototypeInstance(); this.targetInThread.set(target); synchronized (this.targetSet) { this.targetSet.add(target); } } else { ++this.hitCount; } return target; }
/** * Implementation of abstract getTarget() method. * We look for a target held in a ThreadLocal. If we don't find one, * we create one and bind it to the thread. No synchronization is required. */ public Object getTarget() throws BeansException { ++this.invocationCount; Object target = this.targetInThread.get(); if (target == null) { if (logger.isDebugEnabled()) { logger.debug("No target for prototype '" + getTargetBeanName() + "' found in thread: " + "creating one and binding it to thread '" + Thread.currentThread().getName() + "'"); } // associate target with ThreadLocal target = newPrototypeInstance(); this.targetInThread.set(target); this.targetSet.add(target); } else { ++this.hitCount; } return target; }
/** * Implementation of abstract getTarget() method. * We look for a target held in a ThreadLocal. If we don't find one, * we create one and bind it to the thread. No synchronization is required. */ @Override public Object getTarget() throws BeansException { ++this.invocationCount; Object target = this.targetInThread.get(); if (target == null) { if (logger.isDebugEnabled()) { logger.debug("No target for prototype '" + getTargetBeanName() + "' bound to thread: " + "creating one and binding it to thread '" + Thread.currentThread().getName() + "'"); } // Associate target with ThreadLocal. target = newPrototypeInstance(); this.targetInThread.set(target); synchronized (this.targetSet) { this.targetSet.add(target); } } else { ++this.hitCount; } return target; }
/** * Implementation of abstract getTarget() method. * We look for a target held in a ThreadLocal. If we don't find one, * we create one and bind it to the thread. No synchronization is required. */ @Override public Object getTarget() throws BeansException { ++this.invocationCount; Object target = this.targetInThread.get(); if (target == null) { if (logger.isDebugEnabled()) { logger.debug("No target for prototype '" + getTargetBeanName() + "' bound to thread: " + "creating one and binding it to thread '" + Thread.currentThread().getName() + "'"); } // Associate target with ThreadLocal. target = newPrototypeInstance(); this.targetInThread.set(target); synchronized (this.targetSet) { this.targetSet.add(target); } } else { ++this.hitCount; } return target; }