View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.common.lib.info;
20  
21  import java.util.Queue;
22  import org.apache.syncope.common.lib.BaseBean;
23  import org.apache.syncope.common.lib.collections.CircularFifoQueue;
24  
25  public class SystemInfo implements BaseBean {
26  
27      private static final long serialVersionUID = -352727968865892499L;
28  
29      private String hostname;
30  
31      private String os;
32  
33      private String jvm;
34  
35      private int availableProcessors;
36  
37      private long startTime;
38  
39      private final CircularFifoQueue<LoadInstant> load = new CircularFifoQueue<>(10);
40  
41      public String getHostname() {
42          return hostname;
43      }
44  
45      public void setHostname(final String hostname) {
46          this.hostname = hostname;
47      }
48  
49      public String getOs() {
50          return os;
51      }
52  
53      public void setOs(final String os) {
54          this.os = os;
55      }
56  
57      public String getJvm() {
58          return jvm;
59      }
60  
61      public void setJvm(final String jvm) {
62          this.jvm = jvm;
63      }
64  
65      public int getAvailableProcessors() {
66          return availableProcessors;
67      }
68  
69      public void setAvailableProcessors(final int availableProcessors) {
70          this.availableProcessors = availableProcessors;
71      }
72  
73      public long getStartTime() {
74          return startTime;
75      }
76  
77      public void setStartTime(final long startTime) {
78          this.startTime = startTime;
79      }
80  
81      public Queue<LoadInstant> getLoad() {
82          return load;
83      }
84  
85      public static class LoadInstant implements BaseBean {
86  
87          private static final long serialVersionUID = 1700788373758716478L;
88  
89          private long uptime;
90  
91          private double systemLoadAverage;
92  
93          private long totalMemory;
94  
95          private long freeMemory;
96  
97          private long maxMemory;
98  
99          public double getSystemLoadAverage() {
100             return systemLoadAverage;
101         }
102 
103         public void setSystemLoadAverage(final double systemLoadAverage) {
104             this.systemLoadAverage = systemLoadAverage;
105         }
106 
107         public long getUptime() {
108             return uptime;
109         }
110 
111         public void setUptime(final long uptime) {
112             this.uptime = uptime;
113         }
114 
115         public long getTotalMemory() {
116             return totalMemory;
117         }
118 
119         public void setTotalMemory(final long totalMemory) {
120             this.totalMemory = totalMemory;
121         }
122 
123         public long getFreeMemory() {
124             return freeMemory;
125         }
126 
127         public void setFreeMemory(final long freeMemory) {
128             this.freeMemory = freeMemory;
129         }
130 
131         public long getMaxMemory() {
132             return maxMemory;
133         }
134 
135         public void setMaxMemory(final long maxMemory) {
136             this.maxMemory = maxMemory;
137         }
138     }
139 }