]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/TransactionSupportImpl.java
Merge branch 'master' into private/eclipse-4.7
[simantics/platform.git] / bundles / org.simantics.db.procore / src / fi / vtt / simantics / procore / internal / TransactionSupportImpl.java
1 package fi.vtt.simantics.procore.internal;
2
3 import org.simantics.db.service.TransactionSupport;
4
5 public class TransactionSupportImpl implements TransactionSupport {
6         
7         final private SessionImplSocket session;
8         
9         TransactionSupportImpl(SessionImplSocket session) {
10                 this.session = session;
11         }
12     
13     private int getAsyncCount() {
14         return session.state.getAsyncCount();
15     }
16         
17     @Override
18     public int getReadCount() {
19         return session.state.getReadCount();
20     }
21     
22     @Override
23     public int getWriteCount() {
24         return session.state.getWriteCount();
25     }
26
27     @Override
28     public void waitCompletion() {
29         while(getReadCount() > 0 || getWriteCount() > 0 || getAsyncCount() > 0) {
30             try {
31                 Thread.sleep(10);
32             } catch (InterruptedException e) {
33                 e.printStackTrace();
34             }
35         }
36     }
37     
38 }