Project

General

Profile

« Previous | Next » 

Revision 59427

no need to intercept the sentinel indicating the workflow was killed

View differences:

modules/cnr-mongo-mdstore/trunk/src/main/java/eu/dnetlib/data/mdstore/modular/mongodb/MongoMDStore.java
82 82
			while (true) {
83 83
				try {
84 84
					final Object record = queue.take();
85
					if(record == ResultSetClient.SENTINEL_PROC_CANCELED){
86
						//it means the wf was cancelled, so we must give this information back to the caller to avoid commit
87
						log.warn(String.format("Process cancelled after %d records, returning -1", count));
88
						return -1;
89
					}
90
					if (record == sentinel) {
85
					if (record.equals(sentinel)) {
91 86
						bulkWritesManager.flushBulks();
92 87
						break;
93 88
					}
......
113 108
			}
114 109
			queue.put(sentinel);
115 110
			countStored = storedCountInt.get().intValue();
116
		} catch (final InterruptedException e) {
111
		} catch (final InterruptedException | ExecutionException e) {
117 112
			log.error("Error on feeding mdstore with id:" + id, e);
118 113
			throw new IllegalStateException(e);
119
		} catch (ExecutionException e) {
120
			log.error("Error on feeding mdstore with id:" + id, e);
121
			throw new IllegalStateException(e);
122 114
		}
123 115
		log.info("finished feeding mdstore " + id);
124 116
		return countStored;

Also available in: Unified diff