Subversion Repositories XServices

Rev

Rev 87 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 87 Rev 116
1
/*
1
/*
2
 *   Copyright 2012 Brian Rosenberger (Brutex Network)
2
 *   Copyright 2012 Brian Rosenberger (Brutex Network)
3
 *
3
 *
4
 *   Licensed under the Apache License, Version 2.0 (the "License");
4
 *   Licensed under the Apache License, Version 2.0 (the "License");
5
 *   you may not use this file except in compliance with the License.
5
 *   you may not use this file except in compliance with the License.
6
 *   You may obtain a copy of the License at
6
 *   You may obtain a copy of the License at
7
 *
7
 *
8
 *       http://www.apache.org/licenses/LICENSE-2.0
8
 *       http://www.apache.org/licenses/LICENSE-2.0
9
 *
9
 *
10
 *   Unless required by applicable law or agreed to in writing, software
10
 *   Unless required by applicable law or agreed to in writing, software
11
 *   distributed under the License is distributed on an "AS IS" BASIS,
11
 *   distributed under the License is distributed on an "AS IS" BASIS,
12
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *   See the License for the specific language governing permissions and
13
 *   See the License for the specific language governing permissions and
14
 *   limitations under the License.
14
 *   limitations under the License.
15
 */
15
 */
16
 
16
 
17
package net.brutex.xservices.types;
17
package net.brutex.xservices.types;
18
 
18
 
19
import javax.xml.bind.annotation.XmlElement;
19
import javax.xml.bind.annotation.XmlElement;
20
 
20
 
21
/*
21
/**
-
 
22
 * @author Brian Rosenberger, bru(at)brutex.de
22
 * Information about processors and memory
23
 *
23
 */
-
 
-
 
24
 */
-
 
25
 
24
public class RuntimeInfoType {
26
public class RuntimeInfoType
25
	
27
{
26
	private final Runtime runtime = Runtime.getRuntime();
28
  private final Runtime runtime = Runtime.getRuntime();
27
	
29
 
28
	@XmlElement
30
  @XmlElement
29
	public int getAvailableProcessors() {
31
  public int getAvailableProcessors() {
30
		return runtime.availableProcessors();
32
    return this.runtime.availableProcessors();
31
	}
33
  }
32
	
34
 
33
	@XmlElement
35
  @XmlElement
34
	public long getFreeMemory() {
36
  public long getFreeMemory() {
35
		return runtime.freeMemory();
37
    return this.runtime.freeMemory();
36
	}
38
  }
37
	
39
 
38
	@XmlElement
40
  @XmlElement
39
	public long getFreeMemoryMB() {
41
  public long getFreeMemoryMB() {
40
		return runtime.freeMemory() / 1024;
42
    return this.runtime.freeMemory() / 1024L;
41
	}
43
  }
42
	
44
 
43
	@XmlElement
45
  @XmlElement
44
	public long getMaxMemory() {
46
  public long getMaxMemory() {
45
		return runtime.maxMemory();
47
    return this.runtime.maxMemory();
46
	}
48
  }
47
	
49
 
48
	@XmlElement
50
  @XmlElement
49
	public long getMaxMemoryMB() {
51
  public long getMaxMemoryMB() {
50
		return runtime.maxMemory() / 1024;
52
    return this.runtime.maxMemory() / 1024L;
51
	}
53
  }
52
	
54
 
53
	@XmlElement
55
  @XmlElement
54
	public long getTotalMemory() {
56
  public long getTotalMemory() {
55
		return runtime.totalMemory();
57
    return this.runtime.totalMemory();
56
	}
58
  }
57
	
59
 
58
	@XmlElement
60
  @XmlElement
59
	public long getTotalMemoryMB() {
61
  public long getTotalMemoryMB() {
60
		return runtime.totalMemory() / 1024;
62
    return this.runtime.totalMemory() / 1024L;
61
	}
63
  }
62
 
-
 
63
}
64
}