@Test public void concurrencyLoadDataTest() throws DSPException { URL url = getClass().getResource(jsonFile); dao.loadData(url.getPath()); ConcurrencyTest concurrencyTest = new ConcurrencyTest(); new Thread(concurrencyTest).start(); }
public synchronized void loadData(String dbLocation) throws DSPException { try { if ((dbLocation != null) && (dbLocation != "")) { this.dbLocation = dbLocation; } else { this.dbLocation = getClass().getResource("dspConf.json").getFile(); } DSPProps props = mapper.readValue(new File(this.dbLocation), DSPProps.class); this.properties.put("server_port", props.dspServerPort); this.properties.put("request_timeout", props.defaultReqTimeout); this.properties.put("offer_timeout", props.defaultOfferTimeout); for (RTBExchange ex : props.exchanges) { this.exchanges.put(ex.getOrgName(), ex); } for (RTBAdvertiser adv : props.advertisers) { this.advertisers.put(adv.getLandingPage(), adv); } } catch (Exception e) { logger.error("JsonFileBackedDAO-Error in loading Configuration data : " + StringUtils.stackTraceToString(e)); throw new DSPException(e.getMessage()); } }
JsonFileBackedDAO implements DemandSideDAO { public synchronized void loadData(String dbLocation) throws DSPException { try { if ((dbLocation != null) && (dbLocation != "")) { this.dbLocation = dbLocation; } else { this.dbLocation = getClass().getResource("dspConf.json").getFile(); } DSPProps props = mapper.readValue(new File(this.dbLocation), DSPProps.class); this.properties.put("server_port", props.dspServerPort); this.properties.put("request_timeout", props.defaultReqTimeout); this.properties.put("offer_timeout", props.defaultOfferTimeout); for (RTBExchange ex : props.exchanges) { this.exchanges.put(ex.getOrgName(), ex); } for (RTBAdvertiser adv : props.advertisers) { this.advertisers.put(adv.getLandingPage(), adv); } } catch (Exception e) { logger.error("JsonFileBackedDAO-Error in loading Configuration data : " + StringUtils.stackTraceToString(e)); throw new DSPException(e.getMessage()); } } }
JsonFileBackedDAO implements DemandSideDAO { public synchronized void loadData(String dbLocation) throws DSPException { try { if ((dbLocation != null) && (dbLocation != "")) { this.dbLocation = dbLocation; } else { this.dbLocation = getClass().getResource("dspConf.json").getFile(); } DSPProps props = mapper.readValue(new File(this.dbLocation), DSPProps.class); this.properties.put("server_port", props.dspServerPort); this.properties.put("request_timeout", props.defaultReqTimeout); this.properties.put("offer_timeout", props.defaultOfferTimeout); for (RTBExchange ex : props.exchanges) { this.exchanges.put(ex.getOrgName(), ex); } for (RTBAdvertiser adv : props.advertisers) { this.advertisers.put(adv.getLandingPage(), adv); } } catch (Exception e) { logger.error("JsonFileBackedDAO-Error in loading Configuration data : " + StringUtils.stackTraceToString(e)); throw new DSPException(e.getMessage()); } }  }
JsonFileBackedDAO implements DemandSideDAO { public synchronized void loadData(String dbLocation) throws DSPException { try { if ((dbLocation != null) && (dbLocation != "")) { this.dbLocation = dbLocation; } else { this.dbLocation = getClass().getResource("dspConf.json").getFile(); } DSPProps props = mapper.readValue(new File(this.dbLocation), DSPProps.class); this.properties.put("server_port", props.dspServerPort); this.properties.put("request_timeout", props.defaultReqTimeout); this.properties.put("offer_timeout", props.defaultOfferTimeout); for (RTBExchange ex : props.exchanges) { this.exchanges.put(ex.getOrgName(), ex); } for (RTBAdvertiser adv : props.advertisers) { this.advertisers.put(adv.getLandingPage(), adv); } } catch (Exception e) { logger.error("JsonFileBackedDAO-Error in loading Configuration data : " + StringUtils.stackTraceToString(e)); throw new DSPException(e.getMessage()); } }  synchronized void reload(); synchronized long getServerPort(); ConcurrentMap<String, RTBExchange> getExchanges(); ConcurrentMap<String, RTBAdvertiser> getAdvertisers(); synchronized void loadData(String dbLocation); synchronized long getDefaultTimeout(String string); }
JsonFileBackedDAO implements DemandSideDAO { public synchronized void loadData(String dbLocation) throws DSPException { try { if ((dbLocation != null) && (dbLocation != "")) { this.dbLocation = dbLocation; } else { this.dbLocation = getClass().getResource("dspConf.json").getFile(); } DSPProps props = mapper.readValue(new File(this.dbLocation), DSPProps.class); this.properties.put("server_port", props.dspServerPort); this.properties.put("request_timeout", props.defaultReqTimeout); this.properties.put("offer_timeout", props.defaultOfferTimeout); for (RTBExchange ex : props.exchanges) { this.exchanges.put(ex.getOrgName(), ex); } for (RTBAdvertiser adv : props.advertisers) { this.advertisers.put(adv.getLandingPage(), adv); } } catch (Exception e) { logger.error("JsonFileBackedDAO-Error in loading Configuration data : " + StringUtils.stackTraceToString(e)); throw new DSPException(e.getMessage()); } }  synchronized void reload(); synchronized long getServerPort(); ConcurrentMap<String, RTBExchange> getExchanges(); ConcurrentMap<String, RTBAdvertiser> getAdvertisers(); synchronized void loadData(String dbLocation); synchronized long getDefaultTimeout(String string);  }