add more logging and fix typo in Resolver.java

This commit is contained in:
Christian Schneppe 2020-02-08 21:35:42 +01:00
parent 56a0760fbb
commit d2e1e316fc
No known key found for this signature in database
GPG key ID: F30B8D686B44D87E

View file

@ -151,6 +151,7 @@ public class Resolver {
} }
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace();
for (Thread thread : threads) { for (Thread thread : threads) {
thread.interrupt(); thread.interrupt();
} }
@ -168,6 +169,7 @@ public class Resolver {
result.port = port; result.port = port;
return result; return result;
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
e.printStackTrace();
return null; return null;
} }
} }
@ -201,6 +203,7 @@ public class Resolver {
try { try {
thread.join(); thread.join();
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace();
return Collections.emptyList(); return Collections.emptyList();
} }
} }
@ -274,7 +277,7 @@ public class Resolver {
return result; return result;
} }
ExecutorService executor = (ExecutorService) Executors.newFixedThreadPool(4); ExecutorService executor = Executors.newFixedThreadPool(4);
try { try {
result = executor.invokeAny(r); result = executor.invokeAny(r);
@ -288,7 +291,9 @@ public class Resolver {
try { try {
if (executor.awaitTermination(5, TimeUnit.SECONDS)) break; if (executor.awaitTermination(5, TimeUnit.SECONDS)) break;
Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": happy eyeball wait for cleanup ..."); Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": happy eyeball wait for cleanup ...");
} catch (InterruptedException e) {} } catch (InterruptedException e) {
e.printStackTrace();
}
} }
Log.i(Config.LOGTAG, Resolver.class.getSimpleName() + ": happy eyeball cleanup"); Log.i(Config.LOGTAG, Resolver.class.getSimpleName() + ": happy eyeball cleanup");
for (Result re : r) { for (Result re : r) {
@ -391,7 +396,7 @@ public class Resolver {
public String toString() { public String toString() {
return "Result{" + return "Result{" +
"ip='" + (ip == null ? null : ip.getHostAddress()) + '\'' + "ip='" + (ip == null ? null : ip.getHostAddress()) + '\'' +
", hostame='" + (hostname == null ? null : hostname.toString()) + '\'' + ", hostname='" + (hostname == null ? null : hostname.toString()) + '\'' +
", port=" + port + ", port=" + port +
", directTls=" + directTls + ", directTls=" + directTls +
", authenticated=" + authenticated + ", authenticated=" + authenticated +
@ -411,6 +416,7 @@ public class Resolver {
time = System.currentTimeMillis() - time; time = System.currentTimeMillis() - time;
Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": Result connect: " + toString() + " after: " + time + " ms"); Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": Result connect: " + toString() + " after: " + time + " ms");
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace();
this.disconnect(); this.disconnect();
} }
} }