Fix a problem in the synchronization stress test where the main thread
was not waiting for the reader thread to complete it's job before
returning the number of message read thus causing the test to fail
| | |
| | | |
| | | try { |
| | | /* |
| | | * loop receiving update until there is nothing left |
| | | * to make sure that message from previous tests have been consumed. |
| | | */ |
| | | try |
| | | { |
| | | while (true) |
| | | { |
| | | broker.receive(); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { } |
| | | /* |
| | | * Test that operations done on this server are sent to the |
| | | * changelog server and forwarded to our changelog broker session. |
| | | */ |
| | |
| | | break; |
| | | count ++; |
| | | } |
| | | } catch (Exception e) { |
| | | } catch (Exception e) |
| | | {} |
| | | finally |
| | | { |
| | | synchronized (this) |
| | | { |
| | | finished = true; |
| | |
| | | { |
| | | synchronized (this) |
| | | { |
| | | if (finished == true) |
| | | return count; |
| | | try |
| | | int i = 20; |
| | | while ((finished != true) && (i-- >0)) |
| | | { |
| | | this.wait(60); |
| | | return count; |
| | | } catch (InterruptedException e) |
| | | { |
| | | return -1; |
| | | try |
| | | { |
| | | this.wait(60000); |
| | | } catch (InterruptedException e) |
| | | { |
| | | return -1; |
| | | } |
| | | } |
| | | return count; |
| | | } |
| | | } |
| | | |