/*
* 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
/**
* Application to provide a listing of monitorable java processes.
*
* @author Brian Doherty
* @since 1.5
*/
public class Jps {
try {
} catch (IllegalArgumentException e) {
return;
}
}
try {
// get the set active JVMs on the specified host.
continue;
}
try {
// Note: The VM associated with the current VM id may
// no longer be running so these queries may fail. We
// already added the VM id to the output stream above.
// If one of the queries fails, then we try to add a
// reasonable message to indicate that the requested
// info is not available.
errorString = " -- process information unavailable";
errorString = " -- main class information unavailable";
arguments.showLongPaths()));
if (arguments.showMainArgs()) {
errorString = " -- main args information unavailable";
}
}
if (arguments.showVmArgs()) {
errorString = " -- jvm args information unavailable";
}
}
if (arguments.showVmFlags()) {
errorString = " -- jvm flags information unavailable";
}
}
errorString = " -- detach failed";
errorString = null;
} catch (URISyntaxException e) {
// unexpected as vmidString is based on a validated hostid
lastError = e;
assert false;
} catch (Exception e) {
lastError = e;
} finally {
if (errorString != null) {
/*
* we ignore most exceptions, as there are race
* conditions where a JVM in 'jvms' may terminate
* before we get a chance to list its information.
* Other errors, such as access and I/O exceptions
* should stop us from iterating over the complete set.
*/
}
}
if (arguments.printStackTrace()) {
}
continue;
}
}
}
} catch (MonitorException e) {
if (e.getMessage() != null) {
} else {
} else {
e.printStackTrace();
}
}
}
}
}