Bael 845 transfer queue (#1727)
* BAEL-845 tranferqueue article * BAEL-845 m to m example * BAEL-845 move code to test * BAEL-845 use tryTransfer * BAEL-845 proper if logic * BAEL-845 proper test * BAEL-845 robust test * BAEL-856 invert logic
This commit is contained in:
parent
6aeb90de5b
commit
1c53e62641
|
@ -22,11 +22,11 @@ public class Producer implements Runnable {
|
|||
try {
|
||||
System.out.println("Producer: " + name + " is waiting to transfer...");
|
||||
boolean added = transferQueue.tryTransfer("A" + i, 4000, TimeUnit.MILLISECONDS);
|
||||
if (!added) {
|
||||
System.out.println("can not add an element due to the timeout");
|
||||
} else {
|
||||
if (added) {
|
||||
numberOfProducedMessages.incrementAndGet();
|
||||
System.out.println("Producer: " + name + " transferred element: A" + i);
|
||||
} else {
|
||||
System.out.println("can not add an element due to the timeout");
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
|
|
Loading…
Reference in New Issue