@@ -0,0 +1,1136 @@
+// Copyright (c) 1999 Brian Wellington (bwelling@xbill.org)%0A// Portions Copyright (c) 1999 Network Associates, Inc.%0A%0Apackage org.xbill.DNS;%0A%0Aimport java.util.*;%0Aimport java.io.*;%0Aimport java.net.*;%0Aimport org.xbill.Task.*;%0A%0A/**%0A * A special-purpose thread used by Resolvers (both SimpleResolver and%0A * ExtendedResolver) to perform asynchronous queries.  Once started, a%0A * WorkerThread never exits.  After completing a task, it blocks until%0A * another task is assigned.%0A */%0A%0Aclass ResolveThread implements Runnable %7B%0A%0Aprivate Message query;%0Aprivate int id;%0Aprivate ResolverListener listener;%0Aprivate Resolver res;%0A%0Aprivate static int nactive = 0;%0Aprivate static Vector list = new Vector();%0Aprivate static final int max = 10;%0Aprivate static final long lifetime = 900 * 1000;%0A%0A/** Creates a new ResolveThread */%0Apublic%0AResolveThread(Resolver _res, Message _query, int _id,%0A%09      ResolverListener _listener)%0A%7B%0A%09res = _res;%0A%09query = _query;%0A%09id = _id;%0A%09listener = _listener;%0A%7D%0A%0A%0A/**%0A * Performs the query, and executes the callback.%0A */%0Apublic void%0Arun() %7B%0A%09Message response = res.send(query);%0A%09listener.receiveMessage(id, response);%0A%7D%0A%0A%7D%0A

split ResolveThread from WorkerThread