public static <T> T getSingletonInstance(Class<T> beanClass) throws RuntimeException { // we don't mind sometimes instantiating the bean multiple times, // as long as the duplicates never escape into the outside world. if(!singletonBeanInstances.containsKey(beanClass)) { T bean = null; try { bean = beanClass.newInstance(); Properties properties = PropertiesFactory.getDefaultProperties(); configureFromProperties(bean, properties); } catch (Exception e) { throw new RuntimeException(e); } singletonBeanInstances.putIfAbsent(beanClass, bean); } return (T)singletonBeanInstances.get(beanClass); }
private static <T> T getNamedInstance(Class<T> beanClass, String name, Properties properties) throws RuntimeException { StringBuilder sb = new StringBuilder().append(beanClass.getName()); if (name != null) sb.append(":").append(name); String key = sb.toString(); // we don't mind sometimes instantiating the bean multiple times, // as long as the duplicates never escape into the outside world. if(!beanInstances.containsKey(key)) { T bean = null; try { bean = beanClass.newInstance(); if (properties != null) { configureFromProperties(bean, name, properties); } else { Properties defaultProperties = PropertiesFactory.getDefaultProperties(); configureFromProperties(bean, name, defaultProperties); } } catch (Throwable e) { throw new RuntimeException(e); } beanInstances.putIfAbsent(key, bean); } return (T) beanInstances.get(key); }
private static <T> T getNamedInstance(Class<T> beanClass, String name, Properties properties) throws RuntimeException { StringBuilder sb = new StringBuilder().append(beanClass.getName()); if (name != null) sb.append(":").append(name); String key = sb.toString(); // we don't mind sometimes instantiating the bean multiple times, // as long as the duplicates never escape into the outside world. if(!beanInstances.containsKey(key)) { T bean = null; try { bean = beanClass.newInstance(); if (properties != null) { configureFromProperties(bean, name, properties); } else { Properties defaultProperties = PropertiesFactory.getDefaultProperties(); configureFromProperties(bean, name, defaultProperties); } } catch (Throwable e) { throw new RuntimeException(e); } beanInstances.putIfAbsent(key, bean); } return (T) beanInstances.get(key); }
private static <T> T getNamedInstance(Class<T> beanClass, String name, Properties properties) throws RuntimeException { StringBuilder sb = new StringBuilder().append(beanClass.getName()); if (name != null) sb.append(":").append(name); String key = sb.toString(); // we don't mind sometimes instantiating the bean multiple times, // as long as the duplicates never escape into the outside world. if(!beanInstances.containsKey(key)) { T bean = null; try { bean = beanClass.newInstance(); if (properties != null) { configureFromProperties(bean, name, properties); } else { Properties defaultProperties = PropertiesFactory.getDefaultProperties(); configureFromProperties(bean, name, defaultProperties); } } catch (Throwable e) { throw new RuntimeException(e); } beanInstances.putIfAbsent(key, bean); } return (T) beanInstances.get(key); }
private static <T> T getNamedInstance(Class<T> beanClass, String name, Properties properties) throws RuntimeException { StringBuilder sb = new StringBuilder().append(beanClass.getName()); if (name != null) sb.append(":").append(name); String key = sb.toString(); // we don't mind sometimes instantiating the bean multiple times, // as long as the duplicates never escape into the outside world. if(!beanInstances.containsKey(key)) { T bean = null; try { bean = beanClass.newInstance(); if (properties != null) { configureFromProperties(bean, name, properties); } else { Properties defaultProperties = PropertiesFactory.getDefaultProperties(); configureFromProperties(bean, name, defaultProperties); } } catch (Throwable e) { throw new RuntimeException(e); } beanInstances.putIfAbsent(key, bean); } return (T) beanInstances.get(key); }
private static <T> T getNamedInstance(Class<T> beanClass, String name, Properties properties) throws RuntimeException { StringBuilder sb = new StringBuilder().append(beanClass.getName()); if (name != null) sb.append(":").append(name); String key = sb.toString(); // we don't mind sometimes instantiating the bean multiple times, // as long as the duplicates never escape into the outside world. if(!beanInstances.containsKey(key)) { T bean = null; try { bean = beanClass.newInstance(); if (properties != null) { configureFromProperties(bean, name, properties); } else { Properties defaultProperties = PropertiesFactory.getDefaultProperties(); configureFromProperties(bean, name, defaultProperties); } } catch (Throwable e) { throw new RuntimeException(e); } beanInstances.putIfAbsent(key, bean); } return (T) beanInstances.get(key); }
private static <T> T getNamedInstance(Class<T> beanClass, String name, Properties properties) throws RuntimeException { if(name == null) { name = DEFAULT_NAME; } String key = beanClass.getName()+":"+name; // we don't mind sometimes instantiating the bean multiple times, // as long as the duplicates never escape into the outside world. if(!beanInstances.containsKey(key)) { T bean = null; try { bean = beanClass.newInstance(); if (properties != null) { configureFromProperties(bean, name, properties); } else { Properties defaultProperties = PropertiesFactory.getDefaultProperties(); configureFromProperties(bean, name, defaultProperties); } } catch (Throwable e) { throw new RuntimeException(e); } beanInstances.putIfAbsent(key, bean); } return (T) beanInstances.get(key); }
private static <T> T getNamedInstance(Class<T> beanClass, String name, Properties properties) throws RuntimeException { if(name == null) { name = DEFAULT_NAME; } String key = beanClass.getName()+":"+name; // we don't mind sometimes instantiating the bean multiple times, // as long as the duplicates never escape into the outside world. if(!beanInstances.containsKey(key)) { T bean = null; try { bean = beanClass.newInstance(); if (properties != null) { configureFromProperties(bean, name, properties); } else { Properties defaultProperties = PropertiesFactory.getDefaultProperties(); configureFromProperties(bean, name, defaultProperties); } } catch (Throwable e) { throw new RuntimeException(e); } beanInstances.putIfAbsent(key, bean); } return (T) beanInstances.get(key); }
private static <T> T getNamedInstance(Class<T> beanClass, String name, Properties properties) throws RuntimeException { if(name == null) { name = DEFAULT_NAME; } String key = beanClass.getName()+":"+name; // we don't mind sometimes instantiating the bean multiple times, // as long as the duplicates never escape into the outside world. if(!beanInstances.containsKey(key)) { T bean = null; try { bean = beanClass.newInstance(); if (properties != null) { configureFromProperties(bean, name, properties); } else { Properties defaultProperties = PropertiesFactory.getDefaultProperties(); configureFromProperties(bean, name, defaultProperties); } } catch (Exception e) { throw new RuntimeException(e); } beanInstances.putIfAbsent(key, bean); } return (T) beanInstances.get(key); }
private static <T> T getNamedInstance(Class<T> beanClass, String name, Properties properties) throws RuntimeException { if(name == null) { name = DEFAULT_NAME; } String key = beanClass.getName()+":"+name; // we don't mind sometimes instantiating the bean multiple times, // as long as the duplicates never escape into the outside world. if(!beanInstances.containsKey(key)) { T bean = null; try { bean = beanClass.newInstance(); if (properties != null) { configureFromProperties(bean, name, properties); } else { Properties defaultProperties = PropertiesFactory.getDefaultProperties(); configureFromProperties(bean, name, defaultProperties); } } catch (Throwable e) { throw new RuntimeException(e); } beanInstances.putIfAbsent(key, bean); } return (T) beanInstances.get(key); }
public static void main (String[] args) String timeout = PropertiesFactory.getDefaultProperties().getProperty( pollingTimeout);
public static void main (String[] args) String timeout = PropertiesFactory.getDefaultProperties().getProperty( pollingTimeout);
public static void main (String[] args) String timeout = PropertiesFactory.getDefaultProperties().getProperty( pollingTimeout);
public static void main (String[] args) String timeout = PropertiesFactory.getDefaultProperties().getProperty( pollingTimeout);
public static void main (String[] args) String timeout = PropertiesFactory.getDefaultProperties().getProperty( pollingTimeout);
public static void main (String[] args) String timeout = PropertiesFactory.getDefaultProperties().getProperty( pollingTimeout);
public static void main (String[] args) String timeout = PropertiesFactory.getDefaultProperties().getProperty( pollingTimeout);
public static void main (String[] args) String timeout = PropertiesFactory.getDefaultProperties().getProperty( pollingTimeout);
public static void main (String[] args) String timeout = PropertiesFactory.getDefaultProperties().getProperty( pollingTimeout);
public static void main (String[] args) String timeout = PropertiesFactory.getDefaultProperties().getProperty( pollingTimeout);