Java 类javax.management.RuntimeErrorException 实例源码

项目:OpenJSharp    文件:DefaultMBeanServerInterceptor.java   
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);
}
项目:OpenJSharp    文件:DefaultMBeanServerInterceptor.java   
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");
    }
}
项目:OpenJSharp    文件:DefaultMBeanServerInterceptor.java   
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");
    }
}
项目:jdk8u-jdk    文件:DefaultMBeanServerInterceptor.java   
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);
}
项目:jdk8u-jdk    文件:DefaultMBeanServerInterceptor.java   
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");
    }
}
项目:jdk8u-jdk    文件:DefaultMBeanServerInterceptor.java   
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");
    }
}
项目:openjdk-jdk10    文件:DefaultMBeanServerInterceptor.java   
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);
}
项目:openjdk-jdk10    文件:DefaultMBeanServerInterceptor.java   
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.log(Level.DEBUG, "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.log(Level.DEBUG, "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");
    }
}
项目:openjdk-jdk10    文件:DefaultMBeanServerInterceptor.java   
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");
    }
}
项目:openjdk9    文件:DefaultMBeanServerInterceptor.java   
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);
}
项目:openjdk9    文件:DefaultMBeanServerInterceptor.java   
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");
    }
}
项目:openjdk9    文件:DefaultMBeanServerInterceptor.java   
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");
    }
}
项目:easyMath    文件:EasyMath.java   
public static int[][] multiply2DMatrix(int[][] firstMatrix,
        int[][] secondMatrix) {
    int[][] result = new int[firstMatrix.length][secondMatrix[0].length];
    if (firstMatrix[0].length == secondMatrix.length) {
        for (int i = 0; i < firstMatrix.length; i++) {
            for (int j = 0; j < secondMatrix[0].length; j++) {
                for (int k = 0; k < firstMatrix[0].length; k++) {
                    result[i][j] += firstMatrix[i][k] * secondMatrix[k][j];
                }
            }
        }
    } else {
        throw new RuntimeErrorException(null,
                "Column number of first matrix" + "("
                        + firstMatrix[0].length
                        + ")  is not equal to row number" + "("
                        + secondMatrix.length + ") of second matrix");
    }
    return result;
}
项目:easyMath    文件:EasyMath.java   
public static double determinant2DMatrix(double[][] matrix)
        throws Exception {
    int n = matrix.length - 1;
    int m = matrix[0].length;
    if (n + 1 == m) {
        if (n < 0)
            return 0;
        double Matrix[][][] = new double[n + 1][][];

        Matrix[n] = matrix; //

        for (int i = 0; i < n; i++)
            Matrix[i] = new double[i + 1][i + 1];
        return Helper(Matrix, n);
    } else {
        Error e = new Error("Matematik");
        throw new RuntimeErrorException(e, "Given matrix is not square!");
    }

}
项目:jdk8u_jdk    文件:DefaultMBeanServerInterceptor.java   
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);
}
项目:jdk8u_jdk    文件:DefaultMBeanServerInterceptor.java   
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");
    }
}
项目:jdk8u_jdk    文件:DefaultMBeanServerInterceptor.java   
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");
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:DefaultMBeanServerInterceptor.java   
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);
}
项目:lookaside_java-1.8.0-openjdk    文件:DefaultMBeanServerInterceptor.java   
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");
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:DefaultMBeanServerInterceptor.java   
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");
    }
}
项目:DOO-Q_BRACIS2016    文件:DeterministicTerminationOption.java   
/**
 * Initializes the option by creating the policy uses some provided option. The valueFunction is called repeatedly on each state in the
 * the list <code>seedStatesForPlanning</code> and then
 * sets this options policy to the valueFunction derived policy that is provided.
 * @param name the name of the option
 * @param init the initiation conditions of the option
 * @param terminationStates the termination states of the option
 * @param seedStatesForPlanning the states that should be used as initial states for the valueFunction
 * @param planner the valueFunction that is used to create the policy for this option
 * @param p the valueFunction derived policy to use after planning from each initial state is performed.
 */
