Skip to content

Commit

Permalink
[WFLY-19824] Workaround for AMQP start problem
Browse files Browse the repository at this point in the history
  • Loading branch information
kabir committed Oct 7, 2024
1 parent e002118 commit ae03a3b
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 ae03a3b

Please sign in to comment.