()
| 253 | } |
| 254 | |
| 255 | public void stop() throws Exception { |
| 256 | mutex.lock(); // stop 不中断 |
| 257 | try { |
| 258 | if (resendTask != null) { |
| 259 | resendTask.cancel(true); |
| 260 | resendTask = null; |
| 261 | } |
| 262 | if (client == null) |
| 263 | return; |
| 264 | |
| 265 | client.stop(); |
| 266 | client = null; |
| 267 | |
| 268 | leader = null; |
| 269 | |
| 270 | trigger(pending, "stopPending"); |
| 271 | |
| 272 | pending.clear(); |
| 273 | } finally { |
| 274 | mutex.unlock(); |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | public Agent(String name, Application zeze) throws Exception { |
| 279 | this(name, zeze, null); |