Revision: 18634
http://sourceforge.net/p/gate/code/18634
Author: markagreenwood
Date: 2015-04-13 13:07:24 +0000 (Mon, 13 Apr 2015)
Log Message:
-----------
and the same memory leak fix in the tokenizer, sigh :(
Modified Paths:
--------------
gate/trunk/src/main/gate/creole/tokeniser/DefaultTokeniser.java
Modified: gate/trunk/src/main/gate/creole/tokeniser/DefaultTokeniser.java
===================================================================
--- gate/trunk/src/main/gate/creole/tokeniser/DefaultTokeniser.java
2015-04-13 12:23:47 UTC (rev 18633)
+++ gate/trunk/src/main/gate/creole/tokeniser/DefaultTokeniser.java
2015-04-13 13:07:24 UTC (rev 18634)
@@ -121,73 +121,79 @@
}
@Override
- public void execute() throws ExecutionException{
+ public void execute() throws ExecutionException {
interrupted = false;
- //set the parameters
- try{
- FeatureMap params = Factory.newFeatureMap();
- fireProgressChanged(0);
- //tokeniser
+
+ FeatureMap params = null;
+ fireProgressChanged(0);
+
+ ProgressListener pListener = null;
+ StatusListener sListener = null;
+
+ try {
+
+ // tokeniser
+ params = Factory.newFeatureMap();
params.put(SimpleTokeniser.SIMP_TOK_DOCUMENT_PARAMETER_NAME, document);
- params.put(
- SimpleTokeniser.SIMP_TOK_ANNOT_SET_PARAMETER_NAME, annotationSetName);
+ params.put(SimpleTokeniser.SIMP_TOK_ANNOT_SET_PARAMETER_NAME,
+ annotationSetName);
tokeniser.setParameterValues(params);
- //transducer
- params.clear();
+ pListener = new IntervalProgressListener(0, 50);
+ sListener = new StatusListener() {
+ @Override
+ public void statusChanged(String text) {
+ fireStatusChanged(text);
+ }
+ };
+
+ tokeniser.addProgressListener(pListener);
+ tokeniser.addStatusListener(sListener);
+
+ Benchmark.executeWithBenchmarking(tokeniser,
+ Benchmark.createBenchmarkId("simpleTokeniser", getBenchmarkId()),
+ this, null);
+
+ } catch(Exception e) {
+ throw new ExecutionException("The execution of the \"" + getName()
+ + "\" tokeniser has been abruptly interrupted!", e);
+ } finally {
+ tokeniser.removeProgressListener(pListener);
+ tokeniser.removeStatusListener(sListener);
+ tokeniser.setDocument(null);
+ }
+
+ if(isInterrupted())
+ throw new ExecutionInterruptedException("The execution of the \""
+ + getName() + "\" tokeniser has been abruptly interrupted!");
+
+ try {
+ // transducer
+ params = Factory.newFeatureMap();
params.put(Transducer.TRANSD_DOCUMENT_PARAMETER_NAME, document);
params.put(Transducer.TRANSD_INPUT_AS_PARAMETER_NAME, annotationSetName);
params.put(Transducer.TRANSD_OUTPUT_AS_PARAMETER_NAME,
annotationSetName);
transducer.setParameterValues(params);
- }catch(ResourceInstantiationException rie){
- throw new ExecutionException(rie);
- }
- ProgressListener pListener = null;
- StatusListener sListener = null;
- fireProgressChanged(5);
- pListener = new IntervalProgressListener(5, 50);
- sListener = new StatusListener(){
- @Override
- public void statusChanged(String text){
- fireStatusChanged(text);
- }
- };
+ pListener = new IntervalProgressListener(50, 100);
+ transducer.addProgressListener(pListener);
+ transducer.addStatusListener(sListener);
- //tokeniser
- if(isInterrupted()) throw new ExecutionInterruptedException(
- "The execution of the \"" + getName() +
- "\" tokeniser has been abruptly interrupted!");
- tokeniser.addProgressListener(pListener);
- tokeniser.addStatusListener(sListener);
- try{
- Benchmark.executeWithBenchmarking(tokeniser,
- Benchmark.createBenchmarkId("simpleTokeniser",
- getBenchmarkId()), this, null);
- }catch(ExecutionInterruptedException eie){
- throw new ExecutionInterruptedException(
- "The execution of the \"" + getName() +
- "\" tokeniser has been abruptly interrupted!");
+ Benchmark.executeWithBenchmarking(transducer,
+ Benchmark.createBenchmarkId("transducer", getBenchmarkId()),
+ this, null);
+
+ } catch(Exception e) {
+ throw new ExecutionException("The execution of the \"" + getName()
+ + "\" tokeniser has been abruptly interrupted!", e);
+ } finally {
+ transducer.removeProgressListener(pListener);
+ transducer.removeStatusListener(sListener);
+ transducer.setDocument(null);
}
- tokeniser.removeProgressListener(pListener);
- tokeniser.removeStatusListener(sListener);
+ }// execute
- //transducer
- if(isInterrupted()) throw new ExecutionInterruptedException(
- "The execution of the \"" + getName() +
- "\" tokeniser has been abruptly interrupted!");
- pListener = new IntervalProgressListener(50, 100);
- transducer.addProgressListener(pListener);
- transducer.addStatusListener(sListener);
- Benchmark.executeWithBenchmarking(transducer,
- Benchmark.createBenchmarkId("transducer",
- getBenchmarkId()), this, null);
- transducer.removeProgressListener(pListener);
- transducer.removeStatusListener(sListener);
- }//execute
-
-
/**
* Notifies all the PRs in this controller that they should stop their
* execution as soon as possible.
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs