/*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2018 Association for Decentralized Information Management
* in Industry THTH ry.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
import org.simantics.db.common.utils.Logger;
import org.simantics.db.exception.RuntimeDatabaseException;
import org.simantics.db.impl.query.QueryProcessor.AsyncBarrier;
-import org.simantics.db.impl.query.QueryProcessor.SessionTask;
-import org.simantics.utils.Development;
final public class AsyncBarrierImpl extends AtomicInteger implements AsyncBarrier {
final private AsyncBarrierImpl caller;
+ //private final Semaphore sema = new Semaphore(0);
+
public AsyncBarrierImpl(AsyncBarrierImpl caller) {
super(0);
if (BOOKKEEPING) {
while (get() != 0) {
- boolean executed = impl.processor.resume(impl);
+ boolean executed = impl.performPending();
if(executed) waitCount = 0;
++waitCount;
}
- if(Development.DEVELOPMENT) {
-
- impl.processor.threadLocks[0].lock();
- System.err.println("-queues=" + impl.processor.queues[0].size());
- impl.processor.threadLocks[0].unlock();
- System.err.println("-own=" + impl.processor.ownTasks[0].size());
- System.err.println("-ownSync=" + impl.processor.ownSyncTasks[0].size());
- for(SessionTask task : impl.processor.ownSyncTasks[0]) {
- System.err.println("--" + task);
- }
-
- }
+// if(Development.DEVELOPMENT) {
+// impl.processor.threadLocks[0].lock();
+// System.err.println("-queues=" + impl.processor.queues[0].size());
+// impl.processor.threadLocks[0].unlock();
+// System.err.println("-own=" + impl.processor.ownTasks[0].size());
+// System.err.println("-ownSync=" + impl.processor.ownSyncTasks[0].size());
+// for(SessionTask task : impl.processor.ownSyncTasks[0]) {
+// System.err.println("--" + task);
+// }
+// }
throw new RuntimeDatabaseException("Request timed out.");
//waitCount = 0;