* The ID of the object
* @param object
* The object to store
+ * @return The real object, or the shell if there is no real object yet
*/
@SuppressWarnings("unchecked")
public T put(String id, T object) {
*/
public T get(String id) {
if (!objectCache.containsKey(id)) {
- Shell<T> shell = shellCreator.createShell(id);
- shellCache.put(id, shell);
- return shell.getShelled();
+ if (!shellCache.containsKey(id)) {
+ Shell<T> shell = shellCreator.createShell(id);
+ shellCache.put(id, shell);
+ }
+ return shellCache.get(id).getShelled();
}
return objectCache.get(id);
}