]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.common/src/org/simantics/db/common/request/GenericReadBase2.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.db.common / src / org / simantics / db / common / request / GenericReadBase2.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.common.request;
13
14 import org.simantics.db.AsyncRequestProcessor;
15 import org.simantics.db.RequestProcessor;
16 import org.simantics.db.exception.DatabaseException;
17 import org.simantics.db.procedure.AsyncListener;
18 import org.simantics.db.procedure.AsyncProcedure;
19 import org.simantics.db.procedure.Listener;
20 import org.simantics.db.procedure.Procedure;
21 import org.simantics.db.procedure.SyncListener;
22 import org.simantics.db.procedure.SyncProcedure;
23 import org.simantics.db.request.Read;
24 import org.simantics.db.request.ReadInterface;
25
26 public abstract class GenericReadBase2<R> implements Read<R>, ReadInterface<R> {
27
28     @Override
29     public void request(AsyncRequestProcessor processor, AsyncProcedure<R> procedure) {
30         processor.asyncRequest(this, procedure);
31     }
32     
33     @Override
34     public void request(AsyncRequestProcessor processor, Procedure<R> procedure) {
35         processor.asyncRequest(this, procedure);
36     }
37     
38     @Override
39     public void request(AsyncRequestProcessor processor, SyncProcedure<R> procedure) {
40         processor.asyncRequest(this, procedure);
41     }
42
43     @Override
44     public void request(AsyncRequestProcessor processor, AsyncListener<R> procedure) {
45         processor.asyncRequest(this, procedure);
46     }
47     
48     @Override
49     public void request(AsyncRequestProcessor processor, Listener<R> procedure) {
50         processor.asyncRequest(this, procedure);
51     }
52     
53     @Override
54     public void request(AsyncRequestProcessor processor, SyncListener<R> procedure) {
55         processor.asyncRequest(this, procedure);
56     }
57     
58     @Override
59     public R request(RequestProcessor processor) throws DatabaseException {
60         return processor.syncRequest(this);
61     }
62     
63 }