Complete Relay construction only after container gets server binding

This commit is contained in:
Tony Garnock-Jones 2012-05-11 11:12:44 -04:00
parent cd5b311dc0
commit b1ae573f98
1 changed files with 3 additions and 3 deletions

View File

@ -108,9 +108,6 @@ public class Relay implements Runnable, Node, Flushable {
System.err.println("Double bind attempted");
} else {
_remoteName = m.getBytes(1).getDataString();
synchronized (this) {
this.notifyAll();
}
if (_container.bind(_remoteName, this)) {
String replySink = m.getBytes(4).getDataString();
if (replySink.length() > 0) {
@ -119,6 +116,9 @@ public class Relay implements Runnable, Node, Flushable {
} else {
System.err.println("Bind failed: " + _remoteName);
}
synchronized (this) {
this.notifyAll();
}
}
} else if (selector.equals("unsubscribe") && m.size() == 2) {
if (!m.getBytes(1).getDataString().equals(_remoteName)) {