2.17.2: 2011-06-17

net.sf.basedb.util.jobagent
Class JobAgentInfo

java.lang.Object
  extended by 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: 2010-10-19 13:02:17 +0200 (Tue, 19 Oct 2010) $

Field Summary
private  Integer cpuUsage
           
private  long created
           
private  Set<JobInfo> jobs
           
private  Boolean paused
           
private  Long totalMemory
           
private  Long usedMemory
           
 
Constructor Summary
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 a JobAgentConnection to get the values.
 
Method Summary
 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.
 Set<Integer> getJobs()
          Deprecated. Use getJobInfo() instead
 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 a JobAgentConnection object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

created

private final long created

paused

private final Boolean paused

cpuUsage

private final Integer cpuUsage

usedMemory

private final Long usedMemory

totalMemory

private final Long totalMemory

jobs

private final Set<JobInfo> jobs
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 know
cpuUsage - The CPU usage in percent, or null if not known
usedMemory - The used memory in bytes, or null if not known
totalMemory - The total memory in bytes, or null if not known
jobs - 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 a JobAgentConnection to get the values.

Parameters:
answer - The answer from info 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

getJobs

public Set<Integer> getJobs()
Deprecated. Use getJobInfo() instead

Get the ID:s of the jobs that are curently executing. NOTE! Since 2.6 this method always returns null.

Returns:
A set with the ID:s 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 a JobAgentConnection object.

Overrides:
toString in class Object

getValue

private String getValue(Map<String,List<String>> headers,
                        String header)

getValues

private List<String> getValues(Map<String,List<String>> headers,
                               String header)

2.17.2: 2011-06-17