javax.management.RuntimeErrorException Java Examples

The following examples show how to use javax.management.RuntimeErrorException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultMBeanServerInterceptor.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void postDeregisterInvoke(ObjectName mbean,
        MBeanRegistration moi) {
    try {
        moi.postDeregister();
    } catch (RuntimeException e) {
        MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
                "]: " + "Exception thrown by postDeregister: " +
                "rethrowing <"+e+">, although the MBean is succesfully " +
                "unregistered");
        throw new RuntimeMBeanException(e,
                  "RuntimeException thrown in postDeregister method: "+
                  "rethrowing <"+e+
                  ">, although the MBean is sucessfully unregistered");
    } catch (Error er) {
        MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
                "]: " + "Error thrown by postDeregister: " +
                "rethrowing <"+er+">, although the MBean is succesfully " +
                "unregistered");
        throw new RuntimeErrorException(er,
                  "Error thrown in postDeregister method: "+
                  "rethrowing <"+er+
                  ">, although the MBean is sucessfully unregistered");
    }
}
 
Example #2
Source File: DefaultMBeanServerInterceptor.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static void postDeregisterInvoke(ObjectName mbean,
        MBeanRegistration moi) {
    try {
        moi.postDeregister();
    } catch (RuntimeException e) {
        MBEANSERVER_LOGGER.log(Level.DEBUG, "While unregistering MBean ["+mbean+
                "]: " + "Exception thrown by postDeregister: " +
                "rethrowing <"+e+">, although the MBean is succesfully " +
                "unregistered");
        throw new RuntimeMBeanException(e,
                  "RuntimeException thrown in postDeregister method: "+
                  "rethrowing <"+e+
                  ">, although the MBean is sucessfully unregistered");
    } catch (Error er) {
        MBEANSERVER_LOGGER.log(Level.DEBUG, "While unregistering MBean ["+mbean+
                "]: " + "Error thrown by postDeregister: " +
                "rethrowing <"+er+">, although the MBean is succesfully " +
                "unregistered");
        throw new RuntimeErrorException(er,
                  "Error thrown in postDeregister method: "+
                  "rethrowing <"+er+
                  ">, although the MBean is sucessfully unregistered");
    }
}
 
Example #3
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void throwMBeanRegistrationException(Throwable t, String where)
throws MBeanRegistrationException {
    if (t instanceof RuntimeException) {
        throw new RuntimeMBeanException((RuntimeException)t,
                "RuntimeException thrown " + where);
    } else if (t instanceof Error) {
        throw new RuntimeErrorException((Error)t,
                "Error thrown " + where);
    } else if (t instanceof MBeanRegistrationException) {
        throw (MBeanRegistrationException)t;
    } else if (t instanceof Exception) {
        throw new MBeanRegistrationException((Exception)t,
                "Exception thrown " + where);
    } else // neither Error nor Exception??
        throw new RuntimeException(t);
}
 
Example #4
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void postRegister(
        ObjectName logicalName, DynamicMBean mbean,
        boolean registrationDone, boolean registerFailed) {

    if (registerFailed && mbean instanceof DynamicMBean2)
        ((DynamicMBean2) mbean).registerFailed();
    try {
        if (mbean instanceof MBeanRegistration)
            ((MBeanRegistration) mbean).postRegister(registrationDone);
    } catch (RuntimeException e) {
        MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
                "]: " + "Exception thrown by postRegister: " +
                "rethrowing <"+e+">, but keeping the MBean registered");
        throw new RuntimeMBeanException(e,
                  "RuntimeException thrown in postRegister method: "+
                  "rethrowing <"+e+">, but keeping the MBean registered");
    } catch (Error er) {
        MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
                "]: " + "Error thrown by postRegister: " +
                "rethrowing <"+er+">, but keeping the MBean registered");
        throw new RuntimeErrorException(er,
                  "Error thrown in postRegister method: "+
                  "rethrowing <"+er+">, but keeping the MBean registered");
    }
}
 
