private static <T> T newObject(final Class<T> klass) { return throwingSupplier(klass::newInstance).get(); }
@Override public void contextInitialized(final ServletContextEvent sce) { ServletContext ctx = sce.getServletContext(); String appClass = ctx.getInitParameter("application.class"); requireNonNull(appClass, "Context param NOT found: application.class"); Jooby.run(Throwing.throwingSupplier(() -> { Jooby app = (Jooby) ctx.getClassLoader().loadClass(appClass).newInstance(); ctx.setAttribute(Jooby.class.getName(), app); return app; }), "application.path=" + ctx.getContextPath(), "server.module=" + ServletModule.class.getName()); }
@Override public MemcachedClient get() { client = throwingSupplier(() -> { ConnectionFactory connectionFactory = builder.build(); this.builder = null; return new MemcachedClient(connectionFactory, servers); }).get(); return client; }
binder.bind(PluginContext.class).toProvider(throwingSupplier(ctx::get)::get);
@Override public void contextInitialized(final ServletContextEvent sce) { ServletContext ctx = sce.getServletContext(); String appClass = ctx.getInitParameter("application.class"); requireNonNull(appClass, "Context param NOT found: application.class"); Jooby.run(Throwing.throwingSupplier(() -> { Jooby app = (Jooby) ctx.getClassLoader().loadClass(appClass).newInstance(); ctx.setAttribute(Jooby.class.getName(), app); return app; }), "application.path=" + ctx.getContextPath(), "server.module=" + ServletModule.class.getName()); }
private static <T> T newObject(final Class<T> klass) { return throwingSupplier(klass::newInstance).get(); }
@Override public MemcachedClient get() { client = throwingSupplier(() -> { ConnectionFactory connectionFactory = builder.build(); this.builder = null; return new MemcachedClient(connectionFactory, servers); }).get(); return client; }