use of javax.inject.Singleton in project dobby-android by InceptAi.
the class ProdModule method providesDobbyAi.
@Singleton
@Provides
public DobbyAi providesDobbyAi(DobbyApplication application, DobbyThreadpool threadpool, InferenceDatabaseWriter inferenceDatabaseWriter, FailureDatabaseWriter failureDatabaseWriter) {
DobbyAi dobbyAi = new DobbyAi(threadpool, inferenceDatabaseWriter, failureDatabaseWriter, application);
application.getProdComponent().inject(dobbyAi);
return dobbyAi;
}
use of javax.inject.Singleton in project coins-android by bubelov.
the class MainModule method httpClient.
@Provides
@Singleton
OkHttpClient httpClient() {
OkHttpClient.Builder httpClientBuilder = new OkHttpClient.Builder().connectTimeout(10, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).writeTimeout(30, TimeUnit.SECONDS);
if (BuildConfig.DEBUG) {
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS);
httpClientBuilder.addInterceptor(loggingInterceptor);
httpClientBuilder.addNetworkInterceptor(new StethoInterceptor());
}
return httpClientBuilder.build();
}
use of javax.inject.Singleton in project webpieces by deanhiller.
the class AbstractLoader method loadRouteImpl.
protected void loadRouteImpl(RouteMeta meta, ResolvedMethod method) {
String controllerStr = method.getControllerStr();
String methodStr = method.getMethodStr();
Injector injector = meta.getInjector();
Object controllerInst = createController(injector, controllerStr);
Singleton singleton = controllerInst.getClass().getAnnotation(Singleton.class);
if (singleton == null)
throw new IllegalArgumentException("EVERY controller must be marked with @javax.inject.Singleton not @com.google.inject.Singleton. bad controller=" + controllerInst.getClass().getName());
loader.loadInstIntoMeta(meta, controllerInst, methodStr);
}
use of javax.inject.Singleton in project webpieces by deanhiller.
the class WebServerModule method providesAsyncServerMgr.
@Provides
@Singleton
public HttpFrontendManager providesAsyncServerMgr(ChannelManager chanMgr, ScheduledExecutorService timer, @Named(HttpFrontendFactory.HTTP2_ENGINE_THREAD_POOL) Executor executor1, BufferPool pool, Time time, WebServerConfig config) {
HttpParser httpParser = HttpParserFactory.createParser(pool);
HpackParser http2Parser = HpackParserFactory.createParser(pool, true);
InjectionConfig injConfig = new InjectionConfig(http2Parser, time, config.getHttp2Config());
return HttpFrontendFactory.createFrontEnd(chanMgr, timer, injConfig, httpParser);
}
use of javax.inject.Singleton in project bugzy by cpunq.
the class NetModule method provideFogBugzService.
@Provides
@Singleton
FogbugzApiService provideFogBugzService(Application application, PrefsHelper prefsHelper, Gson gson) {
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
Retrofit.Builder builder = new Retrofit.Builder().baseUrl(mBaseUrl).addCallAdapterFactory(new LiveDataCallAdapterFactory(gson)).addConverterFactory(GsonConverterFactory.create(gson));
Retrofit retrofit = builder.client(httpClient.addInterceptor(new ConnectivityInterceptor(application.getApplicationContext())).addInterceptor(new RequestInterceptor(prefsHelper)).build()).build();
return retrofit.create(FogbugzApiService.class);
}
Aggregations