Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StateControllerBase.java
40948 views
/*1* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223package nsk.monitoring.share;2425import nsk.share.log.*;2627/**28* An abstract base class for operating VM state. The follow methods must29* be implemented by its subclasses:30* <ul>31* <li><code>run()</code> -- brings VM into defined state.32* <li><code>reset()</code> -- tries to reclaim VM into initial state.33* </ul>34*/35public abstract class StateControllerBase implements LogAware {36protected Log log;3738public StateControllerBase(Log log) {39this.log = log;40}4142/**43* Brings VM into defined state.44*/45public abstract void run();4647/**48* Tries to reclaim VM into initial state49*/50public abstract void reset();5152/**53* Defines {@link Log <code>Log.Logger</code>} object.54*/55public final void setLog(Log log) {56this.log = log;57}5859/**60* Converts an integer to string.61*62* @param i an integer to convert.63* @return a string that represents the int value.64*/65protected String int2Str(int i) {66String tmp = "";6768if (i < 10) {69tmp = "00";70} else if (i >= 10 && i < 100) {71tmp = "0";72}73return tmp + String.valueOf(i);74}75}767778