Skip to content

Commit 17859fd

Browse files
committed
refactor: Defines variables final in VerticalVmRamScalingExample
Signed-off-by: Manoel Campos <[email protected]>
1 parent 261425a commit 17859fd

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmRamScalingExample.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public class VerticalVmRamScalingExample {
107107

108108
private static final int HOST_MIPS = 1000;
109109
private static final int VMS = 1;
110+
110111
/**
111112
* Vm RAM capacity in Megabytes.
112113
*/
@@ -165,7 +166,7 @@ private VerticalVmRamScalingExample() {
165166
printSimulationResults();
166167
}
167168

168-
private void onClockTickListener(EventInfo event) {
169+
private void onClockTickListener(final EventInfo event) {
169170
for (final var vm : vmList) {
170171
System.out.printf("\t\tTime %6.1f: Vm %d Ram Usage: %6.2f%% (%4d of %4d MB)",
171172
event.getTime(), vm.getId(), vm.getRam().getPercentUtilization() * 100.0,
@@ -239,8 +240,8 @@ private Vm createVm() {
239240
* @param vm the VM in which the VerticalVmScaling will be created
240241
* @see #createListOfScalableVms(int)
241242
*/
242-
private void createVerticalRamScalingForVm(Vm vm) {
243-
var verticalRamScaling = new VerticalVmScalingSimple(Ram.class, 0.1);
243+
private void createVerticalRamScalingForVm(final Vm vm) {
244+
final var verticalRamScaling = new VerticalVmScalingSimple(Ram.class, 0.1);
244245
/* By uncommenting the line below, you will see that, instead of gradually
245246
* increasing or decreasing the RAM when the scaling object detects
246247
* the RAM usage is up or down the defined thresholds,
@@ -264,7 +265,7 @@ private void createVerticalRamScalingForVm(Vm vm) {
264265
* threshold is applied for any Vm.
265266
* @return the lower RAM utilization threshold
266267
*/
267-
private double lowerRamUtilizationThreshold(Vm vm) {
268+
private double lowerRamUtilizationThreshold(final Vm vm) {
268269
return 0.5;
269270
}
270271

@@ -279,7 +280,7 @@ private double lowerRamUtilizationThreshold(Vm vm) {
279280
* threshold is applied for any Vm.
280281
* @return the upper RAM utilization threshold
281282
*/
282-
private double upperRamUtilizationThreshold(Vm vm) {
283+
private double upperRamUtilizationThreshold(final Vm vm) {
283284
return 0.7;
284285
}
285286

@@ -322,7 +323,7 @@ private Cloudlet createCloudlet(final UtilizationModel ramUtilizationModel, fina
322323
* @param um the Utilization Model that has called this function
323324
* @return the new resource utilization after the increment
324325
*/
325-
private double utilizationIncrement(UtilizationModelDynamic um) {
326+
private double utilizationIncrement(final UtilizationModelDynamic um) {
326327
final int ramIncreaseMB = 10;
327328
return um.getUtilization() + um.getTimeSpan() * ramIncreaseMB;
328329
}

0 commit comments

Comments
 (0)