]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Merge branch 'private/db-threads' into private/threads-testing
authorAntti Villberg <antti.villberg@semantum.fi>
Mon, 9 Jul 2018 07:10:36 +0000 (10:10 +0300)
committerAntti Villberg <antti.villberg@semantum.fi>
Mon, 9 Jul 2018 07:10:36 +0000 (10:10 +0300)
Change-Id: I84918b6db56d8c53a8d91ed6886741009e8b7c1b

1  2 
bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java
bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplSocket.java
bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionRequestManager.java
bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/AdaptionService2.java
tests/org.simantics.db.tests/src/org/simantics/db/tests/api/request/misc/RequestParentTest3.java

index 9290ac99fdd98a5792a542a0b51b7309941f1704,4e37d7fc7b1577938dfc939f58b02954369fdd6a..d5d9445ca4fb230520769af6f7cb1e4d0ea0e8fc
@@@ -3507,7 -3526,7 +3526,7 @@@ public abstract class SessionImplSocke
  
      public int getAmountOfQueryThreads() {
          // This must be a power of two
--        return 1;
++        return 8;
  //        return Integer.highestOneBit(Runtime.getRuntime().availableProcessors());
      }
  
index a29d6ce045bc619ceae803dfe7bf6d48cb03241a,3209961ed61519ac4e22ba100f20ff9882cbd1be..2902274b94202c9c79610f006f5acbf91365338b
@@@ -161,9 -158,19 +161,9 @@@ public class SessionRequestManager 
                
        }
  
 -//    public synchronized void stopRead(int thread) {
 -//            
 -//            try {
 -//                    transactionState.stopReadTransaction();
 -//            } catch (DatabaseException e) {
 -//                    e.printStackTrace();
 -//            }
 -//            
 -//    }
 -
        public synchronized void startWrite(int thread, final SessionTask task) {
                
-               session.queryProvider2.scheduleAlways(thread, new SessionTask((WriteTraits)task.object, task.thread) {
+               session.queryProvider2.schedule(new SessionTask(true) {
  
                        @Override
                        public void run(int thread) {
index 47a14ddbcbccc7424bec9fe1ea059c588dffc24d,859481727bfe9f701f53cbe462dc5ecb6219b83b..1690505a0b4ba6e0c6c304583e4d447b58f3b6d2
@@@ -583,11 -586,16 +584,11 @@@ public class AdaptionService2 implement
      public <T, C> T adapt(ReadGraph g, Resource r, C context, Class<C> contextClass, Class<T> targetClass, boolean possible) throws DatabaseException {
  
        Adapter<T,C> adapter = getAdapter(g, r, context, contextClass, targetClass, possible);
+       if(adapter == null) return null;
        
-               SyncReadProcedure<T> procedure = new SyncReadProcedure<T>();
-       adapter.adapt(g, r, context, procedure);
-               procedure.checkAndThrow();
-               return procedure.result;
+       BlockingAsyncProcedure<T> ap = new BlockingAsyncProcedure<T>(g, null, adapter);
 -      
 -//            SyncReadProcedure<T> procedure = new SyncReadProcedure<T>();
+       adapter.adapt(g, r, context, ap);
 -      
+       return ap.get();
 -//            procedure.checkAndThrow();
 -//            return procedure.result;
        
      }
      
index 2bec7c21eb3666dedbf9a68a573daee4c77354c6,8181e08fb9d2bf1a4a9fc4646e099f30f9e54fdf..e990a06b2bda11ebec210dfbc84794e14fa4c8b4
@@@ -33,11 -33,6 +33,11 @@@ public class RequestParentTest3 extend
                QueryDebug debug = session.getService(QueryDebug.class);
                
                class Request implements AsyncMultiRead<Object> {
-                       @Override
-                       public int threadHash() {
-                               return hashCode();
-                       }
 +
++//                    @Override
++//                    public int threadHash() {
++//                            return hashCode();
++//                    }
                        
              @Override
              public void perform(AsyncReadGraph graph, AsyncMultiProcedure<Object> callback) {