copy into new array when returning from resolver
This commit is contained in:
parent
5be64de7be
commit
4930f22615
|
@ -106,14 +106,18 @@ public class Resolver {
|
||||||
threads[1].join();
|
threads[1].join();
|
||||||
if (results.size() > 0) {
|
if (results.size() > 0) {
|
||||||
threads[2].interrupt();
|
threads[2].interrupt();
|
||||||
Collections.sort(results);
|
synchronized (results) {
|
||||||
Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": " + results.toString());
|
Collections.sort(results);
|
||||||
return results;
|
Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": " + results.toString());
|
||||||
|
return new ArrayList<>(results);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
threads[2].join();
|
threads[2].join();
|
||||||
Collections.sort(fallbackResults);
|
synchronized (fallbackResults) {
|
||||||
Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": " + fallbackResults.toString());
|
Collections.sort(fallbackResults);
|
||||||
return fallbackResults;
|
Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": " + fallbackResults.toString());
|
||||||
|
return new ArrayList<>(fallbackResults);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
return results;
|
return results;
|
||||||
|
|
Loading…
Reference in a new issue