Project

General

Profile

« Previous | Next » 

Revision 28c922f7

Added by Patrick Plitzner almost 6 years ago

ref #7505, #6321 Disable parallel loading

  • This caused problems with the session handling because the CDM entities were not correctly loaded

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java
164 164

  
165 165
			IIdentifiableEntityServiceConfigurator configurator = bulkEditorQuery.getSearchConfigurator();
166 166

  
167
            int pageSize = configurator.getPageSize()!=null?configurator.getPageSize():getPageSize();
168
			long count = countEntities(configurator);
169
			int totalWork = count>Integer.MAX_VALUE?Integer.MAX_VALUE:(int)count;
170
			String jobLabel = String.format(Messages.AbstractBulkEditorInput_LOADING, getName(), bulkEditorQuery.getSearchString());
171
	        searchJob = Job.create(jobLabel, (ICoreRunnable) monitor -> {
172
	            monitor.beginTask(jobLabel, totalWork);
173
	            int pageNumber = 0;
167
//            int pageSize = configurator.getPageSize()!=null?configurator.getPageSize():getPageSize();
168
//			long count = countEntities(configurator);
169
//			int totalWork = count>Integer.MAX_VALUE?Integer.MAX_VALUE:(int)count;
170
//			String jobLabel = String.format(Messages.AbstractBulkEditorInput_LOADING, getName(), bulkEditorQuery.getSearchString());
171
//	        searchJob = Job.create(jobLabel, (ICoreRunnable) monitor -> {
172
//	            monitor.beginTask(jobLabel, totalWork);
173
//	            int pageNumber = 0;
174 174
	            List<T> entities;
175
                do {
176
                    if (monitor.isCanceled()) {
177
                        break;
178
                    }
179
                    configurator.setPageNumber(pageNumber);
175
//                do {
176
//                    if (monitor.isCanceled()) {
177
//                        break;
178
//                    }
179
//                    configurator.setPageNumber(pageNumber);
180 180
                    entities = listEntities(configurator);
181 181
                    model.addAll(entities);
182
                    //select if entity is loaded
183
                    if(selection!=null && model.containsAll(selection.toList())){
184
                        EventUtility.postAsyncEvent(WorkbenchEventConstants.BULK_EDITOR_SEARCH_FINISHED, selection);
185
                    }
186
                    pageNumber++;
187
                    monitor.worked(pageSize);
188
                    long workedLong = pageSize*pageNumber;
189
                    int loadedCount =  workedLong>Integer.MAX_VALUE?Integer.MAX_VALUE:(int)workedLong;
190
                    monitor.setTaskName(String.format(Messages.AbstractBulkEditorInput_LOADED, loadedCount, totalWork, getName()));
191
                } while (!entities.isEmpty());
192
	            monitor.done();
193
	            EventUtility.postAsyncEvent(WorkbenchEventConstants.BULK_EDITOR_SEARCH_FINISHED, selection);
194
	        });
195
	        searchJob.schedule();
182
//                    //select if entity is loaded
183
//                    if(selection!=null && model.containsAll(selection.toList())){
184
//                        EventUtility.postAsyncEvent(WorkbenchEventConstants.BULK_EDITOR_SEARCH_FINISHED, selection);
185
//                    }
186
//                    pageNumber++;
187
//                    monitor.worked(pageSize);
188
//                    long workedLong = pageSize*pageNumber;
189
//                    int loadedCount =  workedLong>Integer.MAX_VALUE?Integer.MAX_VALUE:(int)workedLong;
190
//                    monitor.setTaskName(String.format(Messages.AbstractBulkEditorInput_LOADED, loadedCount, totalWork, getName()));
191
//                } while (!entities.isEmpty());
192
//	            monitor.done();
193
//	            EventUtility.postAsyncEvent(WorkbenchEventConstants.BULK_EDITOR_SEARCH_FINISHED, selection);
194
//	        });
195
//	        searchJob.schedule();
196 196
		}
197 197
	}
198 198

  

Also available in: Unified diff