/[xulu]/trunk/src/appl/parallel/server/XuluServerProperties.java
ViewVC logotype

Annotation of /trunk/src/appl/parallel/server/XuluServerProperties.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 78 - (hide annotations)
Wed Feb 10 16:43:46 2010 UTC (14 years, 10 months ago) by alfonx
File size: 1572 byte(s)
Merged branch 1.8-gt2-2.6 to trunk. Now the trunk is based on GeoTools 2.6.1 and schmitzm-2.0.x
1 mojays 2 package appl.parallel.server;
2    
3     import java.io.Serializable;
4    
5     import appl.parallel.SimpleResourceProperties;
6    
7     /**
8     * Constructs information out of a XuluServer Object. Unfortunately there is no way
9     * to measure CPU load (for this you would need to have access to the OS core). This could
10     * be done with the use of the JNI, but that is low level programming and would be OS
11     * dependent.
12     *
13     * Must be invoked on server side (which should be clear, anyway!).<br>
14     *
15     * Sets the following properties:
16     * <br><br>
17     * Name <br>
18     * isAvailable<br>
19     * Uptime<br><br>
20     *
21     * and of course the Properties the superclass sets<br>
22     * @author Dominik Appl
23     */
24     public class XuluServerProperties extends SimpleResourceProperties implements
25     Serializable {
26    
27     public XuluServerProperties(XuluServer server, String name) {
28     super();
29     if (name != null)
30     properties.setProperty("Name", name);
31     properties.setProperty("isAvailable", (!(server.isClientConnected()))
32     + "");
33    
34     //format uptime
35     int uptimeInSeconds = server.getUptime() / 1000;
36     int hours, minutes, seconds;
37     hours = uptimeInSeconds / 3600;
38     uptimeInSeconds = uptimeInSeconds - (hours * 3600);
39     minutes = uptimeInSeconds / 60;
40     uptimeInSeconds = uptimeInSeconds - (minutes * 60);
41     seconds = uptimeInSeconds;
42     String formatedTime = hours + "h " + minutes + "m " + seconds + "s";
43     properties.setProperty("Uptime", formatedTime);
44     properties.setProperty("Rating", server.getRating() + "");
45     properties.setProperty("Port", server.getRegistryPort() + "");
46     }
47    
48     }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26