public CanvasItemImpl(Config config, CounterSupport counterSupport) { super(config); lastSavedHash = DigestUtils.md5Hex(config.xmlText()); this.counterSupport = counterSupport; scheduler = BeanInjector.getBean(ScheduledExecutorService.class); componentRegistry = BeanInjector.getBean(ComponentRegistry.class); componentList = CollectionEventSupport.of(this, COMPONENTS); connectionList = CollectionEventSupport.of(this, CONNECTIONS); statisticHolderSupport = new StatisticHolderSupport(this); counterStatisticSupport = new CounterStatisticSupport(this); StatisticVariable.Mutable requestVariable = statisticHolderSupport.addStatisticVariable(REQUEST_VARIABLE); statisticHolderSupport.addStatisticsWriter(CounterStatisticsWriter.TYPE, requestVariable); counterStatisticSupport.addCounterVariable(REQUEST_COUNTER, requestVariable); StatisticVariable.Mutable failuresVariable = statisticHolderSupport.addStatisticVariable(FAILURE_VARIABLE); statisticHolderSupport.addStatisticsWriter(CounterStatisticsWriter.TYPE, failuresVariable); counterStatisticSupport.addCounterVariable(FAILURE_COUNTER, failuresVariable); StatisticVariable.Mutable assertionFailuresVariable = statisticHolderSupport.addStatisticVariable(ASSERTION_FAILURE_VARIABLE); statisticHolderSupport.addStatisticsWriter( CounterStatisticsWriter.TYPE, assertionFailuresVariable); counterStatisticSupport.addCounterVariable( ASSERTION_FAILURE_COUNTER, assertionFailuresVariable); StatisticVariable.Mutable requestFailuresVariable = statisticHolderSupport.addStatisticVariable(REQUEST_FAILURE_VARIABLE); statisticHolderSupport.addStatisticsWriter( CounterStatisticsWriter.TYPE, requestFailuresVariable); counterStatisticSupport.addCounterVariable(REQUEST_FAILURE_COUNTER, requestFailuresVariable); abortOnFinish = createProperty(ABORT_ON_FINISH_PROPERTY, Boolean.class, false); }
public static void main(String[] args) throws Exception { // process args Config cArgs = Config.getConfig("JdbcLoader", args); JdbcLoader loader = new JdbcLoader(cArgs); loader.logger.info("==============================================="); loader.logger.info("This run of JDBC loader started at" + new Date()); loader.logger.info("==============================================="); loader.connectToSource(); loader.client = VoltDBClientConnectionUtil.connectToVoltDB(cArgs); if (cArgs.queriesFile.isEmpty()) { loader.loadTables(cArgs.tables, cArgs.procname); } else { loader.load(cArgs.queriesFile, cArgs.modules.trim(), cArgs.tables.trim()); } VoltDBClientConnectionUtil.close(loader.client); loader.logger.info("=================================================="); loader.logger.info("This run of JDBC loader completed at" + new Date()); loader.logger.info("=================================================="); System.out.println("Read/write complete!"); }
/** * Figure out what kind of static adapter type was specified. By default it's a 10genDEFAULT app */ protected void _setStaticAdapterType() { /* * app configuration steps could have set this already. If so, don't bother doing anything */ if (_staticAdapterType != AdapterType.UNSET) { log("Static adapter type has already been directly set to " + _staticAdapterType); return; } /* * check to see if overridden in 10gen.properties */ String override = Config.get().getProperty(INIT_ADAPTER_TYPE); if (override != null) { AdapterType t = getAdapterTypeFromString(override); if (t == null) { log( "Static adapter type specified as override [" + override + "] unknown - will use _init file specified or default"); } else { log("Static adapter type overridden by 10gen.properties or env. Value : " + override); _staticAdapterType = t; return; } } /* * if not, use the one from _init file if specified */ _staticAdapterType = AdapterType.DIRECT_10GEN; Object o = getFromInitScope(INIT_ADAPTER_TYPE); if (o == null) { log("Static adapter type not specified in _init file - using default value of DIRECT_10GEN"); return; } if (!(o instanceof JSString)) { log("Static adapter type from _init file not a string - using default value of DIRECT_10GEN"); return; } _staticAdapterType = getAdapterTypeFromString(o.toString()); if (_staticAdapterType == null) { log( "Static adapter type from _init file [" + o.toString() + "] unknown - using default value of DIRECT_10GEN"); _staticAdapterType = AdapterType.DIRECT_10GEN; return; } log("Static adapter type specified in _init file = " + _staticAdapterType); return; }