/// <exception cref="Org.Apache.Hadoop.HA.BadFencingConfigurationException"/> private static NodeFencer.FenceMethodWithArg CreateFenceMethod(Configuration conf , string clazzName, string arg) { Type clazz; try { // See if it's a short name for one of the built-in methods clazz = StandardMethods[clazzName]; if (clazz == null) { // Try to instantiate the user's custom method clazz = Runtime.GetType(clazzName); } } catch (Exception e) { throw new BadFencingConfigurationException("Could not find configured fencing method " + clazzName, e); } // Check that it implements the right interface if (!typeof(FenceMethod).IsAssignableFrom(clazz)) { throw new BadFencingConfigurationException("Class " + clazzName + " does not implement FenceMethod" ); } FenceMethod method = (FenceMethod)ReflectionUtils.NewInstance(clazz, conf); method.CheckArgs(arg); return(new NodeFencer.FenceMethodWithArg(method, arg)); }
private FenceMethodWithArg(FenceMethod method, string arg) { this.method = method; this.arg = arg; }