public static void main(String[] args) { SyncOptionsDto syncOptions = new SyncOptionsDto(); syncOptions.setSrcDataSourceName("hive"); syncOptions.setSrcSchemaName("business_mirror"); syncOptions.setSrcTableName("b2c_product_ticket_price"); syncOptions.setTgtDataSourceName("log_analysis"); syncOptions.setTgtSchemaName("mirror"); syncOptions.setTgtTableName("b2c_product_ticket_price"); BaseWorker baseWorker = SpringContextUtils.getBean(HiveToPostgresWorker.class); baseWorker.setOptions(syncOptions); baseWorker.run(); }
@Override public void init() { super.init(); // 初始化线程池 this.threadPool = Executors.newFixedThreadPool(SyncConstant.PG_TO_HIVE_THREAD_POOL_SIZE); // 线程池 this.cyclicBarrier = new CyclicBarrier(SyncConstant.PG_TO_HIVE_THREAD_POOL_SIZE); }
public static void startReset(Context context) { if (!BaseWorker.isRunning()) { Log.i("Service", "starting service"); WakefulIntentService.acquireStaticLock(context); context.startService(new Intent(context, ResetSoftService.class)); } else { Log.i("Service", "another service is already running"); } }