-/*******************************************************************************\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.graph.AsyncBarrierImpl;\r
-import org.simantics.db.procedure.AsyncProcedure;\r
-\r
-public class CallWrappedSingleQueryProcedure4<Result> implements AsyncProcedure<Result> {\r
-\r
- final private Object key;\r
- final private AsyncProcedure<Result> procedure;\r
- final private AtomicBoolean latch = new AtomicBoolean(false);\r
- \r
- public CallWrappedSingleQueryProcedure4(AsyncProcedure<Result> procedure, Object key) {\r
- this.procedure = procedure;\r
- this.key = key;\r
- }\r
- \r
- @Override\r
- public void execute(AsyncReadGraph graph, Result result) {\r
- if(latch.compareAndSet(false, true)) {\r
- try {\r
- procedure.execute(graph, result);\r
- } catch (Throwable t) {\r
- Logger.defaultLogError("AsyncProcedure.exception failed for " + procedure, t);\r
- } finally {\r
- }\r
- } else {\r
- Logger.defaultLogError("Execute or exception was called many times (this time is execute)");\r
- }\r
- }\r
-\r
- @Override\r
- public void exception(AsyncReadGraph graph, Throwable t) {\r
- if(latch.compareAndSet(false, true)) {\r
- try {\r
- procedure.exception(graph, t);\r
- } catch (Throwable throwable) {\r
- Logger.defaultLogError("AsyncProcedure.exception failed for " + procedure, throwable);\r
- } finally {\r
- }\r
- } else {\r
- Logger.defaultLogError("Execute or exception was called many times (this time is exception)");\r
- }\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.procedure.AsyncProcedure;
+
+public class CallWrappedSingleQueryProcedure4<Result> implements AsyncProcedure<Result> {
+
+ final private Object key;
+ final private AsyncProcedure<Result> procedure;
+ final private AtomicBoolean latch = new AtomicBoolean(false);
+
+ public CallWrappedSingleQueryProcedure4(AsyncProcedure<Result> procedure, Object key) {
+ this.procedure = procedure;
+ this.key = key;
+ }
+
+ @Override
+ public void execute(AsyncReadGraph graph, Result result) {
+ if(latch.compareAndSet(false, true)) {
+ try {
+ procedure.execute(graph, result);
+ } catch (Throwable t) {
+ Logger.defaultLogError("AsyncProcedure.exception failed for " + procedure, t);
+ } finally {
+ }
+ } else {
+ Logger.defaultLogError("Execute or exception was called many times (this time is execute)");
+ }
+ }
+
+ @Override
+ public void exception(AsyncReadGraph graph, Throwable t) {
+ if(latch.compareAndSet(false, true)) {
+ try {
+ procedure.exception(graph, t);
+ } catch (Throwable throwable) {
+ Logger.defaultLogError("AsyncProcedure.exception failed for " + procedure, throwable);
+ } finally {
+ }
+ } else {
+ Logger.defaultLogError("Execute or exception was called many times (this time is exception)");
+ }
+ }
+
+}