|
@@ -32,11 +32,11 @@ import org.dbsyncer.parser.util.PickerUtil;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.DisposableBean;
|
|
import org.springframework.beans.factory.DisposableBean;
|
|
-import org.springframework.beans.factory.InitializingBean;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.util.Assert;
|
|
import org.springframework.util.Assert;
|
|
|
|
|
|
|
|
+import javax.annotation.PostConstruct;
|
|
import java.time.Instant;
|
|
import java.time.Instant;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
@@ -53,7 +53,7 @@ import java.util.stream.Collectors;
|
|
* @date 2020/04/26 15:28
|
|
* @date 2020/04/26 15:28
|
|
*/
|
|
*/
|
|
@Component
|
|
@Component
|
|
-public class IncrementPuller extends AbstractPuller implements ScheduledTaskJob, InitializingBean, DisposableBean {
|
|
|
|
|
|
+public class IncrementPuller extends AbstractPuller implements ScheduledTaskJob, DisposableBean {
|
|
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(getClass());
|
|
private final Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
|
|
@@ -82,6 +82,12 @@ public class IncrementPuller extends AbstractPuller implements ScheduledTaskJob,
|
|
|
|
|
|
private Map<String, Extractor> map = new ConcurrentHashMap<>();
|
|
private Map<String, Extractor> map = new ConcurrentHashMap<>();
|
|
|
|
|
|
|
|
+ @PostConstruct
|
|
|
|
+ private void init() {
|
|
|
|
+ key = UUIDUtil.getUUID();
|
|
|
|
+ scheduledTaskService.start(key, "*/10 * * * * ?", this);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void asyncStart(Mapping mapping) {
|
|
public void asyncStart(Mapping mapping) {
|
|
final String mappingId = mapping.getId();
|
|
final String mappingId = mapping.getId();
|
|
@@ -130,12 +136,6 @@ public class IncrementPuller extends AbstractPuller implements ScheduledTaskJob,
|
|
map.forEach((k, v) -> v.flushEvent());
|
|
map.forEach((k, v) -> v.flushEvent());
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- public void afterPropertiesSet() {
|
|
|
|
- key = UUIDUtil.getUUID();
|
|
|
|
- scheduledTaskService.start(key, "*/10 * * * * ?", this);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public void destroy() {
|
|
public void destroy() {
|
|
scheduledTaskService.stop(key);
|
|
scheduledTaskService.stop(key);
|