Example #5
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void postDeregisterInvoke(ObjectName mbean,
        MBeanRegistration moi) {
    try {
        moi.postDeregister();
    } catch (RuntimeException e) {
        MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
                "]: " + "Exception thrown by postDeregister: " +
                "rethrowing <"+e+">, although the MBean is succesfully " +
                "unregistered");
        throw new RuntimeMBeanException(e,
                  "RuntimeException thrown in postDeregister method: "+
                  "rethrowing <"+e+
                  ">, although the MBean is sucessfully unregistered");
    } catch (Error er) {
        MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
                "]: " + "Error thrown by postDeregister: " +
                "rethrowing <"+er+">, although the MBean is succesfully " +
                "unregistered");
        throw new RuntimeErrorException(er,
                  "Error thrown in postDeregister method: "+
                  "rethrowing <"+er+
                  ">, although the MBean is sucessfully unregistered");
    }
}
 
Example #6
Source File: DefaultMBeanServerInterceptor.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private static void throwMBeanRegistrationException(Throwable t, String where)
throws MBeanRegistrationException {
    if (t instanceof RuntimeException) {
        throw new RuntimeMBeanException((RuntimeException)t,
                "RuntimeException thrown " + where);
    } else if (t instanceof Error) {
        throw new RuntimeErrorException((Error)t,
                "Error thrown " + where);
    } else if (t instanceof MBeanRegistrationException) {
        throw (MBeanRegistrationException)t;
    } else if (t instanceof Exception) {
        throw new MBeanRegistrationException((Exception)t,
                "Exception thrown " + where);
    } else // neither Error nor Exception??
        throw new RuntimeException(t);
}
 
Example #7
Source File: DefaultMBeanServerInterceptor.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static void postRegister(
        ObjectName logicalName, DynamicMBean mbean,
        boolean registrationDone, boolean registerFailed) {

    if (registerFailed && mbean instanceof DynamicMBean2)
        ((DynamicMBean2) mbean).registerFailed();
    try {
        if (mbean instanceof MBeanRegistration)
            ((MBeanRegistration) mbean).postRegister(registrationDone);
    } catch (RuntimeException e) {
        MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
                "]: " + "Exception thrown by postRegister: " +
                "rethrowing <"+e+">, but keeping the MBean registered");
        throw new RuntimeMBeanException(e,
                  "RuntimeException thrown in postRegister method: "+
                  "rethrowing <"+e+">, but keeping the MBean registered");
    } catch (Error er) {
        MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
                "]: " + "Error thrown by postRegister: " +
                "rethrowing <"+er+">, but keeping the MBean registered");
        throw new RuntimeErrorException(er,
                  "Error thrown in postRegister method: "+
                  "rethrowing <"+er+">, but keeping the MBean registered");
    }
}
 
Example #8
Source File: DefaultMBeanServerInterceptor.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static void postDeregisterInvoke(ObjectName mbean,
        MBeanRegistration moi) {
    try {
        moi.postDeregister();
    } catch (RuntimeException e) {
        MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
                "]: " + "Exception thrown by postDeregister: " +
                "rethrowing <"+e+">, although the MBean is succesfully " +
                "unregistered");
        throw new RuntimeMBeanException(e,
                  "RuntimeException thrown in postDeregister method: "+
                  "rethrowing <"+e+
                  ">, although the MBean is sucessfully unregistered");
    } catch (Error er) {
        MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
                "]: " + "Error thrown by postDeregister: " +
                "rethrowing <"+er+">, although the MBean is succesfully " +
                "unregistered");
        throw new RuntimeErrorException(er,
                  "Error thrown in postDeregister method: "+
                  "rethrowing <"+er+
                  ">, although the MBean is sucessfully unregistered");
    }
}
 
