public static Object invokeStaticMethod( String typeString, String methodName, Object[] parameters, Class[] parameterTypes ) { Class type = loadClass( typeString ); return invokeStaticMethod( type, methodName, parameters, parameterTypes ); }
Class<?> target = Util.loadClass( "org.apache.hadoop.yarn.server.timeline.TimelineStore" ); Class<?> type = Util.loadClass( "org.apache.hadoop.yarn.server.timeline.MemoryTimelineStore" ); Util.loadClass( "org.apache.hadoop.yarn.api.records.timeline.TimelineDomain" ); Class<?> target = Util.loadClass( "org.apache.hadoop.yarn.server.applicationhistoryservice.timeline.TimelineStore" ); Class<?> type = Util.loadClass( "org.apache.hadoop.yarn.server.applicationhistoryservice.timeline.MemoryTimelineStore" );
Class<?> target = Util.loadClass( "org.apache.hadoop.yarn.server.timeline.TimelineStore" ); Class<?> type = Util.loadClass( "org.apache.hadoop.yarn.server.timeline.MemoryTimelineStore" ); Util.loadClass( "org.apache.hadoop.yarn.api.records.timeline.TimelineDomain" ); Class<?> target = Util.loadClass( "org.apache.hadoop.yarn.server.applicationhistoryservice.timeline.TimelineStore" ); Class<?> type = Util.loadClass( "org.apache.hadoop.yarn.server.applicationhistoryservice.timeline.MemoryTimelineStore" );
public static String setLog4jLevel( String logger, String level ) { // removing logj4 dependency // org.apache.log4j.Logger.getLogger( logger[ 0 ] ).setLevel( org.apache.log4j.Level.toLevel( logger[ 1 ] ) ); Object loggerObject = Util.invokeStaticMethod( "org.apache.log4j.Logger", "getLogger", new Object[]{logger}, new Class[]{String.class} ); Object levelObject = null; if( level != null ) levelObject = Util.invokeStaticMethod( "org.apache.log4j.Level", "toLevel", new Object[]{level}, new Class[]{String.class} ); Object oldLevel = Util.invokeInstanceMethod( loggerObject, "getLevel", new Object[]{}, new Class[]{} ); Util.invokeInstanceMethod( loggerObject, "setLevel", new Object[]{levelObject}, new Class[]{Util.loadClass( "org.apache.log4j.Level" )} ); if( oldLevel == null ) return null; return oldLevel.toString(); }
outputFormatClass = Util.loadClass( formatClassName ); outputPath = getOutputPath( sinkConf );
outputFormatClass = Util.loadClass( formatClassName ); outputPath = getOutputPath( sinkConf );