public DeterministicTerminationOption(String name, StateConditionTest init, StateConditionTest terminationStates, List<State> seedStatesForPlanning,
                                      Planner planner, SolverDerivedPolicy p){

    if(!(p instanceof Policy)){
        throw new RuntimeErrorException(new Error("PlannerDerivedPolicy p is not an instnace of Policy"));
    }


    this.name = name;

    this.initiationTest = init;
    this.terminationStates = terminationStates;

    //now construct the policy using the valueFunction from each possible initiation state
    for(State si : seedStatesForPlanning){
        planner.planFromState(si);
    }

    p.setSolver(planner);
    this.policy = (Policy)p;

}
项目:DOO-Q_BRACIS2016    文件:QLearning.java   
/**
 * 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.ValueFunctionInitialization} 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 = qIndex.get(s);

    if(node == null){
        node = new QLearningStateNode(s);
        List<GroundedAction> gas = this.getAllGroundedActions(s.s);
        if(gas.size() == 0){
            gas = this.getAllGroundedActions(s.s);
            throw new RuntimeErrorException(new Error("No possible actions in this state, cannot continue Q-learning"));
        }
        for(GroundedAction ga : gas){
            node.addQValue(ga, qInitFunction.qValue(s.s, ga));
        }

        qIndex.put(s, node);
    }

    return node;

}
项目:DOO-Q_BRACIS2016    文件:CMACFeatureDatabase.java   
/**
 * Causes the <code>i</code>th tiling in this CMAC to be defined over the given attribute for the given OO-MDP class. Along that
 * dimension, the tiling will have a width of <code>windowSize</code>.
 * @param className the OO-MDP class name for which the provided attribute will be tiled.
 * @param attribute the OO-MDP attribute that will be tiled
 * @param windowSize the width of tilings over the specified attribute and OO-MDP class.
 */
public void addSpecificaitonForTiling(int i, String className, Attribute attribute, double windowSize){

    double bucketBoundary = 0.;
    if(this.arrangement == TilingArrangement.RANDOMJITTER){
        bucketBoundary = rand.nextDouble()*windowSize;
    }
    else if(this.arrangement == TilingArrangement.UNIFORM){
        bucketBoundary = ((double)i / (double)nTilings)*windowSize;
    }
    else{
        throw new RuntimeErrorException(new Error("Unknown CMAC tiling arrangement type"));
    }
    Tiling tiling = tilings.get(i);
    tiling.addSpecification(className, attribute, windowSize, bucketBoundary);

}
项目:DOO-Q_BRACIS2016    文件:BoltzmannDistribution.java   
/**
 * 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"));

}
项目:DOO-Q_BRACIS2016    文件:GoldMineSAAlgorithmQLearning.java   
/**
 * 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.ValueFunctionInitialization} 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.
 */
@Override
protected QLearningStateNode getStateNode(HashableState s){
    //System.out.println("getStateNode");
    QLearningStateNode node = qIndex.get(s);
    if(node == null){
        node = new QLearningStateNode(s);
        List<GroundedAction> gas = this.getAllGroundedActions(s.s);
        if(gas.size() == 0){
            gas = this.getAllGroundedActions(s.s);
            throw new RuntimeErrorException(new Error("No possible actions in this state, cannot continue Q-learning"));
        }
        for(GroundedAction ga : gas){
            if(ga.applicableInState(s.s)){
                node.addQValue(ga, qInitFunction.qValue(s.s, ga));
                this.qTableSize++;
            }
        }
        qIndex.put(s, node);
    }
    return node;
}
项目:DOO-Q_BRACIS2016    文件:DeterministicTerminationOption.java   
/**
 * Initializes the option by creating the policy uses some provided option. The valueFunction is called repeatedly on each state in the
 * the list <code>seedStatesForPlanning</code> and then
 * sets this options policy to the valueFunction derived policy that is provided.
 * @param name the name of the option
 * @param init the initiation conditions of the option
 * @param terminationStates the termination states of the option
 * @param seedStatesForPlanning the states that should be used as initial states for the valueFunction
 * @param planner the valueFunction that is used to create the policy for this option
 * @param p the valueFunction derived policy to use after planning from each initial state is performed.
 */
