|
Last change
on this file since 101 was
37,
checked in by stoda, 13 years ago
|
|
Stop broker working and unbind too.
|
|
File size:
758 bytes
|
| Line | |
|---|
| 1 | package stopBroker; |
|---|
| 2 | |
|---|
| 3 | import omq.client.annotation.AsyncMethod; |
|---|
| 4 | import omq.common.broker.Broker; |
|---|
| 5 | import omq.server.RemoteObject; |
|---|
| 6 | |
|---|
| 7 | public class BrokerKillerImpl extends RemoteObject implements BrokerKiller { |
|---|
| 8 | |
|---|
| 9 | /** |
|---|
| 10 | * |
|---|
| 11 | */ |
|---|
| 12 | private static final long serialVersionUID = 1L; |
|---|
| 13 | |
|---|
| 14 | @Override |
|---|
| 15 | @AsyncMethod |
|---|
| 16 | public void killServerBroker() throws Exception { |
|---|
| 17 | System.out.println("Kill broker"); |
|---|
| 18 | |
|---|
| 19 | // A remote method cannot stop the Broker because the stop method is |
|---|
| 20 | // thought to wait for the methods finish before it stops. For this |
|---|
| 21 | // reason it actually cannot stop itself |
|---|
| 22 | new Thread() { |
|---|
| 23 | public void run() { |
|---|
| 24 | try { |
|---|
| 25 | Thread.sleep(1000); |
|---|
| 26 | Broker.stopBroker(); |
|---|
| 27 | } catch (Exception e) { |
|---|
| 28 | e.printStackTrace(); |
|---|
| 29 | } |
|---|
| 30 | }; |
|---|
| 31 | }.start(); |
|---|
| 32 | |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.