]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db/src/org/simantics/db/AsyncRequestProcessor.java
Multiple reader thread support for db client
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / AsyncRequestProcessor.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.db;
13
14 import org.simantics.db.procedure.AsyncListener;
15 import org.simantics.db.procedure.AsyncProcedure;
16 import org.simantics.db.procedure.Listener;
17 import org.simantics.db.procedure.Procedure;
18 import org.simantics.db.procedure.SyncListener;
19 import org.simantics.db.procedure.SyncProcedure;
20 import org.simantics.db.request.AsyncMultiRead;
21 import org.simantics.db.request.AsyncRead;
22 import org.simantics.db.request.MultiRead;
23 import org.simantics.db.request.Read;
24 import org.simantics.db.request.ReadInterface;
25 import org.simantics.db.request.Write;
26 import org.simantics.db.request.WriteInterface;
27 import org.simantics.db.request.WriteOnly;
28
29 /**
30  * 
31  * For initiating requests in asynchronous manner. The possible requests are
32  * <ul>
33  * <li>{@link Read} for computing a single result synchronously
34  * <li>{@link AsyncRead} for computing a single result asynchronously
35  * <li>{@link MultiRead} for computing a collection of results synchronously
36  * <li>{@link AsyncMultiRead} for computing a collection of results
37  * asynchronously
38  * <li>{@link Write} for reading and writing synchronously
39  * <li>{@link WriteOnly} for writing synchronously
40  * </ul>
41  * <p>
42  * The standard AsyncRequestProcessors are
43  * <ul>
44  * <li>{@link AsyncReadGraph} for performing requests during other requests
45  * <li>{@link Session} for initiating a transactions for performing requests
46  * <li>{@link MergingGraphRequestProcessor} for merging several requests in a
47  * single transaction
48  * </ul>
49  * 
50  * Database services (see e.g. {@link Session}) are available from implemented
51  * {@link ServiceLocator}. For a synchronous counterpart with the same
52  * functionality as AsyncRequestProcessor see {@link RequestProcessor}
53  * 
54  * @version 0.7
55  * @author Antti Villberg
56  * @see Read
57  * @see AsyncRead
58  * @see MultiRead
59  * @see AsyncMultiRead
60  * @see Write
61  * @see WriteOnly
62  * @see AsyncReadGraph
63  * @see Session
64  * @see MergingGraphRequestProcessor
65  * @see RequestProcessor
66  */
67 public interface AsyncRequestProcessor extends RequestProcessor, AsyncRequestProcessorSpecific {
68     
69     <T> void async(ReadInterface<T> r, Procedure<T> procedure);
70     <T> void async(ReadInterface<T> r, AsyncProcedure<T> procedure);
71     <T> void async(ReadInterface<T> r, SyncProcedure<T> procedure);
72     <T> void async(ReadInterface<T> r, Listener<T> procedure);
73     <T> void async(ReadInterface<T> r, AsyncListener<T> procedure);
74     <T> void async(ReadInterface<T> r, SyncListener<T> procedure);
75     
76 }