]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.impl/src/org/simantics/db/impl/procedure/ResultCallWrappedQueryProcedure45.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / procedure / ResultCallWrappedQueryProcedure45.java
index b68c07b9aece4e9da338c05e990bf42d483680d3..6add4981370db674d3def5bc356a1aac06cfe768 100644 (file)
@@ -1,89 +1,89 @@
-/*******************************************************************************\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.ArrayList;\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.AsyncMultiProcedure;\r
-import org.simantics.db.procedure.MultiProcedure;\r
-\r
-public class ResultCallWrappedQueryProcedure45<Result> implements AsyncMultiProcedure<Result> {\r
-\r
-    final private ArrayList<Result> result;\r
-    private Throwable exception = null;\r
-    final private MultiProcedure<Result> procedure;\r
-    final private AsyncBarrier barrier;\r
-    final private AtomicBoolean latch;\r
-    \r
-    public ResultCallWrappedQueryProcedure45(MultiProcedure<Result> procedure, AsyncBarrier barrier) {\r
-        this.procedure = procedure;\r
-        this.barrier = barrier;\r
-        latch = new AtomicBoolean(false);\r
-        result = new ArrayList<Result>();\r
-    }\r
-    \r
-    @Override\r
-    public void execute(AsyncReadGraph graph, Result result) {\r
-       try {\r
-            synchronized(this.result) {\r
-                this.result.add(result);\r
-            }\r
-               procedure.execute(result);\r
-       } catch (Throwable t) {\r
-               Logger.defaultLogError("AsyncMultiProcedure.execute failed for " + procedure, t);\r
-       }\r
-    }\r
-    \r
-    @Override\r
-    public void finished(AsyncReadGraph graph) {\r
-       if(latch.compareAndSet(false, true)) {\r
-               try {\r
-                procedure.finished();\r
-               } catch (Throwable t) {\r
-                       Logger.defaultLogError("AsyncMultiProcedure.exception failed for " + procedure, t);\r
-               } finally {\r
-                barrier.dec();                 \r
-               }\r
-       } else {\r
-               Logger.defaultLogError("Finished or exception was called many times (this time is finished)");\r
-       }\r
-    }\r
-\r
-    @Override\r
-    public void exception(AsyncReadGraph graph, Throwable t) {\r
-       if(latch.compareAndSet(false, true)) {\r
-               try {\r
-                this.exception = t;\r
-                procedure.exception(t);\r
-               } catch (Throwable throwable) {\r
-                       Logger.defaultLogError("AsyncMultiProcedure.exception failed for " + procedure, throwable);\r
-               } finally {\r
-                barrier.dec();                 \r
-               }\r
-       } else {\r
-               Logger.defaultLogError("Finished or exception was called many times (this time is exception)");\r
-       }\r
-    }\r
-    \r
-    public ArrayList<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.ArrayList;
+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.AsyncMultiProcedure;
+import org.simantics.db.procedure.MultiProcedure;
+
+public class ResultCallWrappedQueryProcedure45<Result> implements AsyncMultiProcedure<Result> {
+
+    final private ArrayList<Result> result;
+    private Throwable exception = null;
+    final private MultiProcedure<Result> procedure;
+    final private AsyncBarrier barrier;
+    final private AtomicBoolean latch;
+    
+    public ResultCallWrappedQueryProcedure45(MultiProcedure<Result> procedure, AsyncBarrier barrier) {
+        this.procedure = procedure;
+        this.barrier = barrier;
+        latch = new AtomicBoolean(false);
+        result = new ArrayList<Result>();
+    }
+    
+    @Override
+    public void execute(AsyncReadGraph graph, Result result) {
+       try {
+            synchronized(this.result) {
+                this.result.add(result);
+            }
+               procedure.execute(result);
+       } catch (Throwable t) {
+               Logger.defaultLogError("AsyncMultiProcedure.execute failed for " + procedure, t);
+       }
+    }
+    
+    @Override
+    public void finished(AsyncReadGraph graph) {
+       if(latch.compareAndSet(false, true)) {
+               try {
+                procedure.finished();
+               } catch (Throwable t) {
+                       Logger.defaultLogError("AsyncMultiProcedure.exception failed for " + procedure, t);
+               } finally {
+                barrier.dec();                 
+               }
+       } else {
+               Logger.defaultLogError("Finished or exception was called many times (this time is finished)");
+       }
+    }
+
+    @Override
+    public void exception(AsyncReadGraph graph, Throwable t) {
+       if(latch.compareAndSet(false, true)) {
+               try {
+                this.exception = t;
+                procedure.exception(t);
+               } catch (Throwable throwable) {
+                       Logger.defaultLogError("AsyncMultiProcedure.exception failed for " + procedure, throwable);
+               } finally {
+                barrier.dec();                 
+               }
+       } else {
+               Logger.defaultLogError("Finished or exception was called many times (this time is exception)");
+       }
+    }
+    
+    public ArrayList<Result> getResult() {
+        return result;
+    }
+    
+    public Throwable getException() {
+        return exception;
+    }
+       
+}