X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.common%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fcommon%2Fprocessor%2FMergingGraphRequestProcessor.java;fp=bundles%2Forg.simantics.db.common%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fcommon%2Fprocessor%2FMergingGraphRequestProcessor.java;h=dfb5780f96da2edfe4e8f7079c20812a8dfd051f;hp=e9523c0c899628ee03fb29a4130067131044708a;hb=73884c78cf2695329aa3b6559c4c6a196792ac9b;hpb=209d3c557147c8c2c8ae4d8500d1b9a8c5c3166d diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/processor/MergingGraphRequestProcessor.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/processor/MergingGraphRequestProcessor.java index e9523c0c8..dfb5780f9 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/processor/MergingGraphRequestProcessor.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/processor/MergingGraphRequestProcessor.java @@ -33,7 +33,6 @@ import org.simantics.db.common.procedure.adapter.SyncMultiProcedureAdapter; 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; @@ -63,9 +62,13 @@ import org.simantics.db.request.WriteOnlyResult; 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); @@ -128,7 +131,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { try { semaphore.acquire(); } catch (InterruptedException e) { - Logger.defaultLogError(e); + LOGGER.error("SyncWriteRequestAdapter interrupted", e); } } @@ -223,7 +226,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { try { MergingGraphRequestProcessor.this.wait(transactionKeepalivePeriod); } catch (InterruptedException e) { - Logger.defaultLogError(e); + LOGGER.error("MergedRead interrupted", e); } if (requestQueue.isEmpty()) break; @@ -262,7 +265,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { } catch(Throwable t) { - Logger.defaultLogError(t); + LOGGER.error("MergedRead failed", t); // if(currentRequest.second instanceof AsyncProcedure) { // ((AsyncProcedure)currentRequest.second).exception(graph, t); @@ -281,7 +284,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { } else { - try{ + try { if(currentRequest.second instanceof AsyncProcedure) { if(currentRequest.first instanceof AsyncRead) { @@ -298,7 +301,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { } catch(Throwable t) { - Logger.defaultLogError(t); + LOGGER.error("MergedRead failed", t); // if(currentRequest.second instanceof AsyncProcedure) { // ((AsyncProcedure)currentRequest.second).exception(graph, t); @@ -355,7 +358,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { try { MergingGraphRequestProcessor.this.wait(transactionKeepalivePeriod); } catch (InterruptedException e) { - Logger.defaultLogError(e); + LOGGER.error("RunnerWriteGraphRequest interrupted", e); } if (requestQueue.isEmpty()) break; @@ -385,7 +388,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { 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); } @@ -399,7 +402,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { 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); } @@ -572,7 +575,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { Throwable t = throwable.get(); if(t != null) { - Logger.defaultLogError(t); + LOGGER.error("syncRequest(AsyncMultiRead, AsyncMultiProcedure) failed", t); throw new RuntimeException(t.getMessage()); } @@ -625,7 +628,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { Throwable t = throwable.get(); if(t != null) { - Logger.defaultLogError(t); + LOGGER.error("syncRequest(AsyncRead, AsyncProcedure) failed", t); throw new RuntimeException(t.getMessage()); } @@ -691,7 +694,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { @Override public void exception(Throwable t) { - Logger.defaultLogError(t); + LOGGER.error("asyncRequest(AsyncRead) failed", t); } }); @@ -736,7 +739,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { Throwable t = throwable.get(); if(t != null) { - Logger.defaultLogError(t); + LOGGER.error("syncRequest(AsyncRead) failed", t); throw new RuntimeException(t.getMessage()); } @@ -775,7 +778,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { Throwable t = throwable.get(); if(t != null) { - Logger.defaultLogError(t); + LOGGER.error("syncRequest(AsyncMultiRead) failed", t); throw new RuntimeException(t.getMessage()); } @@ -878,7 +881,7 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { @Override public void exception(Throwable t) { - Logger.defaultLogError(t); + LOGGER.error("asyncRequest(Read) failed", t); } }); @@ -1305,4 +1308,9 @@ public class MergingGraphRequestProcessor implements AsyncRequestProcessor { throw new UnsupportedOperationException(); } + @Override + public T l0() { + return processor.l0(); + } + }