1 package org.simantics.db.common.procedure.single;
3 import org.simantics.db.AsyncReadGraph;
4 import org.simantics.db.exception.DatabaseException;
5 import org.simantics.db.procedure.AsyncProcedure;
7 final public class SyncReadProcedure<T> implements AsyncProcedure<T> {
9 private Throwable exception = null;
10 public T result = null;
13 public synchronized void execute(AsyncReadGraph graph, T t) {
18 public void exception(AsyncReadGraph graph, Throwable t) {
22 public void checkAndThrow() throws DatabaseException {
23 if(exception != null) {
24 if (exception instanceof DatabaseException)
25 throw (DatabaseException) exception;
27 throw new DatabaseException(
28 "Unexpected exception in ReadGraph.syncRequest(AsyncRead)",