KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > Body


1 /*
2 * ################################################################
3 *
4 * ProActive: The Java(TM) library for Parallel, Distributed,
5 * Concurrent computing with Security and Mobility
6 *
7 * Copyright (C) 1997-2002 INRIA/University of Nice-Sophia Antipolis
8 * Contact: proactive-support@inria.fr
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 * USA
24 *
25 * Initial developer(s): The ProActive Team
26 * http://www.inria.fr/oasis/ProActive/contacts.html
27 * Contributor(s):
28 *
29 * ################################################################
30 */

31 package org.objectweb.proactive;
32
33 import org.objectweb.proactive.core.UniqueID;
34 import org.objectweb.proactive.core.body.LocalBodyStrategy;
35 import org.objectweb.proactive.core.body.UniversalBody;
36 import org.objectweb.proactive.core.body.message.MessageEventProducer;
37
38 /**
39  * <P>
40  * An object implementing this interface is an implementation of the non fonctionnal part
41  * of an ActiveObject. This representation is local to the ActiveObject. By contrast there
42  * is a remote representation of Body that can be accessed by distant object.
43  * </P><P>
44  * <code>UniversalBody</code> defines the remote accessible part of the body while
45  * <code>LocalBody</code> defines the local accessible part of the body.
46  * </P><P>
47  * The body of an ActiveObject provides needed services such as a the ability to sent and
48  * receive request and reply.
49  * </P><P>
50  * The interface also defines how the activity methods of an active object sees its Body.
51  * </P><P>
52  * A body has 2 associated states :
53  * <ul>
54  * <li>alive : the body is alive as long as it is processing request and reply</li>
55  * <li>active : the body is active as long as it has an associated thread running
56  * to serve the requests by calling methods on the active object.</li>
57  * </ul>
58  * </P><P>
59  * Note that a thread can be alive but not active, such as a forwarder that just
60  * forward request to another peer.
61  * </P>
62  * @author ProActive Team
63  * @version 1.0, 2001/10/23
64  * @since ProActive 0.9
65  */

66 public interface Body extends LocalBodyStrategy, UniversalBody, MessageEventProducer, Job {
67
68   /**
69    * Terminate the body. After this call the body is no more alive and no more active
70    * although the active thread is not interrupted. The body is unuseable after this call.
71    */

72   public void terminate();
73
74   
75   /**
76    * Returns whether the body is alive or not.
77    * The body is alive as long as it is processing request and reply
78    * @return whether the body is alive or not.
79    */

80   public boolean isAlive();
81   
82
83   /**
84    * Returns whether the body is active or not.
85    * The body is active as long as it has an associated thread running
86    * to serve the requests by calling methods on the active object.
87    * @return whether the body is active or not.
88    */

89   public boolean isActive();
90
91
92   /**
93    * blocks all incoming communications. After this call, the body cannot
94    * receive any request or reply.
95    */

96   public void blockCommunication();
97
98
99   /**
100    * Signals the body to accept all incoming communications. This call undo
101    * a previous call to blockCommunication.
102    */

103   public void acceptCommunication();
104
105     
106   /**
107    * Allows the calling thread to enter in the ThreadStore of this body.
108    */

109   public void enterInThreadStore();
110
111     
112     /**
113    * Allows the calling thread to exit from the ThreadStore of this body.
114    */

115   public void exitFromThreadStore();
116
117
118
119   /**
120    * Tries to find a local version of the body of id uniqueID. If a local version
121    * is found it is returned. If not, tries to find the body of id uniqueID in the
122    * known body of this body. If a body is found it is returned, else null is returned.
123    * @param uniqueID the id of the body to lookup
124    * @return the last known version of the body of id uniqueID or null if not known
125    */

126   public UniversalBody checkNewLocation(UniqueID uniqueID);
127
128
129 }
130
Popular Tags