ServiceInfo info = new ServiceInfo(type, name); new ServiceInfoResolver(info).start();  try { long end = System.currentTimeMillis() + timeout; long delay; synchronized (info) { while (!info.hasData() && (delay = end - System.currentTimeMillis()) > 0) { info.wait(delay); } } } catch (InterruptedException e) {  }  return (info.hasData()) ? info : null;
return getServiceInfo(type, name, 3 * 1000);
    public ServiceInfo getServiceInfo(String type, String name, int timeout)    {        ServiceInfo info = new ServiceInfo(type, name);        new ServiceInfoResolver(info).start();        try        {            long end = System.currentTimeMillis() + timeout;            long delay;            synchronized (info)            {                while (!info.hasData() && (delay = end - System.currentTimeMillis()) > 0)                {                    info.wait(delay);                }            }        }        catch (InterruptedException e)        {            // empty        }        return (info.hasData()) ? info : null;    }