public ServerContext attach(Container container) { try { return container.newInstance(DefaultServerContext.class); } catch (RuntimeException ex) { throw ex; } catch (Exception ex) { throw new RuntimeException(ex); } }
public T attach(Container container) { try { T t = container.newInstance(created); Map<Class<?>, Object> contextObjects = lookup.get(container); if (contextObjects == null) { contextObjects = new HashMap<Class<?>, Object>(); lookup.put(container, contextObjects); } contextObjects.put(created, t); return t; } catch (Exception ex) { log.warn("Failed to create an instance of " + created.getName()); throw new RuntimeException(ex); } }