-/*******************************************************************************\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.service;\r
-\r
-import java.util.Collection;\r
-\r
-import org.simantics.db.AsyncReadGraph;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.procedure.AsyncContextMultiProcedure;\r
-import org.simantics.db.procedure.AsyncMultiProcedure;\r
-import org.simantics.db.request.ExternalRead;\r
-\r
-\r
-/**\r
- * @author Antti Villberg\r
- */\r
-public interface QueryControl {\r
-\r
- interface ControlProcedure {\r
- void execute(AsyncReadGraph graph);\r
- }\r
-\r
- /**\r
- * \r
- * @return current amount of queries\r
- */\r
- int count();\r
- \r
- /**\r
- * @return The amount of fixed queries after best effort flush\r
- */\r
- int flush();\r
- int flush(ReadGraph graph);\r
- \r
- /**\r
- * \r
- * @param allowedTimeInMs The amount of allowed time use in ms.\r
- */\r
- void gc(ReadGraph graph, int allowedTimeInMs);\r
-\r
- /**\r
- * Collects all external read requests and their parent queries that are no\r
- * longer listened to. Needs to perform exclusive locking of the database\r
- * client internally so do not invoke this from within a graph read or write\r
- * request but use {@link #gc(WriteGraph, Collection)} instead.\r
- * \r
- * @param reads\r
- */\r
- void gc(Collection<ExternalRead<?>> reads);\r
-\r
- /**\r
- * Collects all external read requests and their parent queries that are no\r
- * longer listened to. The write graph argument is used to ensure that the\r
- * invocation is performed from within a write request with exclusive\r
- * locking.\r
- * \r
- * @param graph write request handle\r
- * @param reads the external read requests to attempt garbage collection for\r
- */\r
- void gc(WriteGraph graph, Collection<ExternalRead<?>> reads);\r
-\r
- int getAmountOfQueryThreads();\r
-\r
- int getGraphThread(AsyncReadGraph graph);\r
- \r
- boolean resume(AsyncReadGraph graph);\r
-\r
- void schedule(AsyncReadGraph graph, int targetThread, ControlProcedure procedure);\r
-\r
- boolean scheduleByCluster(AsyncReadGraph graph, Resource resource, AsyncMultiProcedure<Resource> procedure);\r
- <C> boolean scheduleByCluster(AsyncReadGraph graph, Resource resource, C context, AsyncContextMultiProcedure<C, Resource> procedure);\r
-\r
- /**\r
- * Returns a new ReadGraph based on the specified ReadGraph. The returned\r
- * ReadGraph does not accumulate query dependencies into the requests\r
- * performed with the specified ReadGraph. DB listeners are therefore not\r
- * triggered by anything that is performed with the returned ReadGraph.\r
- * \r
- * @param graph read transaction handle to clone for listener-independent\r
- * use\r
- * @return read transaction handle that is independent of the requests\r
- * performed with the parameter\r
- */\r
- ReadGraph getIndependentGraph(ReadGraph graph);\r
- boolean hasParentRequest(ReadGraph graph);\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.service;
+
+import java.util.Collection;
+
+import org.simantics.db.AsyncReadGraph;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.WriteGraph;
+import org.simantics.db.procedure.AsyncContextMultiProcedure;
+import org.simantics.db.procedure.AsyncMultiProcedure;
+import org.simantics.db.request.ExternalRead;
+
+
+/**
+ * @author Antti Villberg
+ */
+public interface QueryControl {
+
+ interface ControlProcedure {
+ void execute(AsyncReadGraph graph);
+ }
+
+ /**
+ *
+ * @return current amount of queries
+ */
+ int count();
+
+ /**
+ * @return The amount of fixed queries after best effort flush
+ */
+ int flush();
+ int flush(ReadGraph graph);
+
+ /**
+ *
+ * @param allowedTimeInMs The amount of allowed time use in ms.
+ */
+ void gc(ReadGraph graph, int allowedTimeInMs);
+
+ /**
+ * Collects all external read requests and their parent queries that are no
+ * longer listened to. Needs to perform exclusive locking of the database
+ * client internally so do not invoke this from within a graph read or write
+ * request but use {@link #gc(WriteGraph, Collection)} instead.
+ *
+ * @param reads
+ */
+ void gc(Collection<ExternalRead<?>> reads);
+
+ /**
+ * Collects all external read requests and their parent queries that are no
+ * longer listened to. The write graph argument is used to ensure that the
+ * invocation is performed from within a write request with exclusive
+ * locking.
+ *
+ * @param graph write request handle
+ * @param reads the external read requests to attempt garbage collection for
+ */
+ void gc(WriteGraph graph, Collection<ExternalRead<?>> reads);
+
+ int getAmountOfQueryThreads();
+
+ int getGraphThread(AsyncReadGraph graph);
+
+ boolean resume(ReadGraph graph);
+
+ void schedule(AsyncReadGraph graph, int targetThread, ControlProcedure procedure);
+
+ boolean scheduleByCluster(AsyncReadGraph graph, Resource resource, AsyncMultiProcedure<Resource> procedure);
+ <C> boolean scheduleByCluster(AsyncReadGraph graph, Resource resource, C context, AsyncContextMultiProcedure<C, Resource> procedure);
+
+ /**
+ * Returns a new ReadGraph based on the specified ReadGraph. The returned
+ * ReadGraph does not accumulate query dependencies into the requests
+ * performed with the specified ReadGraph. DB listeners are therefore not
+ * triggered by anything that is performed with the returned ReadGraph.
+ *
+ * @param graph read transaction handle to clone for listener-independent
+ * use
+ * @return read transaction handle that is independent of the requests
+ * performed with the parameter
+ */
+ ReadGraph getIndependentGraph(ReadGraph graph);
+ boolean hasParentRequest(ReadGraph graph);
+
+}