Example #9
Source File: DefaultMBeanServerInterceptor.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static void throwMBeanRegistrationException(Throwable t, String where)
throws MBeanRegistrationException {
    if (t instanceof RuntimeException) {
        throw new RuntimeMBeanException((RuntimeException)t,
                "RuntimeException thrown " + where);
    } else if (t instanceof Error) {
        throw new RuntimeErrorException((Error)t,
                "Error thrown " + where);
    } else if (t instanceof MBeanRegistrationException) {
        throw (MBeanRegistrationException)t;
    } else if (t instanceof Exception) {
        throw new MBeanRegistrationException((Exception)t,
                "Exception thrown " + where);
    } else // neither Error nor Exception??
        throw new RuntimeException(t);
}
 
Example #10
Source File: DefaultMBeanServerInterceptor.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static void postRegister(
        ObjectName logicalName, DynamicMBean mbean,
        boolean registrationDone, boolean registerFailed) {

    if (registerFailed && mbean instanceof DynamicMBean2)
        ((DynamicMBean2) mbean).registerFailed();
    try {
        if (mbean instanceof MBeanRegistration)
            ((MBeanRegistration) mbean).postRegister(registrationDone);
    } catch (RuntimeException e) {
        MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
                "]: " + "Exception thrown by postRegister: " +
                "rethrowing <"+e+">, but keeping the MBean registered");
        throw new RuntimeMBeanException(e,
                  "RuntimeException thrown in postRegister method: "+
                  "rethrowing <"+e+">, but keeping the MBean registered");
    } catch (Error er) {
        MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
                "]: " + "Error thrown by postRegister: " +
                "rethrowing <"+er+">, but keeping the MBean registered");
        throw new RuntimeErrorException(er,
                  "Error thrown in postRegister method: "+
                  "rethrowing <"+er+">, but keeping the MBean registered");
    }
}
 
Example #11
Source File: DefaultMBeanServerInterceptor.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static void postDeregisterInvoke(ObjectName mbean,
        MBeanRegistration moi) {
    try {
        moi.postDeregister();
    } catch (RuntimeException e) {
        MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
                "]: " + "Exception thrown by postDeregister: " +
                "rethrowing <"+e+">, although the MBean is succesfully " +
                "unregistered");
        throw new RuntimeMBeanException(e,
                  "RuntimeException thrown in postDeregister method: "+
                  "rethrowing <"+e+
                  ">, although the MBean is sucessfully unregistered");
    } catch (Error er) {
        MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
                "]: " + "Error thrown by postDeregister: " +
                "rethrowing <"+er+">, although the MBean is succesfully " +
                "unregistered");
        throw new RuntimeErrorException(er,
                  "Error thrown in postDeregister method: "+
                  "rethrowing <"+er+
                  ">, although the MBean is sucessfully unregistered");
    }
}
 
Example #12
Source File: DefaultMBeanServerInterceptor.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void throwMBeanRegistrationException(Throwable t, String where)
throws MBeanRegistrationException {
    if (t instanceof RuntimeException) {
        throw new RuntimeMBeanException((RuntimeException)t,
                "RuntimeException thrown " + where);
    } else if (t instanceof Error) {
        throw new RuntimeErrorException((Error)t,
                "Error thrown " + where);
    } else if (t instanceof MBeanRegistrationException) {
        throw (MBeanRegistrationException)t;
    } else if (t instanceof Exception) {
        throw new MBeanRegistrationException((Exception)t,
                "Exception thrown " + where);
    } else // neither Error nor Exception??
        throw new RuntimeException(t);
}
 
Example #13
Source File: DefaultMBeanServerInterceptor.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void postRegister(
        ObjectName logicalName, DynamicMBean mbean,
        boolean registrationDone, boolean registerFailed) {

    if (registerFailed && mbean instanceof DynamicMBean2)
        ((DynamicMBean2) mbean).registerFailed();
    try {
        if (mbean instanceof MBeanRegistration)
            ((MBeanRegistration) mbean).postRegister(registrationDone);
    } catch (RuntimeException e) {
        MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
                "]: " + "Exception thrown by postRegister: " +
                "rethrowing <"+e+">, but keeping the MBean registered");
        throw new RuntimeMBeanException(e,
                  "RuntimeException thrown in postRegister method: "+
                  "rethrowing <"+e+">, but keeping the MBean registered");
    } catch (Error er) {
        MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
                "]: " + "Error thrown by postRegister: " +
                "rethrowing <"+er+">, but keeping the MBean registered");
        throw new RuntimeErrorException(er,
                  "Error thrown in postRegister method: "+
                  "rethrowing <"+er+">, but keeping the MBean registered");
    }
}
 
