@Test public void loadTransactionMsgServiceTest() { TransactionalMessageService transactionService = ServiceProvider.loadClass(ServiceProvider.TRANSACTION_SERVICE_ID, TransactionalMessageService.class); assertThat(transactionService).isNotNull(); }
public static <T> T loadClass(String name, Class<?> clazz) { final InputStream is = getResourceAsStream(getContextClassLoader(), name); if (is != null) { BufferedReader reader; try { try { reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { reader = new BufferedReader(new InputStreamReader(is)); } String serviceName = reader.readLine(); reader.close(); if (serviceName != null && !"".equals(serviceName)) { return initService(getContextClassLoader(), serviceName, clazz); } else { LOG.warn("ServiceName is empty!"); return null; } } catch (Exception e) { LOG.warn("Error occurred when looking for resource file " + name, e); } } return null; }
ServiceProvider { public static <T> T loadClass(String name, Class<?> clazz) { final InputStream is = getResourceAsStream(getContextClassLoader(), name); if (is != null) { BufferedReader reader; try { try { reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { reader = new BufferedReader(new InputStreamReader(is)); } String serviceName = reader.readLine(); reader.close(); if (serviceName != null && !"".equals(serviceName)) { return initService(getContextClassLoader(), serviceName, clazz); } else { LOG.warn("ServiceName is empty!"); return null; } } catch (Exception e) { LOG.warn("Error occurred when looking for resource file " + name, e); } } return null; } }
ServiceProvider { public static <T> T loadClass(String name, Class<?> clazz) { final InputStream is = getResourceAsStream(getContextClassLoader(), name); if (is != null) { BufferedReader reader; try { try { reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { reader = new BufferedReader(new InputStreamReader(is)); } String serviceName = reader.readLine(); reader.close(); if (serviceName != null && !"".equals(serviceName)) { return initService(getContextClassLoader(), serviceName, clazz); } else { LOG.warn("ServiceName is empty!"); return null; } } catch (Exception e) { LOG.warn("Error occurred when looking for resource file " + name, e); } } return null; }  }
ServiceProvider { public static <T> T loadClass(String name, Class<?> clazz) { final InputStream is = getResourceAsStream(getContextClassLoader(), name); if (is != null) { BufferedReader reader; try { try { reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { reader = new BufferedReader(new InputStreamReader(is)); } String serviceName = reader.readLine(); reader.close(); if (serviceName != null && !"".equals(serviceName)) { return initService(getContextClassLoader(), serviceName, clazz); } else { LOG.warn("ServiceName is empty!"); return null; } } catch (Exception e) { LOG.warn("Error occurred when looking for resource file " + name, e); } } return null; }  static List<T> load(String name, Class<?> clazz); static T loadClass(String name, Class<?> clazz); }
ServiceProvider { public static <T> T loadClass(String name, Class<?> clazz) { final InputStream is = getResourceAsStream(getContextClassLoader(), name); if (is != null) { BufferedReader reader; try { try { reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { reader = new BufferedReader(new InputStreamReader(is)); } String serviceName = reader.readLine(); reader.close(); if (serviceName != null && !"".equals(serviceName)) { return initService(getContextClassLoader(), serviceName, clazz); } else { LOG.warn("ServiceName is empty!"); return null; } } catch (Exception e) { LOG.warn("Error occurred when looking for resource file " + name, e); } } return null; }  static List<T> load(String name, Class<?> clazz); static T loadClass(String name, Class<?> clazz); static final String TRANSACTION_SERVICE_ID; static final String TRANSACTION_LISTENER_ID; static final String RPC_HOOK_ID; static final String ACL_VALIDATOR_ID; }