]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.common/src/org/simantics/db/common/SessionThreads.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.db.common / src / org / simantics / db / common / SessionThreads.java
1 package org.simantics.db.common;
2
3 import org.simantics.db.Session;
4 import org.simantics.db.service.LifecycleSupport;
5
6
7 public class SessionThreads {
8
9         public static boolean isClosed() {
10                 Thread current = Thread.currentThread();
11                 if(current instanceof SessionThread) {
12                         Session session = ((SessionThread)current).getSession();
13                         LifecycleSupport ls = session.peekService(LifecycleSupport.class);
14                         if(ls != null) return ls.isClosed();
15                         else return true;
16                 } else {
17                         return false;
18                 }
19         }
20         
21 }