📄 workerinfo.java
字号:
package cn.edu.hust.cgcl.biogrid.worker;
import java.net.InetAddress;
import java.net.UnknownHostException;
//import cn.edu.hust.cgcl.biogrid.dispatcher.CpuInformationMonitor;
import cn.edu.hust.cgcl.biogrid.dispatcher.SubJob;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class WorkerInfo
{
private String firstDispatecherID;
private String firstDispatcherIPAddr;
private int firstDispatcherPort;
public String secondDispacherID;
public String secondDispatcherIPAddr;
public int secondDispatcherPort;
private String workerId;
private String ipAddr;
public SubJob sj=null;
private String pcWorkload="";
//private CpuInformationMonitor ciMonitor=new CpuInformationMonitor();
//private String subTaskID;
private boolean finishFlag;
private int workerState;
//private static final int POLL_INTERVAL = 60 * 1000;
private static final int WORKER_IDLE = 0;
private static final int WORKER_BUSY = 1;
public WorkerInfo()
{
this.firstDispatcherIPAddr = "";
this.firstDispatcherPort = 0;
this.firstDispatecherID = "";
this.secondDispacherID = "";
this.secondDispatcherIPAddr = "";
this.secondDispatcherPort = 0;
this.workerId = "";
try
{
this.ipAddr = InetAddress.getLocalHost().getHostAddress();
}
catch (UnknownHostException e)
{
e.printStackTrace();
}
this.finishFlag = false;
this.workerState = 0;
}
WorkerInfo(String workerId, String dipAddr, int heartbeatport, String subdispaddr, int subheartbeatport)
{
this.workerId = workerId;
this.firstDispatcherIPAddr = dipAddr;
this.firstDispatcherPort = heartbeatport;
this.secondDispatcherIPAddr=subdispaddr;
this.secondDispatcherPort=subheartbeatport;
}
WorkerInfo(String workerId, String dipAddr, int heartbeatport)
{
this.workerId = workerId;
this.firstDispatcherIPAddr = dipAddr;
this.firstDispatcherPort = heartbeatport;
//this.secondDispatcherIPAddr=subdispaddr;
//this.secondDispatcherPort=subheartbeatport;
}
WorkerInfo(String fID,
String fIP,
int fPort,
String subfID,
String subfIP,
int subfPort,
String sID,
String sIP,
int sPort,
String workerId
)
{
this.secondDispacherID=subfID;
this.secondDispatcherIPAddr=subfIP;
this.secondDispatcherPort=subfPort;
this.firstDispatecherID = fID;
this.firstDispatcherIPAddr = fIP;
this.firstDispatcherPort = fPort;
this.secondDispacherID = sID;
this.secondDispatcherIPAddr = sIP;
this.secondDispatcherPort = sPort;
this.workerId = workerId;
try
{
this.ipAddr = InetAddress.getLocalHost().getHostAddress();
}
catch (UnknownHostException e)
{
e.printStackTrace();
}
this.finishFlag = false;
this.workerState = 0;
}
public void setWorkerInfo(String workerId,
String dId,
String dipAddr,
int heartbeatport)
{
this.workerId = workerId;
this.firstDispatcherIPAddr = dipAddr;
this.firstDispatecherID=dId;
this.firstDispatcherPort = heartbeatport;
}
public String getWorkerId()
{
return this.workerId;
}
public String get_f_d_Id()
{
return this.firstDispatecherID;
}
public String get_f_d_Ip()
{
return this.firstDispatcherIPAddr;
}
public int get_f_d_port()
{
return this.firstDispatcherPort;
}
public String get_s_d_Id()
{
return this.secondDispacherID;
}
public String get_s_d_Ip()
{
return this.secondDispatcherIPAddr;
}
public int get_s_d_port()
{
return this.secondDispatcherPort;
}
public int getWorkerState()
{
return this.workerState;
}
public boolean getFinishFlag()
{
return this.finishFlag;
}
public synchronized void setFinishFlag(boolean b)
{
this.finishFlag = b;
}
public String getWorkerIp()
{
return this.ipAddr;
}
/* public String getWorkLoad()
{
pcWorkload=ciMonitor.getCpuUsage();
return pcWorkload;
}*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -