equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
34 public synchronized boolean hasPassed() { |
34 public synchronized boolean hasPassed() { |
35 return passed; |
35 return passed; |
36 } |
36 } |
37 |
37 |
38 protected synchronized AsyncCloseTest passed() { |
38 protected synchronized AsyncCloseTest passed() { |
39 if (reason == null) |
39 if (failureReason() == null) { |
40 passed = true; |
40 passed = true; |
|
41 } |
41 return this; |
42 return this; |
42 } |
43 } |
43 |
44 |
44 protected synchronized AsyncCloseTest failed(String r) { |
45 protected synchronized AsyncCloseTest failed(String r) { |
45 passed = false; |
46 passed = false; |
46 reason = r; |
47 reason.append(String.format("%n - %s", r)); |
47 return this; |
48 return this; |
48 } |
49 } |
49 |
50 |
50 public synchronized String failureReason() { |
51 public synchronized String failureReason() { |
51 return reason; |
52 return reason.length() > 0 ? reason.toString() : null; |
52 } |
53 } |
53 |
54 |
54 protected synchronized void closed() { |
55 protected synchronized void closed() { |
55 closed = true; |
56 closed = true; |
56 } |
57 } |
58 protected synchronized boolean isClosed() { |
59 protected synchronized boolean isClosed() { |
59 return closed; |
60 return closed; |
60 } |
61 } |
61 |
62 |
62 private boolean passed; |
63 private boolean passed; |
63 private String reason; |
64 private final StringBuilder reason = new StringBuilder(); |
64 private boolean closed; |
65 private boolean closed; |
65 } |
66 } |