Rev | Line | |
---|
[33] | 1 | package omq.ztest.calculator; |
---|
| 2 | |
---|
| 3 | import java.io.IOException; |
---|
| 4 | |
---|
| 5 | import omq.client.annotation.AsyncMethod; |
---|
| 6 | import omq.common.broker.Broker; |
---|
| 7 | import omq.exception.SerializerException; |
---|
| 8 | import omq.server.remote.request.RemoteObject; |
---|
| 9 | |
---|
| 10 | public class CalculatorImpl extends RemoteObject implements Calculator { |
---|
| 11 | private int mult = 0; |
---|
| 12 | |
---|
| 13 | public CalculatorImpl() throws Exception { |
---|
| 14 | super(); |
---|
| 15 | } |
---|
| 16 | |
---|
| 17 | private static final long serialVersionUID = 1L; |
---|
| 18 | |
---|
| 19 | public int add(int x, int y) { |
---|
| 20 | return x + y; |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | public void mult(int x, int y) { |
---|
| 24 | mult = x * y; |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | public int getMult() { |
---|
| 28 | return mult; |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | public void setMult(int mult) { |
---|
| 32 | this.mult = mult; |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | public void divideByZero() throws IOException, SerializerException { |
---|
| 36 | ZeroEvent ze = new ZeroEvent("my zero event", "zero-event"); |
---|
| 37 | Broker.trigger(ze); |
---|
| 38 | //notifyEvent(ze); |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | @Override |
---|
| 42 | @AsyncMethod |
---|
| 43 | public void sendMessage(Message m) { |
---|
| 44 | System.out.println("Code = "+m.getCode()); |
---|
| 45 | System.out.println("Message = "+m.getMessage()); |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.