Example #14
Source File: DefaultMBeanServerInterceptor.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static void throwMBeanRegistrationException(Throwable t, String where)
throws MBeanRegistrationException {
    if (t instanceof RuntimeException) {
        throw new RuntimeMBeanException((RuntimeException)t,
                "RuntimeException thrown " + where);
    } else if (t instanceof Error) {
        throw new RuntimeErrorException((Error)t,
                "Error thrown " + where);
    } else if (t instanceof MBeanRegistrationException) {
        throw (MBeanRegistrationException)t;
    } else if (t instanceof Exception) {
        throw new MBeanRegistrationException((Exception)t,
                "Exception thrown " + where);
    } else // neither Error nor Exception??
        throw new RuntimeException(t);
}
 
Example #15
Source File: DefaultMBeanServerInterceptor.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void throwMBeanRegistrationException(Throwable t, String where)
throws MBeanRegistrationException {
    if (t instanceof RuntimeException) {
        throw new RuntimeMBeanException((RuntimeException)t,
                "RuntimeException thrown " + where);
    } else if (t instanceof Error) {
        throw new RuntimeErrorException((Error)t,
                "Error thrown " + where);
    } else if (t instanceof MBeanRegistrationException) {
        throw (MBeanRegistrationException)t;
    } else if (t instanceof Exception) {
        throw new MBeanRegistrationException((Exception)t,
                "Exception thrown " + where);
    } else // neither Error nor Exception??
        throw new RuntimeException(t);
}
 
Example #16
Source File: DefaultMBeanServerInterceptor.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void postRegister(
        ObjectName logicalName, DynamicMBean mbean,
        boolean registrationDone, boolean registerFailed) {

    if (registerFailed && mbean instanceof DynamicMBean2)
        ((DynamicMBean2) mbean).registerFailed();
    try {
        if (mbean instanceof MBeanRegistration)
            ((MBeanRegistration) mbean).postRegister(registrationDone);
    } catch (RuntimeException e) {
        MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
                "]: " + "Exception thrown by postRegister: " +
                "rethrowing <"+e+">, but keeping the MBean registered");
        throw new RuntimeMBeanException(e,
                  "RuntimeException thrown in postRegister method: "+
                  "rethrowing <"+e+">, but keeping the MBean registered");
    } catch (Error er) {
        MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
                "]: " + "Error thrown by postRegister: " +
                "rethrowing <"+er+">, but keeping the MBean registered");
        throw new RuntimeErrorException(er,
                  "Error thrown in postRegister method: "+
                  "rethrowing <"+er+">, but keeping the MBean registered");
    }
}
 
Example #17
Source File: DefaultMBeanServerInterceptor.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void postDeregisterInvoke(ObjectName mbean,
        MBeanRegistration moi) {
    try {
        moi.postDeregister();
    } catch (RuntimeException e) {
        MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
                "]: " + "Exception thrown by postDeregister: " +
                "rethrowing <"+e+">, although the MBean is succesfully " +
                "unregistered");
        throw new RuntimeMBeanException(e,
                  "RuntimeException thrown in postDeregister method: "+
                  "rethrowing <"+e+
                  ">, although the MBean is sucessfully unregistered");
    } catch (Error er) {
        MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
                "]: " + "Error thrown by postDeregister: " +
                "rethrowing <"+er+">, although the MBean is succesfully " +
                "unregistered");
        throw new RuntimeErrorException(er,
                  "Error thrown in postDeregister method: "+
                  "rethrowing <"+er+
                  ">, although the MBean is sucessfully unregistered");
    }
}
 
