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