public DeterministicTerminationOption(String name, StateConditionTest init, StateConditionTest terminationStates, List<State> seedStatesForPlanning,
                                      Planner planner, SolverDerivedPolicy p){

    if(!(p instanceof Policy)){
        throw new RuntimeErrorException(new Error("PlannerDerivedPolicy p is not an instnace of Policy"));
    }


    this.name = name;

    this.initiationTest = init;
    this.terminationStates = terminationStates;

    //now construct the policy using the valueFunction from each possible initiation state
    for(State si : seedStatesForPlanning){
        planner.planFromState(si);
    }

    p.setSolver(planner);
    this.policy = (Policy)p;

}
项目:DOO-Q_BRACIS2016    文件:QLearning.java   
/**
 * 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.ValueFunctionInitialization} 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 = qIndex.get(s);

    if(node == null){
        node = new QLearningStateNode(s);
        List<GroundedAction> gas = this.getAllGroundedActions(s.s);
        if(gas.size() == 0){
            gas = this.getAllGroundedActions(s.s);
            throw new RuntimeErrorException(new Error("No possible actions in this state, cannot continue Q-learning"));
        }
        for(GroundedAction ga : gas){
            node.addQValue(ga, qInitFunction.qValue(s.s, ga));
        }

        qIndex.put(s, node);
    }

    return node;

}
项目:DOO-Q_BRACIS2016    文件:CMACFeatureDatabase.java   
/**
 * Causes the <code>i</code>th tiling in this CMAC to be defined over the given attribute for the given OO-MDP class. Along that
 * dimension, the tiling will have a width of <code>windowSize</code>.
 * @param className the OO-MDP class name for which the provided attribute will be tiled.
 * @param attribute the OO-MDP attribute that will be tiled
 * @param windowSize the width of tilings over the specified attribute and OO-MDP class.
 */
public void addSpecificaitonForTiling(int i, String className, Attribute attribute, double windowSize){

    double bucketBoundary = 0.;
    if(this.arrangement == TilingArrangement.RANDOMJITTER){
        bucketBoundary = rand.nextDouble()*windowSize;
    }
    else if(this.arrangement == TilingArrangement.UNIFORM){
        bucketBoundary = ((double)i / (double)nTilings)*windowSize;
    }
    else{
        throw new RuntimeErrorException(new Error("Unknown CMAC tiling arrangement type"));
    }
    Tiling tiling = tilings.get(i);
    tiling.addSpecification(className, attribute, windowSize, bucketBoundary);

}
项目:DOO-Q_BRACIS2016    文件:BoltzmannDistribution.java   
/**
 * 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"));

}
项目:DOO-Q_BRACIS2016    文件:DistributedQTable.java   
/**
 * 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.ValueFunctionInitialization} 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 = qValues.get(s);

    if(node == null){
        node = new QLearningStateNode(s);
        List<GroundedSGAgentAction> gas;
        gas = this.getAllGroundedActions(s.s);

        if(gas.size() == 0){
            throw new RuntimeErrorException(new Error("No possible actions in this state, cannot continue Q-learning"));
        }
        for(GroundedSGAgentAction ga : gas){
            if(ga.applicableInState(s.s)){
                node.addQValue(ga, qInit.qValue(s.s, ga));
                this.entriesNumber++;
            }
        }

        qValues.put(s, node);
    }

    return node;

}
项目:infobip-open-jdk-8    文件:DefaultMBeanServerInterceptor.java   
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);
}
项目:infobip-open-jdk-8    文件:DefaultMBeanServerInterceptor.java   
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");
    }
}
项目:infobip-open-jdk-8    文件:DefaultMBeanServerInterceptor.java   
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");
    }
}
项目:jdk8u-dev-jdk    文件:DefaultMBeanServerInterceptor.java   
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);
}
项目:jdk8u-dev-jdk    文件:DefaultMBeanServerInterceptor.java   
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");
    }
}
项目:jdk8u-dev-jdk    文件:DefaultMBeanServerInterceptor.java   
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");
    }
}
项目:jdk7-jdk    文件:DefaultMBeanServerInterceptor.java   
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);
}
项目:jdk7-jdk    文件:DefaultMBeanServerInterceptor.java   
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");
    }
}
项目:jdk7-jdk    文件:DefaultMBeanServerInterceptor.java   
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");
    }
}
项目:openjdk-source-code-learn    文件:DefaultMBeanServerInterceptor.java   
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);
}