Example usage for javax.management InstanceNotFoundException getCause

List of usage examples for javax.management InstanceNotFoundException getCause

Introduction

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

Prototype

public synchronized Throwable getCause() 

Source Link

Document

Returns the cause of this throwable or null if the cause is nonexistent or unknown.

Usage

From source file:net.nicoll.boot.daemon.SpringApplicationAdminClient.java

/**
 * Check if the spring application managed by this instance is ready. Returns
 * {@code false} if the mbean is not yet deployed so this method should be repeatedly
 * called until a timeout is reached./*from   w  w  w  .  j  a v  a 2 s.  c o m*/
 * @return {@code true} if the application is ready to service requests
 * @throws org.springframework.jmx.JmxException if the JMX service could not be contacted
 */
public boolean isReady() {
    try {
        return (Boolean) this.connection.getAttribute(this.objectName, "Ready");
    } catch (InstanceNotFoundException ex) {
        return false; // Instance not available yet
    } catch (AttributeNotFoundException ex) {
        throw new IllegalStateException("Unexpected: attribute 'Ready' not available", ex);
    } catch (ReflectionException ex) {
        throw new JmxException("Failed to retrieve Ready attribute", ex.getCause());
    } catch (MBeanException ex) {
        throw new JmxException(ex.getMessage(), ex);
    } catch (IOException ex) {
        throw new JmxException(ex.getMessage(), ex);
    }
}