Example #18
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void throwMBeanRegistrationException(Throwable t, String where)
throws MBeanRegistrationException {
    if (t instanceof RuntimeException) {
        throw new RuntimeMBeanException((RuntimeException)t,
                "RuntimeException thrown " + where);
    } else if (t instanceof Error) {
        throw new RuntimeErrorException((Error)t,
                "Error thrown " + where);
    } else if (t instanceof MBeanRegistrationException) {
        throw (MBeanRegistrationException)t;
    } else if (t instanceof Exception) {
        throw new MBeanRegistrationException((Exception)t,
                "Exception thrown " + where);
    } else // neither Error nor Exception??
        throw new RuntimeException(t);
}
 
Example #19
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void postRegister(
        ObjectName logicalName, DynamicMBean mbean,
        boolean registrationDone, boolean registerFailed) {

    if (registerFailed && mbean instanceof DynamicMBean2)
        ((DynamicMBean2) mbean).registerFailed();
    try {
        if (mbean instanceof MBeanRegistration)
            ((MBeanRegistration) mbean).postRegister(registrationDone);
    } catch (RuntimeException e) {
        MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
                "]: " + "Exception thrown by postRegister: " +
                "rethrowing <"+e+">, but keeping the MBean registered");
        throw new RuntimeMBeanException(e,
                  "RuntimeException thrown in postRegister method: "+
                  "rethrowing <"+e+">, but keeping the MBean registered");
    } catch (Error er) {
        MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
                "]: " + "Error thrown by postRegister: " +
                "rethrowing <"+er+">, but keeping the MBean registered");
        throw new RuntimeErrorException(er,
                  "Error thrown in postRegister method: "+
                  "rethrowing <"+er+">, but keeping the MBean registered");
    }
}
 
Example #20
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void postDeregisterInvoke(ObjectName mbean,
        MBeanRegistration moi) {
    try {
        moi.postDeregister();
    } catch (RuntimeException e) {
        MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
                "]: " + "Exception thrown by postDeregister: " +
                "rethrowing <"+e+">, although the MBean is succesfully " +
                "unregistered");
        throw new RuntimeMBeanException(e,
                  "RuntimeException thrown in postDeregister method: "+
                  "rethrowing <"+e+
                  ">, although the MBean is sucessfully unregistered");
    } catch (Error er) {
        MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
                "]: " + "Error thrown by postDeregister: " +
                "rethrowing <"+er+">, although the MBean is succesfully " +
                "unregistered");
        throw new RuntimeErrorException(er,
                  "Error thrown in postDeregister method: "+
                  "rethrowing <"+er+
                  ">, although the MBean is sucessfully unregistered");
    }
}
 
Example #21
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void throwMBeanRegistrationException(Throwable t, String where)
throws MBeanRegistrationException {
    if (t instanceof RuntimeException) {
        throw new RuntimeMBeanException((RuntimeException)t,
                "RuntimeException thrown " + where);
    } else if (t instanceof Error) {
        throw new RuntimeErrorException((Error)t,
                "Error thrown " + where);
    } else if (t instanceof MBeanRegistrationException) {
        throw (MBeanRegistrationException)t;
    } else if (t instanceof Exception) {
        throw new MBeanRegistrationException((Exception)t,
                "Exception thrown " + where);
    } else // neither Error nor Exception??
        throw new RuntimeException(t);
}
 
