Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2014-2014 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.opensource.org/licenses/ecl2.php Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package org.kuali.common.core.system;
 
 
 
 
 @JsonDeserialize(builder = Memory.Builder.class)
 public final class Memory {
 	// used=0.62g, free=1.16g, allocated=0.94g, max=1.78g
 
 	@Min(0)
 	private final long used;
 
 	@Min(0)
 	private final long free;
 
 	@Min(0)
 	private final long allocated;
 
 	@Min(0)
 	private final long max;
 
 	private Memory(Builder builder) {
 		this. = builder.used;
 		this. = builder.free;
 		this. = builder.allocated;
 		this. = builder.max;
 	}

Deprecated:
Use build() instead
 
 	public static Memory create() {
 		return build();
 	}
 
 	public static Memory build() {
 		return builder().build();
 	}
 
 	public static Builder builder() {
 		return new Builder();
 	}
 
 	public static class Builder extends ValidatingBuilder<Memory> {
 
 		// Total amount of memory the JVM is allowed to use
 		private long max = Runtime.getRuntime().maxMemory();
 
 		// Total amount of memory currently allocated
 		private long allocated = Runtime.getRuntime().totalMemory();
 
 		// The JDK method "freeMemory()" reports what is free in the currently allocated heap
 		// The amount of memory currently being used by the JVM is the difference between what has been allocated and what is still free
 		private long used = this. - Runtime.getRuntime().freeMemory();
 
 		// The true amount of free memory is the difference between max and what is currently being used
 		private long free = this. - this.;
 
 		public Builder withUsed(long used) {
 			this. = used;
 			return this;
 		}
 
 		public Builder withFree(long free) {
 			this. = free;
 			return this;
 		}
 
 		public Builder withAllocated(long allocated) {
 			this. = allocated;
 			return this;
 		}
 
 		public Builder withMax(long max) {
 			this. = max;
 			return this;
 		}
 
		public Memory build() {
			return validate(new Memory(this));
		}
	}
	public long getUsed() {
		return ;
	}
	public long getFree() {
		return ;
	}
	public long getAllocated() {
		return ;
	}
	public long getMax() {
		return ;
	}
New to GrepCode? Check out our FAQ X