@@ -0,0 +1,2201 @@
+/*%0A * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.%0A *%0A * Distributable under LGPL license.%0A * See terms of license at gnu.org.%0A */%0Apackage net.java.sip.communicator.util.dns;%0A%0Aimport java.text.*;%0A%0Aimport net.java.sip.communicator.util.*;%0A%0Aimport org.xbill.DNS.*;%0A%0A/**%0A *%0A *%0A * @author Emil Ivov%0A */%0Apublic class ParallelLookup%0A%7B%0A    /**%0A     * The %3Ctt%3ELogger%3C/tt%3E used by the %3Ctt%3EParallelLookup%3C/tt%3E%0A     * class and its instances for logging output.%0A     */%0A    private static final Logger logger = Logger.getLogger(ParallelLookup.class%0A                    .getName());%0A%0A    /**%0A     *%0A     *%0A     * @param domain%0A     * @return%0A     */%0A    public Record%5B%5D lookup(String domain)%0A%0A        throws ParseException%0A    %7B%0A        Record%5B%5D records = null;%0A        Lookup lookup;%0A        try%0A        %7B%0A            lookup = new Lookup(domain, Type.SRV);%0A%0A            new LookupThread(lookup).start();%0A        %7D%0A        catch (TextParseException tpe)%0A        %7B%0A            logger.error(%22Failed to parse domain=%22+domain, tpe);%0A            throw new ParseException(tpe.getMessage(), 0);%0A        %7D%0A%0A        return records;%0A    %7D%0A%0A    /**%0A     * The %7B@link Thread%7D that executes a single %7B@link Lookup%7D in a%0A     * non-blocking way.%0A     */%0A    private final class LookupThread extends Thread%0A    %7B%0A        Lookup lookup;%0A%0A        boolean done = false;%0A%0A        public LookupThread(Lookup lookup)%0A        %7B%0A            this.lookup = lookup;%0A        %7D%0A%0A        /**%0A         *%0A         */%0A        public void run()%0A        %7B%0A            lookup.run();%0A%0A            synchronized(this)%0A            %7B%0A                done = true;%0A                notify();%0A            %7D%0A        %7D%0A%0A        public Record%5B%5D lookUpAndWaitFor(long patience)%0A        %7B%0A            this.start();%0A%0A            synchronized(this)%0A            %7B%0A                if ( !done )%0A                %7B%0A                    try%0A                    %7B%0A                        wait(patience);%0A                    %7D%0A                    catch(InterruptedException iexc)%0A                    %7B%0A                    %7D%0A                %7D%0A%0A                done = true;%0A            %7D%0A%0A            return lookup.getAnswers();%0A        %7D%0A    %7D%0A%7D%0A

Work in progress on the implementation of parallel DNS queries.