01: /**
02: *
03: */package org.drools.concurrent;
04:
05: import org.drools.WorkingMemory;
06:
07: public class AssertObject implements Command, Future {
08: private Object object;
09: private volatile Object result;
10: private Exception e;
11:
12: public AssertObject(final Object object) {
13: this .object = object;
14: }
15:
16: public void execute(final WorkingMemory workingMemory) {
17: try {
18: this .result = workingMemory.insert(this .object);
19: } catch (Exception e) {
20: this .e = e;
21: }
22: }
23:
24: public Object getObject() {
25: return this .result;
26: }
27:
28: public boolean isDone() {
29: return this .result != null;
30: }
31:
32: public boolean exceptionThrown() {
33: return e != null;
34: }
35:
36: public Exception getException() {
37: return this.e;
38: }
39: }
|