/** * Connects both <code>TransportLayer</code>s in separate threads, * and returns when both have been connected, or when cancelConnect() * is called. */ public void connect() throws TransportException { isConnecting = true; ConnectThread c1 = new ConnectThread(myTransportA); ConnectThread c2 = new ConnectThread(myTransportB); c1.start(); c2.start(); while (isConnecting && (!c1.isConnected() || !c2.isConnected()) && c1.getException() == null && c2.getException() == null) { try { Thread.sleep(1); } catch (InterruptedException e) {} } if (c1.getException() != null) throw c1.getException(); if (c2.getException() != null) throw c2.getException(); }
/** * Connects both <code>TransportLayer</code>s in separate threads, * and returns when both have been connected, or when cancelConnect() * is called. */ public void connect() throws TransportException { isConnecting = true; ConnectThread c1 = new ConnectThread(myTransportA); ConnectThread c2 = new ConnectThread(myTransportB); c1.start(); c2.start(); while (isConnecting && (!c1.isConnected() || !c2.isConnected()) && c1.getException() == null && c2.getException() == null) { try { Thread.sleep(1); } catch (InterruptedException e) {} } if (c1.getException() != null) throw c1.getException(); if (c2.getException() != null) throw c2.getException(); }