-package org.simantics.db.common.procedure.single;\r
-\r
-import org.simantics.db.AsyncReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.procedure.AsyncProcedure;\r
-\r
-final public class SyncReadProcedure<T> implements AsyncProcedure<T> {\r
-\r
- private Throwable exception = null;\r
- public T result = null;\r
- \r
- @Override\r
- public synchronized void execute(AsyncReadGraph graph, T t) {\r
- result = t;\r
- }\r
-\r
- @Override\r
- public void exception(AsyncReadGraph graph, Throwable t) {\r
- exception = t;\r
- }\r
- \r
- public void checkAndThrow() throws DatabaseException {\r
- if(exception != null) {\r
- if (exception instanceof DatabaseException)\r
- throw (DatabaseException) exception;\r
- else\r
- throw new DatabaseException(\r
- "Unexpected exception in ReadGraph.syncRequest(AsyncRead)",\r
- exception);\r
- }\r
- }\r
- \r
-}\r
-\r
+package org.simantics.db.common.procedure.single;
+
+import org.simantics.db.AsyncReadGraph;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.procedure.AsyncProcedure;
+
+final public class SyncReadProcedure<T> implements AsyncProcedure<T> {
+
+ private Throwable exception = null;
+ public T result = null;
+
+ @Override
+ public synchronized void execute(AsyncReadGraph graph, T t) {
+ result = t;
+ }
+
+ @Override
+ public void exception(AsyncReadGraph graph, Throwable t) {
+ exception = t;
+ }
+
+ public void checkAndThrow() throws DatabaseException {
+ if(exception != null) {
+ if (exception instanceof DatabaseException)
+ throw (DatabaseException) exception;
+ else
+ throw new DatabaseException(
+ "Unexpected exception in ReadGraph.syncRequest(AsyncRead)",
+ exception);
+ }
+ }
+
+}
+