public static < S > S prepareInstance ( Class < ? extends S > serviceClass ) { try { final Constructor < ? extends S > constructor = serviceClass . getDeclaredConstructor ( ) ; AccessController . doPrivileged ( new PrivilegedAction < Void > ( ) { @ Override public Void run ( ) { constructor . setAccessible ( true ) ; return null ; } } ) ; return constructor . newInstance ( ) ; } catch ( LinkageError e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "prepareInstance(): Could not instantiate service class " + serviceClass . getName ( ) , e ) ; } return null ; } catch ( InvocationTargetException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "prepareInstance(): The exception happened on loading " + serviceClass . getName ( ) , e ) ; } return null ; } catch ( IllegalArgumentException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "prepareInstance(): The exception happened on loading " + serviceClass . getName ( ) , e ) ; } return null ; } catch ( InstantiationException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "prepareInstance(): The exception happened on loading " + serviceClass . getName ( ) , e ) ; } return null ; } catch ( IllegalAccessException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "prepareInstance(): The exception happened on loading " + serviceClass . getName ( ) , e ) ; } return null ; } catch ( SecurityException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "prepareInstance(): The exception happened on loading " + serviceClass . getName ( ) , e ) ; } return null ; } catch ( NoSuchMethodException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "prepareInstance(): The exception happened on loading " + serviceClass . getName ( ) , e ) ; } return null ; } }
Creates an object of the service class