} else {
return m_proxyObject;
}
} else {
// Initialize the thread local object is not already touched.
Usage usage = (Usage) m_usage.get();
if (usage.m_stack == 0) { // uninitialized usage.
if (isAggregate()) {
if (m_collection) {
Collection svc = new ArrayList(refs.length); // Use an array list as collection implementation.
for (int i = 0; i < refs.length; i++) {
svc.add(getService(refs[i]));
}
usage.m_object = svc;
} else {
Object[] svc = (Object[]) Array.newInstance(getSpecification(),
refs.length);
for (int i = 0; i < svc.length; i++) {
svc[i] = getService(refs[i]);
}
usage.m_object = svc;
}
} else {
usage.m_object = getService(refs[0]);
}
usage.inc(); // Start the caching, so set the stack level to 1
m_usage.set(usage);
}
return usage.m_object;
}