import org.simantics.db.common.procedure.wrapper.NoneToAsyncProcedure;
import org.simantics.db.common.request.ReadRequest;
import org.simantics.db.common.request.WriteRequest;
-import org.simantics.db.common.utils.Logger;
import org.simantics.db.exception.CancelTransactionException;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.procedure.AsyncListener;
import org.simantics.db.request.WriteResult;
import org.simantics.utils.DataContainer;
import org.simantics.utils.datastructures.Pair;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class MergingGraphRequestProcessor implements AsyncRequestProcessor {
+ private static final Logger LOGGER = LoggerFactory.getLogger(MergingGraphRequestProcessor.class);
+
private static class SyncWriteRequestAdapter implements Write {
private Semaphore semaphore = new Semaphore(0);
try {
semaphore.acquire();
} catch (InterruptedException e) {
- Logger.defaultLogError(e);
+ LOGGER.error("SyncWriteRequestAdapter interrupted", e);
}
}
try {
MergingGraphRequestProcessor.this.wait(transactionKeepalivePeriod);
} catch (InterruptedException e) {
- Logger.defaultLogError(e);
+ LOGGER.error("MergedRead interrupted", e);
}
if (requestQueue.isEmpty())
break;
} catch(Throwable t) {
- Logger.defaultLogError(t);
+ LOGGER.error("MergedRead failed", t);
// if(currentRequest.second instanceof AsyncProcedure<?>) {
// ((AsyncProcedure<?>)currentRequest.second).exception(graph, t);
} else {
- try{
+ try {
if(currentRequest.second instanceof AsyncProcedure<?>) {
if(currentRequest.first instanceof AsyncRead) {
} catch(Throwable t) {
- Logger.defaultLogError(t);
+ LOGGER.error("MergedRead failed", t);
// if(currentRequest.second instanceof AsyncProcedure<?>) {
// ((AsyncProcedure<?>)currentRequest.second).exception(graph, t);
try {
MergingGraphRequestProcessor.this.wait(transactionKeepalivePeriod);
} catch (InterruptedException e) {
- Logger.defaultLogError(e);
+ LOGGER.error("RunnerWriteGraphRequest interrupted", e);
}
if (requestQueue.isEmpty())
break;
graph.syncRequest(adapter);
if(callback != null) callback.accept(null);
} catch(Throwable t) {
- Logger.defaultLogError(t);
+ LOGGER.error("RunnerWriteGraphRequest failed", t);
if(callback != null) callback.accept(t);
}
else if(currentRequest.first instanceof DelayedWrite) graph.syncRequest((DelayedWrite)currentRequest.first);
if(callback != null) callback.accept(null);
} catch(Throwable t) {
- Logger.defaultLogError(t);
+ LOGGER.error("RunnerWriteGraphRequest failed", t);
if(callback != null) callback.accept(t);
}
Throwable t = throwable.get();
if(t != null) {
- Logger.defaultLogError(t);
+ LOGGER.error("syncRequest(AsyncMultiRead, AsyncMultiProcedure) failed", t);
throw new RuntimeException(t.getMessage());
}
Throwable t = throwable.get();
if(t != null) {
- Logger.defaultLogError(t);
+ LOGGER.error("syncRequest(AsyncRead, AsyncProcedure) failed", t);
throw new RuntimeException(t.getMessage());
}
@Override
public void exception(Throwable t) {
- Logger.defaultLogError(t);
+ LOGGER.error("asyncRequest(AsyncRead) failed", t);
}
});
Throwable t = throwable.get();
if(t != null) {
- Logger.defaultLogError(t);
+ LOGGER.error("syncRequest(AsyncRead) failed", t);
throw new RuntimeException(t.getMessage());
}
Throwable t = throwable.get();
if(t != null) {
- Logger.defaultLogError(t);
+ LOGGER.error("syncRequest(AsyncMultiRead) failed", t);
throw new RuntimeException(t.getMessage());
}
@Override
public void exception(Throwable t) {
- Logger.defaultLogError(t);
+ LOGGER.error("asyncRequest(Read) failed", t);
}
});
throw new UnsupportedOperationException();
}
+ @Override
+ public <T> T l0() {
+ return processor.l0();
+ }
+
}