]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.impl/src/org/simantics/db/impl/procedure/ResultCallWrappedSingleQueryProcedure45.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / procedure / ResultCallWrappedSingleQueryProcedure45.java
index d5abda66e84b4251966cc1929bd614d923d17258..fe2d1668035babb4c70c7f454a3c40aaeeda75c4 100644 (file)
@@ -1,78 +1,78 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.db.impl.procedure;\r
-\r
-import java.util.concurrent.atomic.AtomicBoolean;\r
-\r
-import org.simantics.db.AsyncReadGraph;\r
-import org.simantics.db.common.utils.Logger;\r
-import org.simantics.db.impl.query.QueryProcessor.AsyncBarrier;\r
-import org.simantics.db.procedure.AsyncProcedure;\r
-import org.simantics.db.procedure.Procedure;\r
-\r
-public class ResultCallWrappedSingleQueryProcedure45<Result> implements AsyncProcedure<Result> {\r
-\r
-    private Result result = null;\r
-    private Throwable exception = null;\r
-    final private Procedure<Result> procedure;\r
-    final private AsyncBarrier barrier;\r
-    final private AtomicBoolean latch;\r
-    \r
-    public ResultCallWrappedSingleQueryProcedure45(Procedure<Result> procedure, AsyncBarrier barrier) {\r
-       assert(procedure != null);\r
-        this.procedure = procedure;\r
-        this.barrier = barrier;\r
-        latch = new AtomicBoolean(false);\r
-    }\r
-    \r
-    @Override\r
-    public void execute(AsyncReadGraph graph, Result result) {\r
-        this.result = result;\r
-        if(latch.compareAndSet(false, true)) {\r
-               try {\r
-                       procedure.execute(result);\r
-               } catch (Throwable throwable) {\r
-               Logger.defaultLogError("AsyncProcedure.execute threw for " + procedure, throwable);\r
-               } finally {\r
-                       barrier.dec();\r
-               }\r
-        } else {\r
-               Logger.defaultLogError("Procedure was called many times (this time is execute)");\r
-        }\r
-    }\r
-\r
-    @Override\r
-    public void exception(AsyncReadGraph graph, Throwable t) {\r
-        this.exception = t;\r
-        if(latch.compareAndSet(false, true)) {\r
-               try {\r
-                       procedure.exception(t);\r
-               } catch (Throwable throwable) {\r
-               Logger.defaultLogError("AsyncProcedure.exception threw for " + procedure, throwable);\r
-               } finally {\r
-                       barrier.dec();\r
-               }\r
-        } else {\r
-               Logger.defaultLogError("Procedure was called many times (this time is exception)");\r
-        }\r
-        \r
-    }\r
-    \r
-    public Result getResult() {\r
-        return result;\r
-    }\r
-    \r
-    public Throwable getException() {\r
-        return exception;\r
-    }\r
-       \r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.db.impl.procedure;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.simantics.db.AsyncReadGraph;
+import org.simantics.db.common.utils.Logger;
+import org.simantics.db.impl.query.QueryProcessor.AsyncBarrier;
+import org.simantics.db.procedure.AsyncProcedure;
+import org.simantics.db.procedure.Procedure;
+
+public class ResultCallWrappedSingleQueryProcedure45<Result> implements AsyncProcedure<Result> {
+
+    private Result result = null;
+    private Throwable exception = null;
+    final private Procedure<Result> procedure;
+    final private AsyncBarrier barrier;
+    final private AtomicBoolean latch;
+    
+    public ResultCallWrappedSingleQueryProcedure45(Procedure<Result> procedure, AsyncBarrier barrier) {
+       assert(procedure != null);
+        this.procedure = procedure;
+        this.barrier = barrier;
+        latch = new AtomicBoolean(false);
+    }
+    
+    @Override
+    public void execute(AsyncReadGraph graph, Result result) {
+        this.result = result;
+        if(latch.compareAndSet(false, true)) {
+               try {
+                       procedure.execute(result);
+               } catch (Throwable throwable) {
+               Logger.defaultLogError("AsyncProcedure.execute threw for " + procedure, throwable);
+               } finally {
+                       barrier.dec();
+               }
+        } else {
+               Logger.defaultLogError("Procedure was called many times (this time is execute)");
+        }
+    }
+
+    @Override
+    public void exception(AsyncReadGraph graph, Throwable t) {
+        this.exception = t;
+        if(latch.compareAndSet(false, true)) {
+               try {
+                       procedure.exception(t);
+               } catch (Throwable throwable) {
+               Logger.defaultLogError("AsyncProcedure.exception threw for " + procedure, throwable);
+               } finally {
+                       barrier.dec();
+               }
+        } else {
+               Logger.defaultLogError("Procedure was called many times (this time is exception)");
+        }
+        
+    }
+    
+    public Result getResult() {
+        return result;
+    }
+    
+    public Throwable getException() {
+        return exception;
+    }
+       
+}