| | |
| | | { |
| | | try |
| | | { |
| | | while (msgQueue.isEmpty()) |
| | | while (msgQueue.isEmpty() && (following == true)) |
| | | { |
| | | msgQueue.wait(500); |
| | | if (!activeWriter) |
| | |
| | | { |
| | | return null; |
| | | } |
| | | msg = msgQueue.removeFirst(); |
| | | if (this.updateServerState(msg)) |
| | | if (following == true) |
| | | { |
| | | /* |
| | | * Only push the message if it has not yet been seen |
| | | * by the other server. |
| | | * Otherwise just loop to select the next message. |
| | | */ |
| | | return msg; |
| | | msg = msgQueue.removeFirst(); |
| | | if (this.updateServerState(msg)) |
| | | { |
| | | /* |
| | | * Only push the message if it has not yet been seen |
| | | * by the other server. |
| | | * Otherwise just loop to select the next message. |
| | | */ |
| | | return msg; |
| | | } |
| | | } |
| | | } |
| | | } |