Example usage for javax.management InstanceNotFoundException getMessage

List of usage examples for javax.management InstanceNotFoundException getMessage

Introduction

In this page you can find the example usage for javax.management InstanceNotFoundException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.cisco.oss.foundation.monitoring.RMIMonitoringAgent.java

private void unregisterConnetctions() {
    try {/*w  w  w.j a v a  2 s  .  co m*/
        if (this.connetctionsObjectName != null)
            mbs.unregisterMBean(this.connetctionsObjectName);
    } catch (InstanceNotFoundException e) {
        LOGGER.trace("Failed to unregister server connetctions" + e.getMessage());
    } catch (MBeanRegistrationException e) {
        LOGGER.trace("Failed to unregister server connetctions" + e.getMessage());
    }
}

From source file:com.flexive.shared.mbeans.FxCacheProxy.java

/**
 * {@inheritDoc}/*from w  ww. j  a  v a  2s.c o  m*/
 */
@Override
public String getDeploymentId() {
    try {
        return (String) server.getAttribute(name, "DeploymentId");
    } catch (InstanceNotFoundException e) {
        throw new RuntimeException("No FxCache instance found!");
    } catch (MBeanException e) {
        throw new RuntimeException(
                "Cache error invoking the managed bean: " + e.getMessage() + ", TargetException: "
                        + (e.getTargetException() == null ? "(unknown)" : e.getTargetException().getMessage()));
    } catch (ReflectionException e) {
        throw new RuntimeException(
                "Could not invoke operation on FxCache (reflection error): " + e.getMessage());
    } catch (AttributeNotFoundException e) {
        throw new RuntimeException("Attribute DeploymentId not found in managed cache bean: " + e.getMessage());
    }
}

From source file:com.flexive.shared.mbeans.FxCacheProxy.java

/**
 * {@inheritDoc}/* w w  w  .  ja va2  s .  c  o m*/
 */
@Override
public long getSystemStartTime() {
    try {
        return (Long) server.getAttribute(name, "SystemStartTime");
    } catch (InstanceNotFoundException e) {
        throw new RuntimeException("No FxCache instance found!");
    } catch (MBeanException e) {
        throw new RuntimeException(
                "Cache error invoking the managed bean: " + e.getMessage() + ", TargetException: "
                        + (e.getTargetException() == null ? "(unknown)" : e.getTargetException().getMessage()));
    } catch (ReflectionException e) {
        throw new RuntimeException(
                "Could not invoke operation on FxCache (reflection error): " + e.getMessage());
    } catch (AttributeNotFoundException e) {
        throw new RuntimeException(
                "Attribute SystemStartTime not found in managed cache bean: " + e.getMessage());
    }
}

From source file:com.flexive.shared.mbeans.FxCacheProxy.java

/**
 * {@inheritDoc}/*from  ww  w. ja v a2  s .c o  m*/
 */
@Override
public long getNodeStartTime() {
    try {
        return (Long) server.getAttribute(name, "NodeStartTime");
    } catch (InstanceNotFoundException e) {
        throw new RuntimeException("No FxCache instance found!");
    } catch (MBeanException e) {
        throw new RuntimeException(
                "Cache error invoking the managed bean: " + e.getMessage() + ", TargetException: "
                        + (e.getTargetException() == null ? "(unknown)" : e.getTargetException().getMessage()));
    } catch (ReflectionException e) {
        throw new RuntimeException(
                "Could not invoke operation on FxCache (reflection error): " + e.getMessage());
    } catch (AttributeNotFoundException e) {
        throw new RuntimeException(
                "Attribute NodeStartTime not found in managed cache bean: " + e.getMessage());
    }
}

From source file:com.flexive.shared.mbeans.FxCacheProxy.java

/**
 * {@inheritDoc}/*from   w  w  w  .  j  a  v  a2s . c om*/
 */
