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