Rev | Line | |
---|
[33] | 1 | package test2; |
---|
| 2 | |
---|
| 3 | import omq.common.broker.Broker; |
---|
| 4 | |
---|
| 5 | public class MobileThread extends Thread { |
---|
| 6 | private String name; |
---|
| 7 | private Object lock; |
---|
| 8 | |
---|
| 9 | public MobileThread(String name, Object lock) { |
---|
| 10 | this.name = name; |
---|
| 11 | this.lock = lock; |
---|
| 12 | } |
---|
| 13 | |
---|
| 14 | @Override |
---|
| 15 | public void run() { |
---|
| 16 | try { |
---|
| 17 | Mobile mobile = (Mobile) Broker.lookup(name, Mobile.class); |
---|
| 18 | synchronized (lock) { |
---|
| 19 | mobile.sendMessage("Hello this is Sergi"); |
---|
| 20 | mobile.sendMessage("and this is a test"); |
---|
| 21 | Thread.sleep(1000); |
---|
| 22 | lock.notify(); |
---|
| 23 | } |
---|
| 24 | } catch (Exception e) { |
---|
| 25 | |
---|
| 26 | } |
---|
| 27 | } |
---|
| 28 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.