01-June 2021

Hits: 0

20 June 2021 22:05:43

  1. Spring source code reading:
    1.1 wrapIfNecessary
    1.2 Determine whether it is empty: StringUtils.hasLength(beanName);
    1.3 Use Boolean wrapper class: Boolean.FALSE.equals(this.advisedBeans.get(cacheKey))
    1.4 Determine whether the Advice class is the parent of beanClass Class: Advice.class.isAssignableFrom(beanClass)
    1.5 Syntax rules:
    Parent class.class.isAssignableFrom(subclass.class)
    Subclass instance instanceof Parent class type
    1.6 AOP principle: dynamic proxy
    createProxy(bean.getClass(), beanName, specificInterceptors , new SingletonTargetSource(bean));

23 Jun 2021 07:02:09

  1. About Mybatis batch update
    When using labels, if there are special characters in the parameters, the parameters will be misplaced, and finally use batch update processing.
  2. Chinese official website:
    https://mybatis.org/mybatis-3/zh/dynamic-sql.html

27 Jun 2021 09:58:16

  1. @Configuration is useless without configuring this annotation transaction
  2. Turing College VIP College Notes1
    . JVM
    topic2. JavaSE topic3
    . Concurrency topic4 .
    Spring topic4.1 Spring source code compilation tutorial4.2 Handwritten simulation of the core
    logic
    of the Spring framework Dependency injection source code analysis 4.6 ApplicationContext startup process 4.7 Spring analysis configuration class 4.8 Inference construction method in Spring 4.9 Spring integration Mybatis core principle 4.10 Spring circular dependency source code analysis 4.11 Analysis of the underlying principle of AOP in Spring 4.12 The underlying working principle of transactions in Spring 5. SpringMVC topic 6. SpringBoot topic 7. Mybatis topic

29 Jun 2021 00:26:19

  1. horse soldier education

  2. Spring source code FAQ:
    2.1 Methodology: How to learn source code efficiently
    2.2 SpringIOC source code
    2.3 Spring program startup
    2.4 How does Spring load configuration files into the application?
    2.5 Core interface: BeanDefinitionReader
    2.6 Core interface: BeanFactory
    2.7 Understand Spring’s refresh thoroughly Method
    2.8 The role and implementation of the BeanPostProcessor interface
    2.9 The role and implementation of the BeanFactoryPostProcessor interface
    2.10 Is it necessary for Spring Bean to implement the Aware interface
    2.11 The instantiation process of Spring Bean is revealed
    2.12 What exactly does Spring Bean initialization do
    2.13 Thoroughly understand the FactoryBean interface
    2.14 Perfectly explain Spring Bean 2.15 What
    is the role of Spring’s Environment interface
    2.16 Why does circular dependency occur
    2.17 How is circular dependency resolved in Spring
    2.18 Spring IOC interview questions

  3. Can Recent Files be enabled?
    3.1 Default shortcut: Ctrl + E can try

/p/366436588

July 1, 2021 22:55:53

  1. Where to find offline plugins for IDEA: Plugins official website

  2. Because there are several useful plugins version mismatch

  3. There are several ways to create objects:
    3.1 Constructor
    3.2 Reflection
    3.3 Cloning (little significance)
    3.4 Serialization (little significance)

    Class clazz = Class.forName();
    Constructor ctor = clazz.getDeclareConstructor();
    Object obj = ctor.newInstance();

July 2, 2021 07:10:05

  1. Mybatis-Log-Plugin:

July 4, 2021 17:22:11

  1. Vocabulary: Verb
    Processing: process

  2. Vocabulary: Noun:
    Candidate: Candidate

  3. Sort List:

configCandidates.sort((bd1, bd2) -> {   
    int i1 = ConfigurationClassUtils.getOrder(bd1.getBeanDefinition());     
    int i2 = ConfigurationClassUtils.getOrder(bd2.getBeanDefinition());     
    return Integer.compare(i1, i2); 
});

  1. The capacity of the collection is specified here as follows:

Set<ConfigurationClass> alreadyParsed = new HashSet<>(configCandidates.size());

  1. The meaning of whether the expression should be:

vocabulary:

should: should

