本文整理汇总了Java中javax.management.RuntimeErrorException类的典型用法代码示例。如果您正苦于以下问题:Java RuntimeErrorException类的具体用法?Java RuntimeErrorException怎么用?Java RuntimeErrorException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RuntimeErrorException类属于javax.management包,在下文中一共展示了RuntimeErrorException类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: throwMBeanRegistrationException
import javax.management.RuntimeErrorException; //导入依赖的package包/类
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);
}
示例2: postRegister
import javax.management.RuntimeErrorException; //导入依赖的package包/类
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");
}
}
示例3: postDeregisterInvoke
import javax.management.RuntimeErrorException; //导入依赖的package包/类
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");
}
}
示例4: postRegister
import javax.management.RuntimeErrorException; //导入依赖的package包/类
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");
}
}
示例5: postDeregisterInvoke
import javax.management.RuntimeErrorException; //导入依赖的package包/类
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");
}
}
示例6: multiply2DMatrix
import javax.management.RuntimeErrorException; //导入依赖的package包/类
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;
}
示例7: determinant2DMatrix
import javax.management.RuntimeErrorException; //导入依赖的package包/类
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!");
}
}
示例8: DeterministicTerminationOption
import javax.management.RuntimeErrorException; //导入依赖的package包/类
/**
* 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;
}
示例9: getStateNode
import javax.management.RuntimeErrorException; //导入依赖的package包/类
/**
* 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;
}
示例10: addSpecificaitonForTiling
import javax.management.RuntimeErrorException; //导入依赖的package包/类
/**
* 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);
}
示例11: sample
import javax.management.RuntimeErrorException; //导入依赖的package包/类
/**
* 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"));
}
示例12: getStateNode
import javax.management.RuntimeErrorException; //导入依赖的package包/类
/**
* 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;
}
示例13: getStateNode
import javax.management.RuntimeErrorException; //导入依赖的package包/类
/**
* 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;
}