Package org.mc4j.ems.connection.bean

Examples of org.mc4j.ems.connection.bean.EmsBean


                        "agent logs for more details");
                }
            }

            EmsConnection emsConnection = getEmsConnection();
            EmsBean storageService = emsConnection.getBean("org.apache.cassandra.db:type=StorageService");
            EmsAttribute attribute = storageService.getAttribute("OperationMode");
            String operationMode = (String) attribute.refresh();

            if (!operationMode.equals("NORMAL")) {
                result.setErrorMessage("Bootstrapping " + getHost() + " failed. The StorageService is reporting " +
                    operationMode + " for its operation mode but it should be reporting NORMAL. The StorageService " +
View Full Code Here


                            "agent logs for more details");
                }
            }

            EmsConnection emsConnection = getEmsConnection();
            EmsBean storageService = emsConnection.getBean("org.apache.cassandra.db:type=StorageService");
            EmsAttribute attribute = storageService.getAttribute("OperationMode");
            String operationMode = (String) attribute.refresh();

            if (!operationMode.equals("NORMAL")) {
                result.setErrorMessage("Bootstrapping " + getHost() + " failed. The StorageService is reporting " +
                        operationMode + " for its operation mode but it should be reporting NORMAL. The StorageService " +
View Full Code Here

        }
    }

    String getOperationMode() {
        EmsConnection emsConnection = getEmsConnection();
        EmsBean storageService = emsConnection.getBean("org.apache.cassandra.db:type=StorageService");
        EmsAttribute attribute = storageService.getAttribute("OperationMode");

        return (String) attribute.refresh();
    }
View Full Code Here

        return result;
    }

    private OperationResult prepareForUpgrade(Configuration parameters) throws Exception {
        EmsConnection emsConnection = getEmsConnection();
        EmsBean storageService = emsConnection.getBean("org.apache.cassandra.db:type=StorageService");
        Class<?>[] emptyParams = new Class<?>[0];

        if (log.isDebugEnabled()) {
            log.debug("Disabling native transport...");
        }
        EmsOperation operation = storageService.getOperation("stopNativeTransport", emptyParams);
        operation.invoke((Object[]) emptyParams);

        if (log.isDebugEnabled()) {
            log.debug("Disabling gossip...");
        }
        operation = storageService.getOperation("stopGossiping", emptyParams);
        operation.invoke((Object[]) emptyParams);

        if (log.isDebugEnabled()) {
            log.debug("Taking the snapshot...");
        }
        operation = storageService.getOperation("takeSnapshot", String.class, String[].class);
        String snapshotName = parameters.getSimpleValue("snapshotName");
        if (snapshotName == null || snapshotName.trim().isEmpty()) {
            snapshotName = System.currentTimeMillis() + "";
        }
        operation.invoke(snapshotName, new String[] {});

        // max 2 sec
        waitForTaskToComplete(500, 10, 150);

        if (log.isDebugEnabled()) {
            log.debug("Initiating drain...");
        }
        operation = storageService.getOperation("drain", emptyParams);
        operation.invoke((Object[]) emptyParams);

        return new OperationResult();
    }
View Full Code Here

    private void waitForTaskToComplete(int initialWaiting, int maxTries, int sleepMillis) throws InterruptedException {
        // initial waiting
        Thread.sleep(initialWaiting);
        EmsConnection emsConnection = getEmsConnection();
        EmsBean flushWriterBean = emsConnection.getBean("org.apache.cassandra.internal:type=FlushWriter");
        EmsAttribute attribute = flushWriterBean.getAttribute("PendingTasks");

        Long valueObject = (Long) attribute.refresh();
        // wait until org.apache.cassandra.internal:type=FlushWriter / PendingTasks == 0
        while (valueObject > 0 && maxTries-- > 0) {
            Thread.sleep(sleepMillis);
            valueObject = (Long) attribute.refresh();
        }
        flushWriterBean.unload();
    }
View Full Code Here

        }
    }

    private File getServerHome() throws Exception {
        EmsConnection connection = loadConnection();
        EmsBean bean = connection.getBean("jboss.system:type=ServerConfig");
        File serverHomeViaJnp;
        EmsAttribute serverHomeDirAttrib = bean.getAttribute("ServerHomeDir");
        if (serverHomeDirAttrib != null) {
            serverHomeViaJnp = (File) serverHomeDirAttrib.refresh();
        } else {
            // We have a non-null MBean but a null ServerHomeDir attribute. This most likely means we're
            // connected to a JBoss 5.x or 6.x instance, because in those versions the ServerConfig MBean no
            // longer has a ServerHomeDir attribute. It instead has a ServerHomeLocation attribute, so give
            // that a try, so getAvailabilityNow() can print a more intelligent warning.
            EmsAttribute serverHomeLocationAttrib = bean.getAttribute("ServerHomeLocation");
            URL serverHomeLocation = (URL) serverHomeLocationAttrib.refresh();
            serverHomeViaJnp = toFile(serverHomeLocation);
        }
        return serverHomeViaJnp;
    }
View Full Code Here

                String beanName = name.substring(0, delimIndex);
                String attributeName = name.substring(delimIndex + 1);
                try {
                    // Bean is cached by EMS, so no problem with getting the bean from the connection on each call
                    EmsConnection emsConnection = loadConnection();
                    EmsBean bean = emsConnection.getBean(beanName);
                    EmsAttribute attribute = bean.getAttribute(attributeName);

                    Object valueObject = attribute.refresh();
                    if (valueObject instanceof Number) {
                        Number value = (Number) valueObject;
                        report.addData(new MeasurementDataNumeric(request, value.doubleValue()));
View Full Code Here

    private static final String JBOSS_WEB_MBEAN_NAME_TEMPLATE =
            "jboss.web:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=%s";

    protected static EmsOperation getListDeployedOperation(EmsConnection connection) {
        EmsOperation retOperation;
        EmsBean bean = connection.getBean(MAIN_DEPLOYER);

        // first try the new operation name, used by JBossAS 3.2.8 and 4.x.
        retOperation = bean.getOperation(LIST_DEPLOYED_MODULES_OP_NAME);

        // if that doesn't exist, we are probably connected to a JBossAS 3.2.7 or earlier version
        if (retOperation == null) {
            retOperation = bean.getOperation(LIST_DEPLOYED_OP_NAME);
        }

        // if we still did not manage to find the operation name, let the caller handle this error condition
        return retOperation;
    }
View Full Code Here

    public static boolean isDuplicateJndiName(EmsConnection connection, String mbeanType, String jndiName) {
        if ((jndiName != null) && (mbeanType != null)) {
            String name = mbeanType + ",name=" + jndiName;

            EmsBean bean = connection.getBean(name);
            if (bean == null) {
                return false;
            } else {
                return bean.isRegistered();
            }
        }

        return false;
    }
View Full Code Here

            deploymentInfos = (Collection) operation.invoke(new Object[0]);
        } catch (RuntimeException re) {
            // Make a last ditch effort in case the call to listDeployedModules() failed due to
            // https://jira.jboss.org/jira/browse/JBAS-5983.
            if (operation != null && operation.getName().equals(LIST_DEPLOYED_MODULES_OP_NAME)) {
                EmsBean mainDeployerMBean = connection.getBean(MAIN_DEPLOYER);
                operation = mainDeployerMBean.getOperation(LIST_DEPLOYED_OP_NAME);
                try {
                    deploymentInfos = (Collection) operation.invoke(new Object[0]);
                }
                catch (RuntimeException re2) {
                    deploymentInfos = null;
View Full Code Here

TOP

Related Classes of org.mc4j.ems.connection.bean.EmsBean

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.