资源简介

主要是数据同步从oracle同步到mysql,数据量为好几十万,采用了流处理的方式同步进行处理,防止出现oom

资源截图

代码片段和文件信息

package cn.witsky.quota;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.retry.backoff.ExponentialBackOffPolicy;
import org.springframework.retry.policy.SimpleRetryPolicy;
import org.springframework.retry.support.RetryTemplate;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate;

import java.nio.charset.Charset;


@SpringBootApplication
@EnableAsync
@Configuration
@EnableScheduling
public class Application {


    public static void main(String[] args) {
        SpringApplication.run(Application.class args);
    }

    @Bean(name = “restTemplate“)
    public RestTemplate restTemplate() {
        SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
        factory.setReadTimeout(20000);
        factory.setConnectTimeout(3000);
        RestTemplate restTemplate = new RestTemplate(factory);
        // 找出并修改默认的StringHttpMessageConverter
        // 关闭Accept-Charset的输出(防止输出超长的编码列表)
        // 设置默认编码为UTF-8
        boolean stringConverterFound = false;
        for (HttpMessageConverter httpMessageConverter : restTemplate.getMessageConverters()) {
            if (httpMessageConverter instanceof StringHttpMessageConverter) {
                StringHttpMessageConverter stringHttpMessageConverter = (StringHttpMessageConverter)httpMessageConverter;
                stringHttpMessageConverter.setWriteAcceptCharset(false);
                stringHttpMessageConverter.setDefaultCharset(Charset.forName(“UTF-8“));
                stringConverterFound = true;
                break;
            }
        }
        if (!stringConverterFound) {
            // 如果不存在StringHttpMessageC onverter,则创建一个
            StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter(Charset.forName(“UTF-8“));
            stringHttpMessageConverter.setWriteAcceptCharset(false);
            restTemplate.getMessageConverters().add(stringHttpMessageConverter);
        }
        return restTemplate;
    }


    // 创建用于重试的retryTemplate
    @Bean
    public RetryTemplate retryTemplate() {

        RetryTemplate retryTemplate = new RetryTemplate();
        retryTemplate.setBackOffPolicy(new ExponentialBackOffPolicy());

        SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy();
        retryPolicy.setMaxAttempts(3);
        retryTemplate.setRetryPolicy(retryPolicy);

        return retryTemplate;
    }


}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       4219  2020-07-27 19:59  rcs-tqybsj\pom.xml

     文件       3008  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\Application.java

     文件      17795  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\base\createsource\CreateSource.java

     文件       6303  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\base\createsource\GetSqlFileds.java

     文件       5701  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\base\dao\baseDao.java

     文件        655  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\base\domian\base.java

     文件       1191  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\base\domian\Cache.java

     文件       4148  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\base\service\baseService.java

     文件      13151  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\base\util\FileUtil.java

     文件       2381  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\base\util\MyX509TrustManager.java

     文件      16223  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\base\util\Tools.java

     文件        451  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\Config.java

     文件       1872  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\dao\dataobject\RcsTqybSub.java

     文件        572  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\dao\dataobject\UserMobileDz.java

     文件        469  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\dao\dataobject\WeatherArea.java

     文件       1515  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\dao\mysqldao\RcsTqybSubMapper.java

     文件        755  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\dao\oracledao\UserMobileDzMapper.java

     文件       3025  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\DataSourceMysqlConfig.java

     文件       2372  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\DataSourceOracleConfig.java

     文件       3121  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\DruidConfig.java

     文件       3083  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\DruidProperties.java

     文件       9575  2020-08-13 14:32  rcs-tqybsj\src\main\java\cn\witsky\quota\service\WorkService.java

     文件       4107  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\util\Constants.java

     文件       1727  2020-08-13 14:45  rcs-tqybsj\src\main\resources\application.properties

     文件       1008  2020-07-28 18:14  rcs-tqybsj\src\main\resources\logback-spring.xml

     文件       8546  2020-07-27 19:59  rcs-tqybsj\src\main\resources\mybatis\mapper\RcsTqybSubMapper.xml

     文件        622  2020-08-04 09:56  rcs-tqybsj\src\main\resources\mybatis\mapper\UserMobileDzMapper.xml

     文件        450  2020-07-27 19:59  rcs-tqybsj\src\main\resources\mybatis-config.xml

     目录          0  2020-07-27 19:59  rcs-tqybsj\src\main\java\cn\witsky\quota\base\createsource\temp

     目录          0  2020-08-13 14:43  rcs-tqybsj\src\main\java\cn\witsky\quota\base\createsource

............此处省略27个文件信息

评论

共有 条评论