source: trunk/src/test/java/omq/test/stopBroker/BrokerKillerImpl.java @ 46

Last change on this file since 46 was 46, checked in by stoda, 11 years ago

Refactoring tests
TODO: every test should work with every serializer

File size: 767 bytes
Line 
1package omq.test.stopBroker;
2
3import omq.client.annotation.AsyncMethod;
4import omq.common.broker.Broker;
5import omq.server.RemoteObject;
6
7public 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.