private Vector<PartStruct> partStructs = new Vector<PartStruct>();\r
private Thread thread;\r
\r
+ private Boolean synchronous = false;\r
+ \r
+ protected AsynchronousTreeTestResultListener(){\r
+ this(false);\r
+ }\r
+\r
+ protected AsynchronousTreeTestResultListener(Boolean synchronousByDefault){\r
+ synchronous = synchronousByDefault;\r
+ }\r
+\r
/** Starts the underlying thread. */\r
public void init() {\r
- thread = new Thread(this);\r
- thread.start();\r
+ if (!synchronous) {\r
+ thread = new Thread(this);\r
+ thread.start();\r
+ }\r
}\r
\r
/** Finish the remaining and destroy */\r
public final void resultPartAdded(TestResult testResult,\r
TestResultPart testResultPart) {\r
TreeTestResult result = (TreeTestResult) testResult;\r
- synchronized (partStructs) {\r
- partStructs.add(new PartStruct(result.getCurrentPath(),\r
- (NumericTRId) result.getTestResultId(), testResultPart,\r
- result));\r
- partStructs.notifyAll();\r
+ PartStruct partStruct = new PartStruct(result.getCurrentPath(),\r
+ (NumericTRId) result.getTestResultId(), testResultPart, result);\r
+\r
+ if (!synchronous) {\r
+ synchronized (partStructs) {\r
+ partStructs.add(partStruct);\r
+ partStructs.notifyAll();\r
+ }\r
+ } else {\r
+ resultPartAdded(partStruct);\r
}\r
}\r
\r
\r
}\r
\r
+ public Boolean getSynchronous() {\r
+ return synchronous;\r
+ }\r
+\r
+ public void setSynchronous(Boolean synchronous) {\r
+ this.synchronous = synchronous;\r
+ }\r
+\r
}\r