idok-commit AT lists.psi.ch
Subject: Commit emails of the iDok project
List archive
[idok-commit] idok commit r346 - in trunk/java/ch/idok/dmsd/impl: controller extractor/tiff queue
Chronological Thread
- From: "AFS account Stadler Hans Christian" <stadler_h AT savannah.psi.ch>
- To: idok-commit AT lists.psi.ch
- Subject: [idok-commit] idok commit r346 - in trunk/java/ch/idok/dmsd/impl: controller extractor/tiff queue
- Date: Thu, 19 Mar 2009 16:11:06 +0100
- List-archive: <https://lists.web.psi.ch/pipermail/idok-commit/>
- List-id: Commit emails of the iDok project <idok-commit.lists.psi.ch>
Author: stadler_h
Date: Thu Mar 19 16:11:06 2009
New Revision: 346
Log:
Implemented faster stop operation; nicer tmp file names for tiff
Modified:
trunk/java/ch/idok/dmsd/impl/controller/SimpleController.java
trunk/java/ch/idok/dmsd/impl/extractor/tiff/TiffExtractorFactory.java
trunk/java/ch/idok/dmsd/impl/queue/EventQueue.java
Modified: trunk/java/ch/idok/dmsd/impl/controller/SimpleController.java
==============================================================================
--- trunk/java/ch/idok/dmsd/impl/controller/SimpleController.java
(original)
+++ trunk/java/ch/idok/dmsd/impl/controller/SimpleController.java Thu
Mar 19 16:11:06 2009
@@ -368,10 +368,16 @@
/**
* @brief Handle events in the queue until there are no more
+ *
+ * @param reactToStop React to external stop requests
*/
- void eventLoop() {
+ void eventLoop(boolean reactToStop) {
Event event = EventQueue.dequeue();
while (event != null) {
+ if (reactToStop && stopnow) {
+ EventQueue.flush();
+ break;
+ }
try {
event.handle();
event.dispose();
@@ -418,20 +424,21 @@
finished = false;
logger.finest("Signalling START");
getOut().signal(new PipelineSignal(Signal.START, this));
+ eventLoop(false);
while (!(finished || stopnow)) {
- eventLoop();
logger.finest("Releasing token");
PipelineData token = PipelineData.getInstance();
token.stage = this;
getOut().push(this, token);
+ eventLoop(true);
}
logger.finest("Signalling STOP");
getOut().signal(new PipelineSignal(Signal.STOP, this));
- eventLoop();
+ eventLoop(false);
monitor.suspendTimer("operation.time");
logger.finest("Signalling GET_COUNTERS");
getOut().signal(new PipelineSignal(Signal.GET_COUNTERS,
this));
- eventLoop();
+ eventLoop(false);
// Handle our own monitoring data here to avoid multiple
// invocations
monitoringHandler.handleMonitoringData(monitor);
Modified:
trunk/java/ch/idok/dmsd/impl/extractor/tiff/TiffExtractorFactory.java
==============================================================================
--- trunk/java/ch/idok/dmsd/impl/extractor/tiff/TiffExtractorFactory.java
(original)
+++ trunk/java/ch/idok/dmsd/impl/extractor/tiff/TiffExtractorFactory.java
Thu Mar 19 16:11:06 2009
@@ -114,7 +114,7 @@
File tf = null;
try {
if (raw != null) {
- tf = File.createTempFile("Indexer", "tiff");
+ tf = File.createTempFile("Indexer", ".tiff");
fos = new FileOutputStream(tf);
fos.write(raw);
fos.close();
Modified: trunk/java/ch/idok/dmsd/impl/queue/EventQueue.java
==============================================================================
--- trunk/java/ch/idok/dmsd/impl/queue/EventQueue.java (original)
+++ trunk/java/ch/idok/dmsd/impl/queue/EventQueue.java Thu Mar 19 16:11:06
2009
@@ -69,6 +69,19 @@
logger.finest("Dequeueing event: "+event);
return event;
}
+
+ /**
+ * @brief Remove all events from this queue
+ *
+ * @return The number of removed events
+ */
+ public static int flush() {
+ EventQueue inst = instance();
+ int rval = inst.eventQueue.size();
+ inst.eventQueue.clear();
+ logger.finest("Flushing " + rval + " events off the queue");
+ return rval;
+ }
public static EventQueue instance() {
if (singleton == null) {
- [idok-commit] idok commit r346 - in trunk/java/ch/idok/dmsd/impl: controller extractor/tiff queue, AFS account Stadler Hans Christian, 03/19/2009
Archive powered by MHonArc 2.6.19.