KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > perseus > concurrency > api > ConcurrencyManager


1 /**
2  * Copyright (C) 2001-2002
3  * - France Telecom R&D
4  * - Laboratoire Logiciels, Systemes, Reseaux - UMR 5526, CNRS-INPG-UJF
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  * Release: 1.0
21  *
22  * Authors:
23  *
24  */

25
26 package org.objectweb.perseus.concurrency.api;
27
28 /**
29  * This is the interface for Concurrency Control service.
30  *
31  * @author Luciano Garcia-Banuelos (Luciano.Garcia@imag.fr)
32  */

33 public interface ConcurrencyManager {
34
35     /**
36      * This method records the start of an execution context. It can be a
37      * transaction starting.
38      * @param ctx is the context
39      */

40     void begin(Object JavaDoc ctx);
41
42     /**
43      * This method requests the validation os accesses made by the context. It
44      * retrieves a boolean value to indicate if the accesses are validate or
45      * not.
46      */

47     boolean validate(Object JavaDoc ctx);
48
49     /**
50      * This method marks the end of accesses made by the execution context. This
51      * method should be called when the validate method has returned true.
52      */

53     void finalize(Object JavaDoc ctx);
54
55     /**
56      * This method allows to release the resources allocated in a given context.
57      * This method should be called when the validate method has returned false.
58      */

59     void abort(Object JavaDoc ctx);
60
61     /**
62      * This method records an access intention to a data object in read mode.
63      * @param resource is the resource or it identifier (Object used for
64      * synchronization)
65      * @param ctx is an identifier of the execution context. It can be a
66      * transaction handle.
67      * @param lockHints permit to take smaller lock than on the resource globaly
68      * @return null or an object depending on the ConcurrencyManager type
69      * @exception ConcurrencyException if the no resource are available for
70      * this resource identifer or if there is a concurrency problem. In this
71      * last case that means the context should be cancelled.
72      */

73     Object JavaDoc readIntention(Object JavaDoc ctx, Object JavaDoc resource, Object JavaDoc lockHints)
74             throws ConcurrencyException;
75
76     /**
77      * This method records an access intention to a data object in write mode.
78      * A call to the readIntention is necessary before a call to this method.
79      * @param resource is the resource or its identifier
80      * @param ctx is an identifier of the execution context. It can be a
81      * transaction handle.
82      * @param lockHints permit to take smaller lock than on the resource globaly
83      * @return null or an object depending on the ConcurrencyManager type
84      * @exception ConcurrencyException if the no resource are available for
85      * this resource identifer or if there is a concurrency problem. In this
86      * last case that means the context should be cancelled.
87      */

88     Object JavaDoc writeIntention(Object JavaDoc ctx, Object JavaDoc resource, Object JavaDoc lockHints)
89             throws ConcurrencyException;
90 }
91
Popular Tags