1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.db.procedure;
14 import org.simantics.db.AsyncReadGraph;
17 * @author Antti Villberg
19 * First execute is called k times. After this finished or exception is called exactly once.
21 * @param <Result> the result object type accepted by the procedure
23 public interface AsyncMultiProcedure<Result> {
26 * Invoked once for each separate result of the request with potentially
27 * multiple results. It shall be guaranteed that all <code>execute</code>
28 * invocations have been completed when either
29 * {@link #finished(AsyncReadGraph)} or
30 * {@link #exception(AsyncReadGraph, Throwable)} are called and that no
31 * <code>execute</code> invocations will follow afterwards.
33 * @param graph asynchronous graph access
34 * @param result a single result of the multiresult procedure
36 void execute(AsyncReadGraph graph, Result result);
39 * Invoked after all {@link #execute(AsyncReadGraph, Object)} calls have
40 * been finished successfully. This method will not be invoked if case of
41 * errors in {@link #execute(AsyncReadGraph, Object)} or the performed
42 * request that provides the results to this procedure.
44 * @param graph asynchronous graph access
46 void finished(AsyncReadGraph graph);
49 * If an error occurs in the processing of the database request that
50 * produces the results for this procedure.
52 * @param graph asynchronous graph access
53 * @param throwable the exception that occurred
55 void exception(AsyncReadGraph graph, Throwable throwable);