if (this.conditionEvaluator.shouldSkip(configClass.getMetadata(), ConfigurationPhase.PARSE_CONFIGURATION)) {

July 5, 2021 05:56:12

  1. Shortcuts:
    Translation: Alt + T seems to be a little easier.

July 6, 2021 07:22:15

  1. If you have time, you have to memorize the interview questions. You may not understand it at the time, but it is actually very useful later.

July 7, 2021 08:10:14

  1. http://plugins.jetbrains.com/

  2. mybatis-log-plugin

July 9, 2021 07:59:32

  1. Reference blog: Change the commented out font to yellow:
    /weixin_41298572/article/details/89630972

  2. Editor -> Color Scheme -> Language Defaults -> Comments -> Line comment

  3. CodeSheep: Awesome blogger
    https://github.com/rd2coding/Road2Coding

July 13, 2021 07:31:21

  1. @SuppressWarnings(“serial”)

  2. Comfortable to look at:

Assert.notNull(other, "Other ProxyConfig object must not be null");

  1. Two common verbs:

if (!proxyFactory.isProxyTargetClass()) {
    if (shouldProxyTargetClass(beanClass, beanName)) {
        proxyFactory.setProxyTargetClass(true);
    }
    else {
        evaluateProxyInterfaces(beanClass, proxyFactory);
    }
}

should: should it?
evaluate: means to evaluate

  1. Use of the @link tag:

* Check the interfaces on the given bean class and apply them to the {@link ProxyFactory},
 * if appropriate.

  1. IDEA:

Cc: Match Case: Alt + C
Use Tab to focus on an option, and Space to toggle it

Words: Alt + Words
use Tab to focus on an option, and Space to toggle it

Regex: Alt + X
Use Tab to focus on an option, and Space to toggle it

IDEA: Match Case, Words, Regex Function
Reference Blog: /article/details/100052759

  1. Customize: customize

customizeProxyFactory(proxyFactory);

  1. frozen: the meaning of frozen, solidified

proxyFactory.setFrozen(this.freezeProxy);

When writing the program you can define whether the pointer is nullable or not. Declares whether a method is null-safe by using annotations like @NotNull and @Nullable. Modern compilers, IDEs, or tools can read this annotation and help you add forgotten null pointer checks, or alert you to unnecessary mess of null pointer checks. IntelliJ and findbugs already support these annotations. These annotations are also part of JSR 305, but even if not in the IDE or tools, the annotations themselves can serve as documentation. Seeing @NotNull and @Nullable, programmers can decide for themselves whether to do null pointer checking. By the way, this technique is relatively new to Java programmers and will take a while to adopt.
Reference blog:
/kuyuyingzi/article/details/16973429

  1. toString(): String.valueOf() can be used;

BigDecimal bd = getPrice();
System.out .println (String.valueOf(bd)); //will not throw null pointer exception System.out.println ( bd.toString ()); 
// throw "Exception in thread "main" java.lang .NullPointerException"

July 14, 2021 07:27:49

  1. PDM/PLM can be seen here:

July 16, 2021 08:20:29

  1. Regarding the scheme of processing historical data, it would be better if there is a Deme:
    Reference blog: /KuaiLeShiFu/article/details/49388011

  2. You can see if it applies:

package com.jzt.web;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.TreeSet;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jzt.dao.mapper.CampaignMapper;
import com.jzt.domain.Campaign;
import com.keyword.dao.mapper.KeywordMapper;
import com.keyword.domain.Keyword;
import com.keyword.domain.PagePackage;

@RequestMapping("/keywordv2")
@Controller
public class KeywordV2Controller {
    private final static Logger logger = LoggerFactory.getLogger(ChangeDataController.class);

    private final static Integer PAGESIZE = 2000;

    private Integer threadSize = 20;

    private boolean flag = true;

    /**
     * Use 20 threads, which needs to be determined according to the core of the server, otherwise resources will be wasted in thread competition
     */
    private ExecutorService services = Executors.newFixedThreadPool(threadSize);

    /**
     * block queue
     */
    final BlockingQueue queue = new ArrayBlockingQueue(20000);

    @Resource
    private KeywordMapper keywordMappper;

    @Resource
    private CampaignMapper campaignMapper;

    @ResponseBody
    @RequestMapping("/go")
    public void handleAll(String table) {
        if (table != null) {
            String tableName = "ad_keyword_" + table;
            Keyword param = new Keyword();
            param.setTableName(tableName);
            Integer total = keywordMappper.queryCountByParam(param);
            final int pageCount = (int) Math.ceil((double) total / PAGESIZE);
            handleOneTable(tableName, total, pageCount);
        } else {
            BlockingQueue tables = new ArrayBlockingQueue(25);
            for (int i = 466; i <= 490; i++) {
                tables.add(i);
            }
            logger.info( "Enter while....Start at 466" );
             while (tables.size() > 0 ) {
                 if ( new Date().getDay() == 2 && new Date().getHours() > = 1 ) {     // start again at 
                    21pm flag = true ;
                } else {
                    flag = false ;
                }
                while (flag) {
                    flag = false ;
                    String tableName = null;
                    try {
                        tableName = "ad_keyword_" + tables.take();
                        if (new Date().getHours() > 5 && new Date().getHours() < 21) {
                            logger.info(">>>>>>>>>>>>>>>>>>>>" + tableName);
                            flag = false;
                            break;
                        }
                    } catch (InterruptedException e) {
                        logger.info(e.toString());
                    }
                    Keyword param = new Keyword();
                    param.setTableName(tableName);
                    Integer total = keywordMappper.queryCountByParam(param);
                    final  int pageCount = ( int ) Math.ceil(( double ) total / PAGESIZE);   //Total number of pages
                    handleOneTable(tableName, total, pageCount);
                }  //END flag
            } //END startUp
        }
    }

    private void handleOneTable(final String tableName, Integer total, final int pageCount) {
        logger.info( "Keyword brush data start..." );
        Keyword param = new Keyword();
        param.setTableName(tableName);
        logger.info(String.format( "Query keyword table [%s] total number [%s] per page [%s] total [%s] pages" , tableName, total, PAGESIZE, pageCount));
         //Fetch and execute Record start point id 
        Long idIndex = 0L ;
        List firstRecord = keywordMappper.queryFirstKeyword(param);
        if (firstRecord != null && firstRecord.size() == 1) {
            idIndex = firstRecord.get( 0 ).getId() - 1 ;
            logger.info(tableName + "Start execution from id=" + idIndex + "" );
        }
        param.setPageSize(PAGESIZE);
        PagePackage pagePackage = null;
        for (int page = 1; page <= pageCount; page++) {
            param.setId(idIndex);
            pagePackage = new PagePackage();
             // Get keywords by paging 
            final List keywordResult = keywordMappper.queryListByPage(param);
             if (keywordResult != null && keywordResult.size() > 0 ) {
                pagePackage.setTableName(tableName);
                pagePackage.setKeywords(keywordResult);
                pagePackage.setPageIndex(page);
                pagePackage.setPageSize(keywordResult.size());
                pagePackage.setPageCount(pageCount);
                queue.add(pagePackage);   //Add a page of data objects to be processed to the queue 
                idIndex = keywordResult.get(keywordResult.size() - 1 ).getId();
            }
        }

        for (int i = 0; i
        services.execute(new Runnable() {
            @Override
            public void run() {
                updateRunnable(tableName, queue);
            }
        });
    }
       while(queue.size()>0)

    {
        flag = false ; //Main thread blocked
    }

    flag=true;
       logger.info( "End of keyword brushing data..." );
}


    private void updateRunnable(final String tableName, final BlockingQueue queue) {
        boolean flag2 = true;
        while (flag2) {
            try {
                PagePackage page = queue.take();   //If the queue is empty, wait 
                if (page != null ) {
                    updateOnePage(page);
                } else {
                    flag2 = false ;

                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    private void updateOnePage(PagePackage page) {
        List keywords = page.getKeywords();
        String tableName = page.getTableName();
        Integer pageIndex = page.getPageIndex();
        Integer pageCount = page.getPageCount();
        int hour = new Date().getHours();
         if ( new Date().getDay() == 2 && hour >= 1 && hour < 6 ) {   //0:Sunday 1:Monday 
            logger.info(String .format( "The [%s] page of the keyword table [%s] has a total of [%s] page data processing start..." , tableName, pageIndex, pageCount));
             //1. For this page keyword Count all campaign IDs 
            List campaignIds = null ;
            List ids = new ArrayList();
            for (Keyword k : keywords) {
                if (k.getCampaignId() != null) {
                    ids.add(k.getCampaignId());
                } else {
                    logger.info(String.format( "[[%s]] The keyword [%s] in the table has no plan id" , tableName, k.getId()));
                }
            }
            campaignIds = new ArrayList( new TreeSet(ids));
             try {
                 //2. Query all plans according to the plan id 
                Campaign param = new Campaign();
                param.setIds(campaignIds);
                List campaigns = campaignMapper.queryListByParam(param);
                if (campaigns == null || campaigns.size() == 0) {
                    logger.info(String.format( "[[%s]] The list of plans to which the keywords in the table belong is empty" , tableName));
                     return ;
                }
                //3. Fill in the keyword information to be changed, and trigger the execution of SQL for updating keywords 
                for (Keyword keyword : keywords) {
                    keyword.setYn(null);
                    for (Campaign campaign : campaigns) {
                        if (keyword.getCampaignId().compareTo(campaign.getId()) == 0) {
                            if (campaign.getYn() != null && campaign.getYn() == 0) {
                                keyword.setYn(campaign.getYn());
                            }
                            keyword.setCampaignType(campaign.getCampaignType());
                            keyword.setBusinessType(campaign.getBusinessType());
                            keyword.setPutType(campaign.getPutType());
                            break;
                        }
                    }
                    if (keyword.getCampaignType() != null || keyword.getBusinessType() != null || keyword.getPutType() != null) {
                        keyword.setTableName(tableName);
                        keywordMappper.updateKeyword(keyword);
                    } else {
                        logger.info(String.format( "The data of id=[%s] in the keyword table [%s] has no type value" , ​​tableName, keyword.getId()));
                    }
                }
            } catch (Exception ex) {
                logger.info(String.format( "Keyword table [%s] data refresh abnormal" , tableName), ex);
            }
            logger.info(String.format( "The [%s] page of the keyword table [%s] has a total of [%s] page data processing end..." , tableName, pageIndex, pageCount));
        } else {
            logger.info(String.format( "Pause execution for a time period outside the specified range...." , tableName, pageIndex, pageCount));
        }
    }
}

July 17, 2021 16:39:44

  1. About the defect management system:

Free Platform:
https://mdly20210717080930523.pingcode.com/workspace/dashboards/60f2903a6519891e947890f7

Official website:
https://pingcode.com/

18 Jul 2021 14:34:53

  1. PotPlayer common shortcut keys:
    reference blog:
    /acelit/article/details/102492493

  2. Vocabulary: call, handle meaning
    invoke

invokeBeanFactoryPostProcessors(beanFactory);

  1. Vocabulary: has the meaning of initialization
    init

initPropertySources();

  1. Vocabulary: there is update, the meaning of
    refresh refresh

protected final void refreshBeanFactory() throws BeansException {
        if (hasBeanFactory()) {
            destroyBeans();
            closeBeanFactory();
        }
        try {
            DefaultListableBeanFactory beanFactory = createBeanFactory();
            beanFactory.setSerializationId(getId());
            customizeBeanFactory(beanFactory);
            loadBeanDefinitions(beanFactory);
            this.beanFactory = beanFactory;
        }
        catch (IOException ex) {
            throw new ApplicationContextException("I/O error parsing bean definition source for " + getDisplayName(), ex);
        }
    }

  1. This is just a constructor, but it is still extracted and should be available for public use.

DefaultListableBeanFactory beanFactory = createBeanFactory();

  1. Vocabulary: Customize, the meaning of
    customize

customizeBeanFactory(beanFactory);

20 Jul 2021 07:34:48

  1. Escapes:

? %3F %3F

  1. Or when transcoding is stored: UrlEncode, decode and use when using.

  2. Python does this by escaping:

  3. Update spring-framwork project

Leave a Reply

Your email address will not be published.