1616package feign ;
1717
1818
19- import dagger .Lazy ;
2019import dagger .ObjectGraph ;
2120import dagger .Provides ;
2221import feign .Logger .NoOpLogger ;
2322import feign .Request .Options ;
2423import feign .Target .HardCodedTarget ;
25- import feign .codec .Decoder ;
26- import feign .codec .Encoder ;
2724import feign .codec .ErrorDecoder ;
28- import feign .codec .IncrementalDecoder ;
2925
30- import javax .inject .Named ;
31- import javax .inject .Singleton ;
3226import javax .net .ssl .HostnameVerifier ;
3327import javax .net .ssl .HttpsURLConnection ;
3428import javax .net .ssl .SSLSocketFactory ;
35- import java .io .Closeable ;
3629import java .lang .reflect .Method ;
3730import java .util .ArrayList ;
38- import java .util .Collections ;
3931import java .util .List ;
40- import java .util .Set ;
41- import java .util .concurrent .Executor ;
42- import java .util .concurrent .ExecutorService ;
43- import java .util .concurrent .Executors ;
44- import java .util .concurrent .ThreadFactory ;
45-
46- import static java .lang .Thread .MIN_PRIORITY ;
4732
4833/**
4934 * Feign's purpose is to ease development against http apis that feign
5237 * In implementation, Feign is a {@link Feign#newInstance factory} for
5338 * generating {@link Target targeted} http apis.
5439 */
55- public abstract class Feign implements Closeable {
40+ public abstract class Feign {
5641
5742 /**
5843 * Returns a new instance of an HTTP API, defined by annotations in the
@@ -106,9 +91,8 @@ public static class Defaults {
10691 return SSLSocketFactory .class .cast (SSLSocketFactory .getDefault ());
10792 }
10893
109- @ Provides
110- HostnameVerifier hostnameVerifier () {
111- return HttpsURLConnection .getDefaultHostnameVerifier ();
94+ @ Provides HostnameVerifier hostnameVerifier () {
95+ return HttpsURLConnection .getDefaultHostnameVerifier ();
11296 }
11397
11498 @ Provides Client httpClient (Client .Default client ) {
@@ -130,22 +114,6 @@ HostnameVerifier hostnameVerifier() {
130114 @ Provides Options options () {
131115 return new Options ();
132116 }
133-
134- /**
135- * Used for both http invocation and decoding when observers are used.
136- */
137- @ Provides @ Singleton @ Named ("http" ) Executor httpExecutor () {
138- return Executors .newCachedThreadPool (new ThreadFactory () {
139- @ Override public Thread newThread (final Runnable r ) {
140- return new Thread (new Runnable () {
141- @ Override public void run () {
142- Thread .currentThread ().setPriority (MIN_PRIORITY );
143- r .run ();
144- }
145- }, MethodHandler .IDLE_THREAD_NAME );
146- }
147- });
148- }
149117 }
150118
151119 /**
@@ -188,17 +156,4 @@ private static List<Object> modulesForGraph(Object... modules) {
188156 modulesForGraph .add (module );
189157 return modulesForGraph ;
190158 }
191-
192- private final Lazy <Executor > httpExecutor ;
193-
194- Feign (Lazy <Executor > httpExecutor ) {
195- this .httpExecutor = httpExecutor ;
196- }
197-
198- @ Override public void close () {
199- Executor e = httpExecutor .get ();
200- if (e instanceof ExecutorService ) {
201- ExecutorService .class .cast (e ).shutdownNow ();
202- }
203- }
204159}
0 commit comments