Package net.sf.basedb.util.jobagent
Class JobAgentInfo
- java.lang.Object
-
- net.sf.basedb.util.jobagent.JobAgentInfo
-
public class JobAgentInfo extends Object
This class can hold information about the status of a job agent.- Version:
- 2.0
- Author:
- nicklas
- See Also:
JobAgentConnection.getInfo(boolean)
- Last modified
- $Date: 2012-09-14 09:28:35 +0200 (fr, 14 sep 2012) $
-
-
Constructor Summary
Constructors Constructor Description JobAgentInfo()
Create a new info object and set all values to null.JobAgentInfo(Boolean paused, Integer cpuUsage, Long usedMemory, Long totalMemory, Set<JobInfo> jobs)
Create a new info object.JobAgentInfo(String answer)
Create a new info object and parse the answer from aJobAgentConnection
to get the values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getAge()
Get the age in milliseconds of this object.Integer
getCpuUsage()
Get the CPU usage in percent.Set<JobInfo>
getJobInfo()
Get detailed information about the running jobs.Long
getTotalMemory()
Get the total memory on the job agent's server in bytes.Long
getUsedMemory()
Get the used memory on the job agent's server in bytes.private String
getValue(Map<String,List<String>> headers, String header)
private List<String>
getValues(Map<String,List<String>> headers, String header)
Boolean
isPaused()
If the job agent is paused or running.String
toString()
Convert the information to a string that is suitable for sening as an answer to aJobAgentConnection
object.
-
-
-
Constructor Detail
-
JobAgentInfo
public JobAgentInfo()
Create a new info object and set all values to null.
-
JobAgentInfo
public JobAgentInfo(Boolean paused, Integer cpuUsage, Long usedMemory, Long totalMemory, Set<JobInfo> jobs)
Create a new info object.- Parameters:
paused
- If the job agent is paused or running, or null if not knowcpuUsage
- The CPU usage in percent, or null if not knownusedMemory
- The used memory in bytes, or null if not knowntotalMemory
- The total memory in bytes, or null if not knownjobs
- Information about jobs that are currently executing or null if not known
-
JobAgentInfo
public JobAgentInfo(String answer)
Create a new info object and parse the answer from aJobAgentConnection
to get the values.- Parameters:
answer
- The answer frominfo
request to the job agent
-
-
Method Detail
-
getAge
public long getAge()
Get the age in milliseconds of this object. The age can be used by client applications that caches the information to determine when it is time to issue a new request.- Returns:
- The age in milliseconds
-
isPaused
public Boolean isPaused()
If the job agent is paused or running.- Returns:
- TRUE if the job agent is pasued, FALSE if it is running, or null if not known
-
getCpuUsage
public Integer getCpuUsage()
Get the CPU usage in percent.- Returns:
- The CPU usage or null if not known
-
getTotalMemory
public Long getTotalMemory()
Get the total memory on the job agent's server in bytes.- Returns:
- The total memory or null if not known
-
getUsedMemory
public Long getUsedMemory()
Get the used memory on the job agent's server in bytes.- Returns:
- The used memory or null if not known
-
getJobInfo
public Set<JobInfo> getJobInfo()
Get detailed information about the running jobs.- Returns:
- A set with job information or null if not known
- Since:
- 2.6
-
toString
public String toString()
Convert the information to a string that is suitable for sening as an answer to aJobAgentConnection
object.
-
-