Example #22
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void postRegister(
        ObjectName logicalName, DynamicMBean mbean,
        boolean registrationDone, boolean registerFailed) {

    if (registerFailed && mbean instanceof DynamicMBean2)
        ((DynamicMBean2) mbean).registerFailed();
    try {
        if (mbean instanceof MBeanRegistration)
            ((MBeanRegistration) mbean).postRegister(registrationDone);
    } catch (RuntimeException e) {
        MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
                "]: " + "Exception thrown by postRegister: " +
                "rethrowing <"+e+">, but keeping the MBean registered");
        throw new RuntimeMBeanException(e,
                  "RuntimeException thrown in postRegister method: "+
                  "rethrowing <"+e+">, but keeping the MBean registered");
    } catch (Error er) {
        MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
                "]: " + "Error thrown by postRegister: " +
                "rethrowing <"+er+">, but keeping the MBean registered");
        throw new RuntimeErrorException(er,
                  "Error thrown in postRegister method: "+
                  "rethrowing <"+er+">, but keeping the MBean registered");
    }
}
 
Example #23
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void postDeregisterInvoke(ObjectName mbean,
        MBeanRegistration moi) {
    try {
        moi.postDeregister();
    } catch (RuntimeException e) {
        MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
                "]: " + "Exception thrown by postDeregister: " +
                "rethrowing <"+e+">, although the MBean is succesfully " +
                "unregistered");
        throw new RuntimeMBeanException(e,
                  "RuntimeException thrown in postDeregister method: "+
                  "rethrowing <"+e+
                  ">, although the MBean is sucessfully unregistered");
    } catch (Error er) {
        MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
                "]: " + "Error thrown by postDeregister: " +
                "rethrowing <"+er+">, although the MBean is succesfully " +
                "unregistered");
        throw new RuntimeErrorException(er,
                  "Error thrown in postDeregister method: "+
                  "rethrowing <"+er+
                  ">, although the MBean is sucessfully unregistered");
    }
}
 
Example #24
Source File: QLearning.java    From burlap with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the {@link QLearningStateNode} object stored for the given hashed state. If no {@link QLearningStateNode} object.
 * is stored, then it is created and has its Q-value initialize using this objects {@link burlap.behavior.valuefunction.QFunction} data member.
 * @param s the hashed state for which to get the {@link QLearningStateNode} object
 * @return the {@link QLearningStateNode} object stored for the given hashed state. If no {@link QLearningStateNode} object.
 */
protected QLearningStateNode getStateNode(HashableState s){
	
	QLearningStateNode node = qFunction.get(s);
	
	if(node == null){
		node = new QLearningStateNode(s);
		List<Action> gas = this.applicableActions(s.s());
		if(gas.isEmpty()){
			gas = this.applicableActions(s.s());
			throw new RuntimeErrorException(new Error("No possible actions in this state, cannot continue Q-learning"));
		}
		for(Action ga : gas){
			node.addQValue(ga, qInitFunction.qValue(s.s(), ga));
		}
		
		qFunction.put(s, node);
	}
	
	return node;
	
}
 
Example #25
Source File: BoltzmannDistribution.java    From burlap with Apache License 2.0 6 votes vote down vote up
/**
 * Samples the output probability distribution.
 * @return the index of the sampled element
 */
public int sample(){
	
	if(this.needsUpdate){
		this.computeProbs();
	}
	
	double r = this.rand.nextDouble();
	double sum = 0.;
	for(int i = 0; i < this.probs.length; i++){
		sum += this.probs[i];
		if(r < sum){
			return i;
		}
	}
	
	throw new RuntimeErrorException(new Error("Error in sample; Boltzmann distribution did not sum to 1"));
	
}
 
Example #26
Source File: DefaultMBeanServerInterceptor.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static void throwMBeanRegistrationException(Throwable t, String where)
throws MBeanRegistrationException {
    if (t instanceof RuntimeException) {
        throw new RuntimeMBeanException((RuntimeException)t,
                "RuntimeException thrown " + where);
    } else if (t instanceof Error) {
        throw new RuntimeErrorException((Error)t,
                "Error thrown " + where);
    } else if (t instanceof MBeanRegistrationException) {
        throw (MBeanRegistrationException)t;
    } else if (t instanceof Exception) {
        throw new MBeanRegistrationException((Exception)t,
                "Exception thrown " + where);
    } else // neither Error nor Exception??
        throw new RuntimeException(t);
}
 
