/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
public class MonitorVmStartTerminate {
+ SLEEPTIME * 2;
+ SLEEPERS + " sleepers to terminate");
try {
} catch (InterruptedException e) {
}
throw new RuntimeException(
"Too few sleepers started: "
+ " SLEEPERS = " + SLEEPERS);
}
throw new RuntimeException(
"Started count != terminated count: "
}
}
}
private static final boolean DEBUG = false;
int started;
int terminated;
}
while (i.hasNext()) {
try {
} catch (URISyntaxException e) {
+ e.getMessage());
} catch (MonitorException e) {
+ ": error reading monitoring data: "
+ " target possibly terminated?");
}
}
}
int found = 0;
while (i.hasNext()) {
try {
if (patternMatcher.matches()) {
found++;
}
else {
}
} catch (URISyntaxException e) {
+ e.getMessage());
} catch (MonitorException e) {
+ e.getMessage());
}
}
return found;
}
int found = 0;
while (i.hasNext()) {
/*
* we don't attempt to attach to the target here as it's
* now dead and has no jvmstat share memory file. Just see
* if the process id is among those that we saved when we
* started the targets (note - duplicated allowed and somewhat
* expected on windows);
*/
found++;
}
else {
}
}
return found;
}
public synchronized int getStarted() {
return started;
}
public synchronized int getTerminated() {
return terminated;
}
if (DEBUG) {
}
synchronized (this) {
}
}
}
}
int execInterval;
this.execInterval = execInterval;
}
private synchronized int active() {
try {
active--;
} catch (IllegalThreadStateException e) {
// process hasn't exited yet
}
}
return active;
}
public void run() {
"-classpath",
};
try {
synchronized(this) {
}
} catch (InterruptedException ignore) {
} catch (IOException e) {
"IOException trying to start Sleeper " + i + ": "
+ e.getMessage());
}
}
// spin waiting for the processes to terminate
while (active() > 0) ;
// give final termination event a change to propogate to
// the HostListener
}
}