KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > core > event > FutureEvent


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.core.event;
32
33 import org.objectweb.proactive.core.UniqueID;
34
35 /**
36  * <p>
37  * A <code>FutureEvent</code> occurs when a <code>FuturProxy</code>
38  * blocks the executing Thread because the result is not yet available.
39  * </p>
40  *
41  * @see org.objectweb.proactive.core.body.future.FutureProxy
42  * @author ProActive Team
43  * @version 1.0, 2001/10/23
44  * @since ProActive 0.9
45  *
46  */

47 public class FutureEvent extends ProActiveEvent implements java.io.Serializable JavaDoc {
48   
49   /** Created when a Thread is blocked. */
50   public static final int WAIT_BY_NECESSITY = 10;
51   /** Created when a Thread continues */
52   public static final int RECEIVED_FUTURE_RESULT = 20;
53
54   private UniqueID creatorID;
55
56   /**
57    * Creates a new <code>FutureEvent</code> based on the given FutureProxy
58    * @param <code>bodyID</code> the <code>UniqueID</code> of the body that is waiting for the future result
59    * @param <code>creatorID</code> the <code>UniqueID</code> of the body that created
60    * the corresponding <code>Future</code>
61    * @param <code>type</code> the type of the event that occured
62    */

63   public FutureEvent(UniqueID bodyID, UniqueID creatorID, int type) {
64     super(bodyID, type);
65     this.creatorID = creatorID;
66   }
67   
68   /**
69    * Returns the <code>UniqueID</code> of the body that created the corresponding <code>Future</code>
70    * @return the <code>UniqueID</code> of the body that created the corresponding <code>Future</code>
71    */

72   public UniqueID getCreatorID() {
73     return creatorID;
74   }
75  
76   /**
77    * Returns the <code>UniqueID</code> of the body that is waiting
78    * @return the <code>UniqueID</code> of the body that is waiting
79    */

80   public UniqueID getBodyID() {
81     return (UniqueID)getSource();
82   }
83  
84   public String JavaDoc toString() {
85     return "FutureEvent bodyID="+getBodyID()+" creatorID="+getCreatorID();
86   }
87   
88 }
Popular Tags