Example #27
Source File: DefaultMBeanServerInterceptor.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private static void postRegister(
        ObjectName logicalName, DynamicMBean mbean,
        boolean registrationDone, boolean registerFailed) {

    if (registerFailed && mbean instanceof DynamicMBean2)
        ((DynamicMBean2) mbean).registerFailed();
    try {
        if (mbean instanceof MBeanRegistration)
            ((MBeanRegistration) mbean).postRegister(registrationDone);
    } catch (RuntimeException e) {
        MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
                "]: " + "Exception thrown by postRegister: " +
                "rethrowing <"+e+">, but keeping the MBean registered");
        throw new RuntimeMBeanException(e,
                  "RuntimeException thrown in postRegister method: "+
                  "rethrowing <"+e+">, but keeping the MBean registered");
    } catch (Error er) {
        MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
                "]: " + "Error thrown by postRegister: " +
                "rethrowing <"+er+">, but keeping the MBean registered");
        throw new RuntimeErrorException(er,
                  "Error thrown in postRegister method: "+
                  "rethrowing <"+er+">, but keeping the MBean registered");
    }
}
 
Example #28
Source File: DefaultMBeanServerInterceptor.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private static void postDeregisterInvoke(ObjectName mbean,
        MBeanRegistration moi) {
    try {
        moi.postDeregister();
    } catch (RuntimeException e) {
        MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
                "]: " + "Exception thrown by postDeregister: " +
                "rethrowing <"+e+">, although the MBean is succesfully " +
                "unregistered");
        throw new RuntimeMBeanException(e,
                  "RuntimeException thrown in postDeregister method: "+
                  "rethrowing <"+e+
                  ">, although the MBean is sucessfully unregistered");
    } catch (Error er) {
        MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
                "]: " + "Error thrown by postDeregister: " +
                "rethrowing <"+er+">, although the MBean is succesfully " +
                "unregistered");
        throw new RuntimeErrorException(er,
                  "Error thrown in postDeregister method: "+
                  "rethrowing <"+er+
                  ">, although the MBean is sucessfully unregistered");
    }
}
 
Example #29
Source File: DefaultMBeanServerInterceptor.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void throwMBeanRegistrationException(Throwable t, String where)
throws MBeanRegistrationException {
    if (t instanceof RuntimeException) {
        throw new RuntimeMBeanException((RuntimeException)t,
                "RuntimeException thrown " + where);
    } else if (t instanceof Error) {
        throw new RuntimeErrorException((Error)t,
                "Error thrown " + where);
    } else if (t instanceof MBeanRegistrationException) {
        throw (MBeanRegistrationException)t;
    } else if (t instanceof Exception) {
        throw new MBeanRegistrationException((Exception)t,
                "Exception thrown " + where);
    } else // neither Error nor Exception??
        throw new RuntimeException(t);
}
 
Example #30
Source File: DefaultMBeanServerInterceptor.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void postRegister(
        ObjectName logicalName, DynamicMBean mbean,
        boolean registrationDone, boolean registerFailed) {

    if (registerFailed && mbean instanceof DynamicMBean2)
        ((DynamicMBean2) mbean).registerFailed();
    try {
        if (mbean instanceof MBeanRegistration)
            ((MBeanRegistration) mbean).postRegister(registrationDone);
    } catch (RuntimeException e) {
        MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
                "]: " + "Exception thrown by postRegister: " +
                "rethrowing <"+e+">, but keeping the MBean registered");
        throw new RuntimeMBeanException(e,
                  "RuntimeException thrown in postRegister method: "+
                  "rethrowing <"+e+">, but keeping the MBean registered");
    } catch (Error er) {
        MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
                "]: " + "Error thrown by postRegister: " +
                "rethrowing <"+er+">, but keeping the MBean registered");
        throw new RuntimeErrorException(er,
                  "Error thrown in postRegister method: "+
                  "rethrowing <"+er+">, but keeping the MBean registered");
    }
}