Package org.rhq.core.system

Examples of org.rhq.core.system.ProcessInfo


    public void start(ResourceContext resourceContext) throws InvalidPluginConfigurationException, Exception {
        this.resourceContext = resourceContext;
        buildSharedConnectionIfNeeded();
        pooledConnectionProvider = new MySqlPooledConnectionProvider(resourceContext.getPluginConfiguration());
        ProcessInfo processInfo = resourceContext.getNativeProcess();
        if (processInfo != null) {
            aggregateProcessInfo = processInfo.getAggregateProcessTree();
        } else {
            findProcessInfo();
        }
    }
View Full Code Here


        return parseRuntimeConfiguration(suppressUnknownModuleWarnings,false);
    }
   
    public ApacheDirectiveTree parseRuntimeConfiguration(boolean suppressUnknownModuleWarnings, boolean keepConditional) {
        String httpdConfPath = getHttpdConfFile().getAbsolutePath();
        ProcessInfo processInfo = resourceContext.getNativeProcess();

        return ApacheServerDiscoveryComponent.parseRuntimeConfiguration(httpdConfPath, processInfo, binaryInfo,
            getModuleNames(), suppressUnknownModuleWarnings, keepConditional);
    }
View Full Code Here

        // Process any auto-discovered resources.
        List<ProcessScanResult> autoDiscoveryResults = context.getAutoDiscoveredProcesses();
        for (ProcessScanResult result : autoDiscoveryResults) {
            LOG.info("Discovered a mysql process: " + result);

            ProcessInfo procInfo = result.getProcessInfo();

            servers.add(createResourceDetails(context, context.getDefaultPluginConfiguration(), procInfo));
        }

        return servers;
View Full Code Here

        return servers;
    }

    public DiscoveredResourceDetails discoverResource(Configuration pluginConfiguration,
        ResourceDiscoveryContext resourceDiscoveryContext) throws InvalidPluginConfigurationException {
        ProcessInfo processInfo = null;
        DiscoveredResourceDetails resourceDetails = createResourceDetails(resourceDiscoveryContext,
            pluginConfiguration, processInfo);
        return resourceDetails;
    }
View Full Code Here

    }

    private OperationResult shutdownIfNecessary() {
        log.info("Shutting down " + getResourceContext().getResourceKey());

        ProcessInfo process = getResourceContext().getNativeProcess();
        if (process == null) {
            File pidFile = new File(getBinDir(), "cassandra.pid");
            if (pidFile.exists()) {
                return shutdownStorageNode();
            } else {
View Full Code Here

        try {
            if (pidFile.exists()) {
                long pid = readPidFile(pidFile);
                log.info("Shutting down storage node with pid " + pid);
                ProcessInfo process = findProcessInfo(pid);
                if (process != null) {
                    try {
                        process.kill("KILL");
                        waitForNodeToGoDown();
                        pidFile.delete();
                        result.setSimpleResult("Successfully storage node with pid " + pid);
                    } catch (SigarException e) {
                        log.error("Failed to delete storage node with pid " + process.getPid(), e);
                        result.setErrorMessage("Failed to delete storage node with pid " + pid + ": " +
                            ThrowableUtil.getAllMessages(e));
                    }
                } else {
                    log.warn("Could not find process info for pid " + pid);
View Full Code Here

        if (!isSupportedVersion(binaryInfo.getVersion())) {
            throw new InvalidPluginConfigurationException("Version of Apache executable (" + binaryInfo.getVersion()
                + ") is not a supported version; supported versions are 1.3.x and 2.x.");
        }

        ProcessInfo processInfo = null;
        try {
            DiscoveredResourceDetails resourceDetails =
                createResourceDetails(discoveryContext, pluginConfig, processInfo, binaryInfo);
            return resourceDetails;
        } catch (Exception e) {
View Full Code Here

        // discovered by other plugins.
        List<ProcessScanResult> nonExcludedProcesses = getNonExcludedJavaProcesses(context);

        for (ProcessScanResult process : nonExcludedProcesses) {
            try {
                ProcessInfo processInfo = process.getProcessInfo();
                DiscoveredResourceDetails details = discoverResourceDetails(context, processInfo);
                if (details != null) {
                    //detect discovered jmx resources that are erroneously using the same key
                    if (discoveredResources.contains(details)) {
                        List<DiscoveredResourceDetails> duplicates = duplicatesByKey.get(details.getResourceKey());
View Full Code Here

            List<ProcessInfo> processes = inventoriedResource.getSystemInformation().getProcesses(
                "process|pid|match=" + pid);
            if (processes.size() != 1) {
                throw new IllegalStateException("Failed to find process with PID [" + pid + "].");
            }
            ProcessInfo process = processes.get(0);
            String mainClassName = getJavaMainClassName(process);
            String explicitKeyValue = getSystemPropertyValue(process, SYSPROP_RHQ_RESOURCE_KEY);
            if (oldKeyType == JvmResourceKey.Type.Legacy || explicitKeyValue != null) {
                // We need to upgrade the key.
                JvmResourceKey newKey;
View Full Code Here

        System.out.println("===== Validating Server Process: " + getServerResource());

        List<ProcessInfo> processes = getServerProcesses();
        Assert.assertEquals(processes.size(), 1, "Can't find AS Process.");
        ProcessInfo serverProcess = processes.get(0);
        Map<String, String> processEnv = serverProcess.getEnvironmentVariables();
        assertEquals(processEnv.get("FOO"), "bar", processEnv.toString());

        List<String> processArgs = Arrays.asList(serverProcess.getCommandLine());
        assertTrue(processArgs.contains("-Dfoo=bar"), processArgs.toString());

        System.out.println("---------- Finished " + getClass().getSimpleName() + ". testShutdownAndStartOperations...");
    }
View Full Code Here

TOP

Related Classes of org.rhq.core.system.ProcessInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.