commit | author | age
|
b75734
|
1 |
/*
|
JM |
2 |
* Copyright 2011 gitblit.com.
|
|
3 |
*
|
|
4 |
* Licensed under the Apache License, Version 2.0 (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
|
|
7 |
*
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9 |
*
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13 |
* See the License for the specific language governing permissions and
|
|
14 |
* limitations under the License.
|
|
15 |
*/
|
|
16 |
package com.gitblit.models;
|
|
17 |
|
|
18 |
import java.io.Serializable;
|
|
19 |
import java.util.Date;
|
|
20 |
import java.util.Map;
|
84c1d5
|
21 |
import java.util.TreeMap;
|
b75734
|
22 |
|
8e40cd
|
23 |
import com.gitblit.Constants;
|
JM |
24 |
|
b75734
|
25 |
/**
|
JM |
26 |
* ServerStatus encapsulates runtime status information about the server
|
84c1d5
|
27 |
* including some information about the system environment.
|
b75734
|
28 |
*
|
JM |
29 |
* @author James Moger
|
|
30 |
*
|
|
31 |
*/
|
|
32 |
public class ServerStatus implements Serializable {
|
|
33 |
|
|
34 |
private static final long serialVersionUID = 1L;
|
|
35 |
|
|
36 |
public final Date bootDate;
|
8e40cd
|
37 |
|
JM |
38 |
public final String version;
|
|
39 |
|
|
40 |
public final String releaseDate;
|
|
41 |
|
486ee1
|
42 |
public final boolean isGO;
|
8e40cd
|
43 |
|
84c1d5
|
44 |
public final Map<String, String> systemProperties;
|
JM |
45 |
|
486ee1
|
46 |
public final long heapMaximum;
|
b75734
|
47 |
|
JM |
48 |
public volatile long heapAllocated;
|
8e40cd
|
49 |
|
b75734
|
50 |
public volatile long heapFree;
|
8e40cd
|
51 |
|
486ee1
|
52 |
public String servletContainer;
|
b75734
|
53 |
|
486ee1
|
54 |
public ServerStatus(boolean isGO) {
|
8e40cd
|
55 |
this.bootDate = new Date();
|
JM |
56 |
this.version = Constants.VERSION;
|
|
57 |
this.releaseDate = Constants.VERSION_DATE;
|
486ee1
|
58 |
this.isGO = isGO;
|
8e40cd
|
59 |
|
JM |
60 |
this.heapMaximum = Runtime.getRuntime().maxMemory();
|
|
61 |
|
|
62 |
this.systemProperties = new TreeMap<String, String>();
|
b75734
|
63 |
put("file.encoding");
|
JM |
64 |
put("java.home");
|
|
65 |
put("java.io.tmpdir");
|
|
66 |
put("java.runtime.name");
|
|
67 |
put("java.runtime.version");
|
|
68 |
put("java.vendor");
|
|
69 |
put("java.version");
|
|
70 |
put("java.vm.info");
|
|
71 |
put("java.vm.name");
|
|
72 |
put("java.vm.vendor");
|
|
73 |
put("java.vm.version");
|
|
74 |
put("os.arch");
|
|
75 |
put("os.name");
|
|
76 |
put("os.version");
|
|
77 |
}
|
|
78 |
|
|
79 |
private void put(String key) {
|
|
80 |
systemProperties.put(key, System.getProperty(key));
|
|
81 |
}
|
|
82 |
}
|