|
@@ -39,6 +39,9 @@ public class ServerStatus {
|
39
|
39
|
/** The server to which this status belongs. */
|
40
|
40
|
protected final Server server;
|
41
|
41
|
|
|
42
|
+ /** Object to notify when the state of the server changes. */
|
|
43
|
+ protected final Object notifier;
|
|
44
|
+
|
42
|
45
|
/** The current state of the server. */
|
43
|
46
|
protected ServerState state = ServerState.DISCONNECTED;
|
44
|
47
|
|
|
@@ -52,10 +55,12 @@ public class ServerStatus {
|
52
|
55
|
* Creates a new ServerStatus instance for the specified server.
|
53
|
56
|
*
|
54
|
57
|
* @param server The server to which this status belongs
|
55
|
|
- * @since 0.6.3m2
|
|
58
|
+ * @param notifier The object to notify when the state changes
|
|
59
|
+ * @since 0.6.3
|
56
|
60
|
*/
|
57
|
|
- public ServerStatus(final Server server) {
|
|
61
|
+ public ServerStatus(final Server server, final Object notifier) {
|
58
|
62
|
this.server = server;
|
|
63
|
+ this.notifier = notifier;
|
59
|
64
|
}
|
60
|
65
|
|
61
|
66
|
/**
|
|
@@ -69,8 +74,8 @@ public class ServerStatus {
|
69
|
74
|
if (state.canTransitionTo(newState)) {
|
70
|
75
|
state = newState;
|
71
|
76
|
|
72
|
|
- synchronized (this) {
|
73
|
|
- notifyAll();
|
|
77
|
+ synchronized (notifier) {
|
|
78
|
+ notifier.notifyAll();
|
74
|
79
|
}
|
75
|
80
|
} else {
|
76
|
81
|
throw new IllegalArgumentException("Illegal server state "
|