View Javadoc
1   //******************************************************************************
2   //
3   // File:    ProcessInfo.java
4   // Package: edu.rit.pj.cluster
5   // Unit:    Class edu.rit.pj.cluster.ProcessInfo
6   //
7   // This Java source file is copyright (C) 2008 by Alan Kaminsky. All rights
8   // reserved. For further information, contact the author, Alan Kaminsky, at
9   // ark@cs.rit.edu.
10  //
11  // This Java source file is part of the Parallel Java Library ("PJ"). PJ is free
12  // software; you can redistribute it and/or modify it under the terms of the GNU
13  // General Public License as published by the Free Software Foundation; either
14  // version 3 of the License, or (at your option) any later version.
15  //
16  // PJ is distributed in the hope that it will be useful, but WITHOUT ANY
17  // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18  // A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19  //
20  // Linking this library statically or dynamically with other modules is making a
21  // combined work based on this library. Thus, the terms and conditions of the GNU
22  // General Public License cover the whole combination.
23  //
24  // As a special exception, the copyright holders of this library give you
25  // permission to link this library with independent modules to produce an
26  // executable, regardless of the license terms of these independent modules, and
27  // to copy and distribute the resulting executable under terms of your choice,
28  // provided that you also meet, for each linked independent module, the terms
29  // and conditions of the license of that module. An independent module is a module
30  // which is not derived from or based on this library. If you modify this library,
31  // you may extend this exception to your version of the library, but you are not
32  // obligated to do so. If you do not wish to do so, delete this exception
33  // statement from your version.
34  //
35  // A copy of the GNU General Public License is provided in the file gpl.txt. You
36  // may also obtain a copy of the GNU General Public License on the World Wide
37  // Web at http://www.gnu.org/licenses/gpl.html.
38  //
39  //******************************************************************************
40  package edu.rit.pj.cluster;
41  
42  import java.net.InetSocketAddress;
43  
44  import edu.rit.util.Timer;
45  
46  /**
47   * Class ProcessInfo provides a record of information about one job backend
48   * process in the PJ cluster middleware.
49   *
50   * @author Alan Kaminsky
51   * @version 21-May-2008
52   */
53  public class ProcessInfo {
54  
55  // Exported enumerations.
56      /**
57       * The state of a job backend process.
58       */
59      public static enum State {
60  
61          /**
62           * The job backend process has not started yet.
63           */
64          NOT_STARTED("Not started"),
65          /**
66           * The job backend process is running.
67           */
68          RUNNING("Running"),
69          /**
70           * The job backend process has finished.
71           */
72          FINISHED("Finished"),
73          /**
74           * The job backend process has failed.
75           */
76          FAILED("Failed");
77  
78          private final String stringForm;
79  
80          /**
81           * Construct a new State value.
82           *
83           * @param stringForm String form.
84           */
85          State(String stringForm) {
86              this.stringForm = stringForm;
87          }
88  
89          /**
90           * Returns a string version of this State value.
91           *
92           * @return String version.
93           */
94          public String toString() {
95              return stringForm;
96          }
97      }
98  
99  // Exported data members.
100     /**
101      * The job backend process's state.
102      */
103     public State state;
104 
105     /**
106      * The job backend node's name.
107      */
108     public String name;
109 
110     /**
111      * The job backend process's rank.
112      */
113     public int rank;
114 
115     /**
116      * Reference to the job backend process.
117      */
118     public JobBackendRef backend;
119 
120     /**
121      * Host/port to which the job backend process is listening for middleware
122      * messages.
123      */
124     public InetSocketAddress middlewareAddress;
125 
126     /**
127      * Host/port to which the job backend process is listening for the world
128      * communicator.
129      */
130     public InetSocketAddress worldAddress;
131 
132     /**
133      * Host/port to which the job backend process is listening for the frontend
134      * communicator, or null if the frontend communicator does not exist.
135      */
136     public InetSocketAddress frontendAddress;
137 
138     /**
139      * Lease renewal timer.
140      */
141     public Timer renewTimer;
142 
143     /**
144      * Lease expiration timer.
145      */
146     public Timer expireTimer;
147 
148     /**
149      * Number of CPUs assigned to the job backend process.
150      */
151     public int Nt;
152 
153 // Exported constructors.
154     /**
155      * Construct a new job information record.
156      *
157      * @param state The job backend process's state.
158      * @param name The job backend processor's name.
159      * @param rank The job backend process's rank.
160      * @param backend Reference to the job backend process.
161      * @param middlewareAddress Host/port to which the job backend process is
162      * listening for middleware messages.
163      * @param worldAddress Host/port to which the job backend process is
164      * listening for the world communicator.
165      * @param frontendAddress Host/port to which the job backend process is
166      * listening for the frontend communicator, or null if the frontend
167      * communicator does not exist.
168      * @param renewTimer Lease renewal timer.
169      * @param expireTimer Lease expiration timer.
170      * @param Nt Number of CPUs assigned to the job backend process.
171      */
172     public ProcessInfo(State state,
173             String name,
174             int rank,
175             JobBackendRef backend,
176             InetSocketAddress middlewareAddress,
177             InetSocketAddress worldAddress,
178             InetSocketAddress frontendAddress,
179             Timer renewTimer,
180             Timer expireTimer,
181             int Nt) {
182         this.state = state;
183         this.name = name;
184         this.rank = rank;
185         this.backend = backend;
186         this.middlewareAddress = middlewareAddress;
187         this.worldAddress = worldAddress;
188         this.frontendAddress = frontendAddress;
189         this.renewTimer = renewTimer;
190         this.expireTimer = expireTimer;
191         this.Nt = Nt;
192     }
193 
194 }