public void requestServiceInfo(String type, String name, int timeout) { registerServiceType(type); 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) {  }
public void requestServiceInfo(String type, String name) { requestServiceInfo(type, name, 3*1000);
    public void requestServiceInfo(String type, String name, int timeout) {        registerServiceType(type);        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        }    }