Skip to content

Commit

Permalink
Merge pull request wildfly#18280 from kabir/amqp-startup-race
Browse files Browse the repository at this point in the history
[WFLY-19824] Workaround for AMQP start problem
  • Loading branch information
bstansberry authored Oct 7, 2024
2 parents 73138f1 + ae03a3b commit 716ff1f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,20 @@ public void sink(String word) {

public void send(String word) {
System.out.println("Sending " + word);
emitter.send(word);
long end = System.currentTimeMillis() + 30000;
// Workaround
// TODO https://issues.redhat.com/browse/WFLY-19825 Remove this
while (!emitter.hasRequests() && System.currentTimeMillis() < end) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
}
if (emitter.hasRequests()) {
emitter.send(word);
} else {
throw new IllegalStateException("Emitter was not ready in 30 seconds");
}
}

public List<String> getReceived() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,20 @@ public void sink(String word) {

public void send(String word) {
System.out.println("Sending " + word);
emitter.send(word);
// Workaround
// TODO https://issues.redhat.com/browse/WFLY-19825 Remove this
long end = System.currentTimeMillis() + 30000;
while (!emitter.hasRequests() && System.currentTimeMillis() < end) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
}
if (emitter.hasRequests()) {
emitter.send(word);
} else {
throw new IllegalStateException("Emitter was not ready in 30 seconds");
}
}

public List<String> getReceived() {
Expand Down

0 comments on commit 716ff1f

Please sign in to comment.