@Override
public void setEvictionStrategy(Integer divisionId, String path, Integer maxContents, Integer timeToIdle,
        Integer timeToLive) {
    try {
        server.invoke(name, "setEvictionStrategy",
                new Object[] { divisionId, path, maxContents, timeToIdle, timeToLive },
                new String[] { "java.lang.Integer", "java.lang.String", "java.lang.Integer",
                        "java.lang.Integer", "java.lang.Integer" });
    } catch (InstanceNotFoundException e) {
        throw new RuntimeException("No FxCache instance found!");
    } catch (MBeanException e) {
        throw new RuntimeException(
                "Cache error invoking the managed bean: " + e.getMessage() + ", TargetException: "
                        + (e.getTargetException() == null ? "(unknown)" : e.getTargetException().getMessage()));
    } catch (ReflectionException e) {
        throw new RuntimeException(
                "Could not invoke operation on FxCache (reflection error): " + e.getMessage());
    }
}

From source file:com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.java

private void unregisterBean(ObjectName name) {
    try {//  ww w.jav a  2s . c o  m
        server.unregisterMBean(name);
    } catch (InstanceNotFoundException e) {
        // This is often thrown when the process is shutting down. An application with lots of
        // metrics will often begin unregistering metrics *after* JMX itself has cleared,
        // resulting in a huge dump of exceptions as the process is exiting.
        log.trace("Error unregistering '" + name + "': " + e.getMessage(), e);
    } catch (MBeanRegistrationException e) {
        log.trace("Error unregistering '" + name + "': " + e.getMessage(), e);
    }
}

From source file:org.jolokia.backend.MBeanServerHandler.java

/**
 * Unregister all previously registered MBean. This is tried for all previously
 * registered MBeans// w  w w  .  ja v  a2s  . co m
 *
 * @throws JMException if an exception occurs during unregistration
 */
public final void destroy() throws JMException {
    synchronized (mBeanHandles) {
        List<JMException> exceptions = new ArrayList<JMException>();
        List<MBeanHandle> unregistered = new ArrayList<MBeanHandle>();
        for (MBeanHandle handle : mBeanHandles) {
            try {
                unregistered.add(handle);
                handle.server.unregisterMBean(handle.objectName);
            } catch (InstanceNotFoundException e) {
                exceptions.add(e);
            } catch (MBeanRegistrationException e) {
                exceptions.add(e);
            }
        }
        // Remove all successfully unregistered handles
        mBeanHandles.removeAll(unregistered);

        // Throw error if any exception occured during unregistration
        if (exceptions.size() == 1) {
            throw exceptions.get(0);
        } else if (exceptions.size() > 1) {
            StringBuilder ret = new StringBuilder();
            for (JMException e : exceptions) {
                ret.append(e.getMessage()).append(", ");
            }
            throw new JMException(ret.substring(0, ret.length() - 2));
        }
    }

    // Unregister any notification listener
    mBeanServerManager.destroy();
}

From source file:org.apache.geode.management.internal.beans.DistributedSystemBridge.java

/**
 * Add a proxy to the map to be used by bridge.
 *
 * @param objectName object name of the proxy
 * @param proxy actual proxy instance/*from  w  w  w  . j av a  2 s. c om*/
 */
public void addMemberToSystem(ObjectName objectName, MemberMXBean proxy, FederationComponent newState) {

    if (objectName.equals(thisMemberName)) {
        ObjectName distrObjectName = MBeanJMXAdapter.getDistributedSystemName();
        DistributedSystemMXBean systemMBean = new DistributedSystemMBean(this);
        service.registerInternalMBean(systemMBean, distrObjectName);
        this.systemLevelNotifEmitter = (DistributedSystemMBean) service.getDistributedSystemMXBean();
        this.distListener = new DistributedSystemNotifListener();
    }

    if (mapOfMembers != null) {
        mapOfMembers.put(objectName, proxy);
        memberSetSize = mapOfMembers.values().size();

    }
    updateMember(objectName, newState, null);

    try {
        mbeanServer.addNotificationListener(objectName, distListener, null, null);
    } catch (InstanceNotFoundException e) {

        if (logger.isDebugEnabled()) {
            logger.debug(e.getMessage());
        }

        logger.info(LocalizedMessage.create(ManagementStrings.INSTANCE_NOT_FOUND, objectName));
    }
}