jdbc-protolib/src/main/java/com/streamsets/pipeline/stage/processor/jdbclookup/JdbcLookupProcessor.java
@Override
  protected List<ConfigIssue> init() {
    // Validate configuration values and open any required resources.
    List<ConfigIssue> issues = super.init();

    if (issues.isEmpty()) {
      jdbcUtil = UtilsProvider.getJdbcUtil();
    }

    errorRecordHandler = new DefaultErrorRecordHandler(getContext());
    Processor.Context context = getContext();

    queryEval = getContext().createELEval("query");

    issues = hikariConfigBean.validateConfigs(context, issues);

    if (context.getRunnerId() == 0) {
      if (issues.isEmpty() && null == dataSource) {
        try {
          dataSource = jdbcUtil.createDataSourceForRead(hikariConfigBean);
          context.getStageRunnerSharedMap().put("jdbcLookupProcessor.dataSource", dataSource);
        } catch (StageException e) {
          issues.add(context.createConfigIssue(Groups.JDBC.name(), CONNECTION_STRING, JdbcErrors.JDBC_00, e.toString()));
        }
      }
    } else {
      dataSource = (HikariDataSource) context.getStageRunnerSharedMap().get("jdbcLookupProcessor.dataSource");
    }


    if(issues.isEmpty()) {
      this.defaultValue = calculateDefault(context, issues);
    }

    if (issues.isEmpty()) {
      cache = buildCache();
      cacheCleaner = new CacheCleaner(cache, "JdbcLookupProcessor", 10 * 60 * 1000);
      if (cacheConfig.enabled) {
        preprocessThreads = Math.min(hikariConfigBean.minIdle, Runtime.getRuntime().availableProcessors()-1);
        preprocessThreads = Math.max(preprocessThreads, 1);
      }
    }

    if (context.getRunnerId() == 0) {
      if (issues.isEmpty() && generationExecutor == null) {
        generationExecutor = new SafeScheduledExecutorService(
            hikariConfigBean.maximumPoolSize,
            "JDBC Lookup Cache Warmer"
        );
        context.getStageRunnerSharedMap().put("jdbcLookupProcessor.generationExecutor", generationExecutor);
      }
    } else {
      generationExecutor = (SafeScheduledExecutorService) context.getStageRunnerSharedMap().get(
          "jdbcLookupProcessor.generationExecutor");
    }

    // If issues is not empty, the UI will inform the user of each configuration issue in the list.
    return issues;
  }
@Override
  protected List<ConfigIssue> init() {
    // Validate configuration values and open any required resources.
    List<ConfigIssue> issues = super.init();

    if (issues.isEmpty()) {
      jdbcUtil = UtilsProvider.getJdbcUtil();
    }

    errorRecordHandler = new DefaultErrorRecordHandler(getContext());
    Processor.Context context = getContext();

    queryEval = getContext().createELEval("query");

    issues = hikariConfigBean.validateConfigs(context, issues);

    if (context.getRunnerId() == 0) {
      if (issues.isEmpty() && null == dataSource) {
        try {
          dataSource = jdbcUtil.createDataSourceForRead(hikariConfigBean);
          context.getStageRunnerSharedMap().put("jdbcLookupProcessor.dataSource", dataSource);
        } catch (StageException e) {
          issues.add(context.createConfigIssue(Groups.JDBC.name(), CONNECTION_STRING, JdbcErrors.JDBC_00, e.toString()));
        }
      }
    } else {
      dataSource = (HikariDataSource) context.getStageRunnerSharedMap().get("jdbcLookupProcessor.dataSource");
    }


    if(issues.isEmpty()) {
      this.defaultValue = calculateDefault(context, issues);
    }

    if (issues.isEmpty()) {
      cache = buildCache();
      cacheCleaner = new CacheCleaner(cache, "JdbcLookupProcessor", 10 * 60 * 1000);
      if (cacheConfig.enabled) {
        preprocessThreads = Math.min(hikariConfigBean.minIdle, Runtime.getRuntime().availableProcessors()-1);
        preprocessThreads = Math.max(preprocessThreads, 1);
      }
    }

    if (context.getRunnerId() == 0) {
      if (issues.isEmpty() && generationExecutor == null) {
        generationExecutor = new SafeScheduledExecutorService(
            hikariConfigBean.maximumPoolSize,
            "JDBC Lookup Cache Warmer"
        );
        context.getStageRunnerSharedMap().put("jdbcLookupProcessor.generationExecutor", generationExecutor);
      }
    } else {
      generationExecutor = (SafeScheduledExecutorService) context.getStageRunnerSharedMap().get(
          "jdbcLookupProcessor.generationExecutor");
    }

    // If issues is not empty, the UI will inform the user of each configuration issue in the list.
    return issues;
  }
@ Override protected List < ConfigIssue > init ( ) { // Validate configuration values and open any required resources. List < ConfigIssue > issues = super . init ( ) ; if ( issues . isEmpty ( ) ) { jdbcUtil = UtilsProvider . getJdbcUtil ( ) ; } errorRecordHandler = new DefaultErrorRecordHandler ( getContext ( ) ) ; Processor . Context context = getContext ( ) ; queryEval = getContext ( ) . createELEval ( "query" ) ; issues = hikariConfigBean . validateConfigs ( context , issues ) ; if ( context . getRunnerId ( ) == 0 ) { if ( issues . isEmpty ( ) && null == dataSource ) { try { dataSource = jdbcUtil . createDataSourceForRead ( hikariConfigBean ) ; context . getStageRunnerSharedMap ( ) . put ( "jdbcLookupProcessor.dataSource" , dataSource ) ; } catch ( StageException e ) { issues . add ( context . createConfigIssue ( Groups . JDBC . name ( ) , CONNECTION_STRING , JdbcErrors . JDBC_00 , e . toString ( ) ) ) ; } } } else { dataSource = ( HikariDataSource ) context . getStageRunnerSharedMap ( ) . get ( "jdbcLookupProcessor.dataSource" ) ; } if ( issues . isEmpty ( ) ) { this . defaultValue = calculateDefault ( context , issues ) ; } if ( issues . isEmpty ( ) ) { cache = buildCache ( ) ; cacheCleaner = new CacheCleaner ( cache , "JdbcLookupProcessor" , 10 * 60 * 1000 ) ; if ( cacheConfig . enabled ) { preprocessThreads = Math . min ( hikariConfigBean . minIdle , Runtime . getRuntime ( ) . availableProcessors ( ) - 1 ) ; preprocessThreads = Math . max ( preprocessThreads , 1 ) ; } } if ( context . getRunnerId ( ) == 0 ) { if ( issues . isEmpty ( ) && generationExecutor == null ) { generationExecutor = new SafeScheduledExecutorService ( hikariConfigBean . maximumPoolSize , "JDBC Lookup Cache Warmer" ) ; context . getStageRunnerSharedMap ( ) . put ( "jdbcLookupProcessor.generationExecutor" , generationExecutor ) ; } } else { generationExecutor = ( SafeScheduledExecutorService ) context . getStageRunnerSharedMap ( ) . get ( "jdbcLookupProcessor.generationExecutor" ) ; } // If issues is not empty, the UI will inform the user of each configuration issue in the list. return issues ; }
{@inheritDoc}
{