| 1 | package dmg.cells.nucleus; |
| 2 | |
| 3 | |
| 4 | public class CellLock { |
| 5 | Object _object = null; |
| 6 | CellMessageAnswerable _callback = null; |
| 7 | long _timeout = 0; |
| 8 | boolean _sync = true; |
| 9 | CellMessage _message = null; |
| 10 | private final CDC _cdc = new CDC(); |
| 11 | |
| 12 | public CellLock(CellMessage msg, CellMessageAnswerable callback, |
| 13 | long timeout) { |
| 14 | if (callback == null) |
| 15 | throw new IllegalArgumentException("Null callback not permitted"); |
| 16 | _callback = callback; |
| 17 | _timeout = System.currentTimeMillis() + timeout; |
| 18 | _sync = false; |
| 19 | _message = msg; |
| 20 | } |
| 21 | |
| 22 | public CellLock() { |
| 23 | } |
| 24 | |
| 25 | public void setObject(Object o) { |
| 26 | _object = o; |
| 27 | } |
| 28 | |
| 29 | public Object getObject() { |
| 30 | return _object; |
| 31 | } |
| 32 | |
| 33 | public CellMessageAnswerable getCallback() { |
| 34 | return _callback; |
| 35 | } |
| 36 | |
| 37 | public boolean isSync() { |
| 38 | return _sync; |
| 39 | } |
| 40 | |
| 41 | public CellMessage getMessage() { |
| 42 | return _message; |
| 43 | } |
| 44 | |
| 45 | public long getTimeout() { |
| 46 | return _timeout; |
| 47 | } |
| 48 | |
| 49 | public CDC getCdc() { |
| 50 | return _cdc; |
| 51 | } |
| 52 | } |