    /**
     * {@inheritDoc}
     */
    @Override
    public List<T> getAllDistinct() {
        return new ArrayList<>(new LinkedHashSet<T>(getAll()));
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<T> getAllDistinct() {
        return new ArrayList<T>(new LinkedHashSet<T>(getAll()));
    }

Replace Generic With Diamond ArrayList<T> with ArrayList<> in method public getAllDistinct() : List<T> from class common.dao.jpa.GenericDaoJpa


    /**
     * {@inheritDoc}
     */
    @Transient
    @Override
    public Set<GrantedAuthority> getAuthorities() {
        Set<GrantedAuthority> authorities = new LinkedHashSet<>();
        authorities.addAll(roles);
        return authorities;
    }

    /**
     * {@inheritDoc}
     */
    @Transient
    @Override
    public Set<GrantedAuthority> getAuthorities() {
        Set<GrantedAuthority> authorities = new LinkedHashSet<GrantedAuthority>();
        authorities.addAll(roles);
        return authorities;
    }

Replace Generic With Diamond LinkedHashSet<GrantedAuthority> with LinkedHashSet<> in method public getAuthorities() : Set<GrantedAuthority> from class common.model.User


    /**
     * {@inheritDoc}
     */
    @Override
    public PaginatedList<T> createPaginatedList(T searchCondition, Integer page) {
        PaginatedList<T> paginatedList = new PaginatedList<>(page);
        paginatedList.setSearchCondition(searchCondition);
        paginatedList.setAllRecordCount(paginatedDao.getCount(paginatedList.getSearchCondition()));

        if (paginatedList.getAllRecordCount() == 0) {
            // 検索結果が0件の場合
            paginatedList.setCurrentPage(new ArrayList<T>());
            return paginatedList;
        }

        if (paginatedList.getCurrentPageNumber() > paginatedList.getAllPageCount()) {
            // 指定されたページ数より、ページ総数が小さかった場合
            paginatedList.setCurrentPageNumber(paginatedList.getAllPageCount());
        }

        paginatedList.setCurrentPage(paginatedDao.getList(paginatedList.getSearchCondition(), paginatedList.getCurrentStartRecordNumber() - 1, paginatedList.getPageSize()));
        return paginatedList;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public PaginatedList<T> createPaginatedList(T searchCondition, Integer page) {
        PaginatedList<T> paginatedList = new PaginatedList<T>(page);
        paginatedList.setSearchCondition(searchCondition);
        paginatedList.setAllRecordCount(paginatedDao.getCount(paginatedList.getSearchCondition()));

        if (paginatedList.getAllRecordCount() == 0) {
            // 検索結果が0件の場合
            paginatedList.setCurrentPage(new ArrayList<T>());
            return paginatedList;
        }

        if (paginatedList.getCurrentPageNumber() > paginatedList.getAllPageCount()) {
            // 指定されたページ数より、ページ総数が小さかった場合
            paginatedList.setCurrentPageNumber(paginatedList.getAllPageCount());
        }

        paginatedList.setCurrentPage(paginatedDao.getList(paginatedList.getSearchCondition(), paginatedList.getCurrentStartRecordNumber() - 1, paginatedList.getPageSize()));
        return paginatedList;
    }

Replace Generic With Diamond PaginatedList<T> with PaginatedList<> in method public createPaginatedList(searchCondition T, page Integer) : PaginatedList<T> from class common.service.impl.PaginatedManagerImpl


    /**
     * Request変数に要素を追加する.
     *
     * @param key
     *            キー
     * @param value
     *            要素
     */
    protected void save(String key, String value) {
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
        @SuppressWarnings("unchecked")
        List<String> messages = (List<String>) request.getAttribute(key);

        if (messages == null) {
            messages = new ArrayList<>();
        }

        messages.add(value);
        request.setAttribute(key, messages);
    }

    /**
     * Request変数に要素を追加する.
     *
     * @param key
     *            キー
     * @param value
     *            要素
     */
    protected void save(String key, String value) {
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
        @SuppressWarnings("unchecked")
        List<String> messages = (List<String>) request.getAttribute(key);

        if (messages == null) {
            messages = new ArrayList<String>();
        }

        messages.add(value);
        request.setAttribute(key, messages);
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method protected save(key String, value String) : void from class common.webapp.controller.BaseController


    /**
     * ファイルタイプに合わせた、ファイル変換処理を返却する.
     *
     * @param fileType
     *            ファイルタイプ
     * @return ファイル変換処理クラスの関数
     */
    @SuppressWarnings("unchecked")
    public static FileConverter<User> createConverter(FileType fileType) {
        switch (fileType) {
        case XML:
            return multipartFile -> {
                try {
                    return ((BaseObjects<User>) new XmlFileReader().read(JAXBContext.newInstance(Users.class), multipartFile)).getObjects();
                } catch (IOException e) {
                    throw new FileException("errors.io", e);
                } catch (JAXBException e) {
                    throw new FileException("errors.convert", e);
                }
            };
        case EXCEL:
            return multipartFile -> {
                Map<String, List<User>> model = new HashMap<>();
                model.put("Users", new ArrayList<>());

                try {
                    if (new JxlsFileReader().read(new ClassPathResource("/common/webapp/converter/User.xml"), multipartFile, model).isStatusOK()) {
                        return model.get("Users");
                    } else {
                        throw new FileException("errors.convert");
                    }
                } catch (IOException e) {
                    throw new FileException("errors.io", e);
                } catch (IllegalArgumentException | InvalidFormatException | XLSDataReadException | SAXException e) {
                    throw new FileException("errors.convert", e);
                }
            };
        case CSV:
            return multipartFile -> {
                try (CSVReader reader = new CSVReader(new InputStreamReader(multipartFile.getInputStream(), Constants.ENCODING), ',', '"', 1);) {
                    return reader.readAll().stream().map(line -> {
                        try {
                            CsvFileReader csvFileReader = new CsvFileReader(
                                    FileUtils.readFileToString(new ClassPathResource("/common/webapp/converter/User.csv").getFile(), Constants.ENCODING).split(","));
                            return csvFileReader.read(new User(), line);
                        } catch (IOException e) {
                            throw new FileException("errors.io", e);
                        }
                    }).collect(Collectors.toList());
                } catch (IOException e) {
                    throw new FileException("errors.io", e);
                } catch (IllegalArgumentException | IndexOutOfBoundsException | TypeMismatchException e) {
                    throw new FileException("errors.convert", e);
                }
            };
        default:
            throw new FileException("errors.fileType");
        }
    }

    /**
     * ファイルタイプに合わせた、ファイル変換処理クラスのインスタンスを返却する.
     *
     * @param fileType
     *            ファイルタイプ
     * @return ファイル変換処理クラスの関数
     */
    @SuppressWarnings("unchecked")
    public static FileConverter<User> createConverter(FileType fileType) {
        switch (fileType) {
        case XML:
            return multipartFile -> {
                try {
                    return ((BaseObjects<User>) new XmlFileReader().read(JAXBContext.newInstance(Users.class), multipartFile)).getObjects();
                } catch (IOException e) {
                    throw new FileException("errors.io", e);
                } catch (JAXBException e) {
                    throw new FileException("errors.convert", e);
                }
            };
        case EXCEL:
            return multipartFile -> {
                String modelName = Users.class.getSimpleName();
                Map<String, List<User>> model = new HashMap<>();
                model.put(modelName, new ArrayList<>());

                try {
                    if (new JxlsFileReader().read(new ClassPathResource("/common/webapp/converter/" + modelName + ".xml"), multipartFile, model).isStatusOK()) {
                        return model.get(modelName);
                    } else {
                        throw new FileException("errors.convert");
                    }
                } catch (IOException e) {
                    throw new FileException("errors.io", e);
                } catch (IllegalArgumentException | InvalidFormatException | XLSDataReadException | SAXException e) {
                    throw new FileException("errors.convert", e);
                }
            };
        case CSV:
            return multipartFile -> {
                CSVReader reader = null;

                try {
                    reader = new CSVReader(new InputStreamReader(multipartFile.getInputStream(), Constants.ENCODING), ',', '"', 1);

                    return reader.readAll().stream().map(line -> {
                        try {
                            CsvFileReader csvFileReader = new CsvFileReader(FileUtils.readFileToString(new ClassPathResource("/common/webapp/converter/" + User.class.getSimpleName() + ".csv").getFile(), Constants.ENCODING).split(","));
                            return csvFileReader.read(User.class.newInstance(), line);
                        } catch (IOException e) {
                            throw new FileException("errors.io", e);
                        } catch (InstantiationException | IllegalAccessException e) {
                            throw new FileException("errors.convert", e);
                        }
                    }).collect(Collectors.toList());
                } catch (IOException e) {
                    throw new FileException("errors.io", e);
                } catch (IllegalArgumentException | IndexOutOfBoundsException | TypeMismatchException e) {
                    throw new FileException("errors.convert", e);
                } finally {
                    IOUtils.closeQuietly(reader);
                }
            };
        default:
            throw new FileException("errors.fileType");
        }
    }

Try With Resources try(CSVReader reader=new CSVReader(new InputStreamReader(multipartFile.getInputStream(),Constants.ENCODING),',','"',1)) in method public createConverter(fileType FileType) : FileConverter<User> from class common.webapp.converter.UserFileConverterFactory


    /**
     * ログイン失敗回数一覧を取得する.
     *
     * @param request
     *            {@link HttpServletRequest}
     * @return ログイン失敗回数一覧
     */
    @SuppressWarnings("unchecked")
    private Map<String, Integer> getBadCredentialsMap(HttpServletRequest request) {
        Map<String, Integer> badCredentialsMap = (Map<String, Integer>) request.getSession().getAttribute("badCredentialsCount");

        if (badCredentialsMap == null) {
            badCredentialsMap = new HashMap<>();
            request.getSession().setAttribute("badCredentialsCount", badCredentialsMap);
        }

        return badCredentialsMap;
    }

    /**
     * ログイン失敗回数一覧を取得する.
     *
     * @param request
     *            {@link HttpServletRequest}
     * @return ログイン失敗回数一覧
     */
    @SuppressWarnings("unchecked")
    private Map<String, Integer> getBadCredentialsMap(HttpServletRequest request) {
        Map<String, Integer> badCredentialsMap = (Map<String, Integer>) request.getSession().getAttribute("badCredentialsCount");

        if (badCredentialsMap == null) {
            badCredentialsMap = new HashMap<String, Integer>();
            request.getSession().setAttribute("badCredentialsCount", badCredentialsMap);
        }

        return badCredentialsMap;
    }

Replace Generic With Diamond HashMap<String,Integer> with HashMap<> in method private getBadCredentialsMap(request HttpServletRequest) : Map<String,Integer> from class common.webapp.filter.ExtendedAuthenticationFilter


    /**
     * FlashMapを取得する.
     *
     * @param request
     *            {@link HttpServletRequest}
     * @return FlashMap
     */
    public static Map<String, Object> getCurrent(HttpServletRequest request) {
        HttpSession session = request.getSession();
        @SuppressWarnings("unchecked")
        Map<String, Object> flash = (Map<String, Object>) session.getAttribute(FLASH_MAP_ATTRIBUTE);

        if (flash == null) {
            flash = new HashMap<>();
            session.setAttribute(FLASH_MAP_ATTRIBUTE, flash);
        }

        return flash;
    }

    /**
     * FlashMapを取得する.
     *
     * @param request
     *            {@link HttpServletRequest}
     * @return FlashMap
     */
    public static Map<String, Object> getCurrent(HttpServletRequest request) {
        HttpSession session = request.getSession();
        @SuppressWarnings("unchecked")
        Map<String, Object> flash = (Map<String, Object>) session.getAttribute(FLASH_MAP_ATTRIBUTE);

        if (flash == null) {
            flash = new HashMap<String, Object>();
            session.setAttribute(FLASH_MAP_ATTRIBUTE, flash);
        }

        return flash;
    }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method public getCurrent(request HttpServletRequest) : Map<String,Object> from class common.webapp.filter.FlashMap


    /**
     * FlashMapの指定されたキーに要素を追加する.
     *
     * @param key
     *            キー
     * @param value
     *            要素
     */
    public static void add(String key, Object value) {
        @SuppressWarnings("unchecked")
        List<Object> messages = (List<Object>) get(key);

        if (messages == null) {
            messages = new ArrayList<>();
        }

        messages.add(value);
        put(key, messages);
    }

    /**
     * FlashMapの指定されたキーに要素を追加する.
     *
     * @param key
     *            キー
     * @param value
     *            要素
     */
    public static void add(String key, Object value) {
        @SuppressWarnings("unchecked")
        List<Object> messages = (List<Object>) get(key);

        if (messages == null) {
            messages = new ArrayList<Object>();
        }

        messages.add(value);
        put(key, messages);
    }

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method public add(key String, value Object) : void from class common.webapp.filter.FlashMap


    /**
     * アプリケーション変数を初期化する.
     *
     * @param context
     *            {@link ServletContext}
     */
    public static void setupContext(ServletContext context) {
        List<LabelValue> fileTypeList = new ArrayList<>();
        fileTypeList.add(new LabelValue(ResourceBundle.getBundle(Constants.BUNDLE_KEY).getString("fileType.xml"), String.valueOf(FileType.XML.getValue())));
        fileTypeList.add(new LabelValue(ResourceBundle.getBundle(Constants.BUNDLE_KEY).getString("fileType.xls"), String.valueOf(FileType.EXCEL.getValue())));
        fileTypeList.add(new LabelValue(ResourceBundle.getBundle(Constants.BUNDLE_KEY).getString("fileType.csv"), String.valueOf(FileType.CSV.getValue())));
        context.setAttribute("fileTypeList", fileTypeList);

        ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(context);

        context.setAttribute(Constants.AVAILABLE_ROLES, ((RoleManager) ctx.getBean("roleManager")).getLabelValues());

        ((UserManager) ctx.getBean("userManager")).reindex();
    }

    /**
     * アプリケーション変数を初期化する.
     *
     * @param context
     *            {@link ServletContext}
     */
    public static void setupContext(ServletContext context) {
        List<LabelValue> fileTypeList = new ArrayList<LabelValue>();
        fileTypeList.add(new LabelValue(ResourceBundle.getBundle(Constants.BUNDLE_KEY).getString("fileType.xml"), String.valueOf(FileType.XML.getValue())));
        fileTypeList.add(new LabelValue(ResourceBundle.getBundle(Constants.BUNDLE_KEY).getString("fileType.xls"), String.valueOf(FileType.EXCEL.getValue())));
        fileTypeList.add(new LabelValue(ResourceBundle.getBundle(Constants.BUNDLE_KEY).getString("fileType.csv"), String.valueOf(FileType.CSV.getValue())));
        context.setAttribute("fileTypeList", fileTypeList);

        ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(context);

        context.setAttribute(Constants.AVAILABLE_ROLES, ((RoleManager) ctx.getBean("roleManager")).getLabelValues());

        ((UserManager) ctx.getBean("userManager")).reindex();
    }

Replace Generic With Diamond ArrayList<LabelValue> with ArrayList<> in method public setupContext(context ServletContext) : void from class common.webapp.listener.StartupListener


    /**
     * {@inheritDoc}
     */
    @Override
    public List<T> convert(MultipartFile multipartFile) {
        CSVReader reader = null;

        try {
            reader = new CSVReader(new InputStreamReader(multipartFile.getInputStream(), Constants.ENCODING), ',', '"', 1);

            return reader.readAll().stream().map(line -> {
                try {
                    CsvFileReader csvFileReader = new CsvFileReader(FileUtils.readFileToString(new ClassPathResource(clazz.getSimpleName() + ".csv", getClass()).getFile(), Constants.ENCODING).split(","));
                    return csvFileReader.read(clazz.newInstance(), line);
                } catch (IOException e) {
                    throw new FileException("errors.io", e);
                } catch (InstantiationException | IllegalAccessException e) {
                    throw new FileException("errors.convert", e);
                }
            }).collect(Collectors.toList());
        } catch (IOException e) {
            throw new FileException("errors.io", e);
        } catch (IllegalArgumentException | IndexOutOfBoundsException | TypeMismatchException e) {
            throw new FileException("errors.convert", e);
        } finally {
            IOUtils.closeQuietly(reader);
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<T> convert(MultipartFile multipartFile) {
        CSVReader reader = null;

        try {
            reader = new CSVReader(new InputStreamReader(multipartFile.getInputStream(), Constants.ENCODING), ',', '"', 1);

            return reader.readAll().stream().map(line -> {
                try {
                    CsvFileReader csvFileReader = new CsvFileReader(FileUtils.readFileToString(new ClassPathResource(clazz.getSimpleName() + ".csv", getClass()).getFile(), Constants.ENCODING).split(","));
                    return csvFileReader.read(clazz.newInstance(), line);
                } catch (IOException e) {
                    throw new FileException("errors.io", e);
                } catch (InstantiationException | IllegalAccessException e) {
                    throw new FileException("errors.convert", e);
                }
            }).collect(Collectors.toList());
        } catch (IOException e) {
            throw new FileException("errors.io", e);
        } catch (IllegalArgumentException e) {
            throw new FileException("errors.convert", e);
        } catch (IndexOutOfBoundsException e) {
            throw new FileException("errors.convert", e);
        } catch (TypeMismatchException e) {
            throw new FileException("errors.convert", e);
        } finally {
            IOUtils.closeQuietly(reader);
        }
    }

Merge Catch [catch(IllegalArgumentException e), catch(IndexOutOfBoundsException e), catch(TypeMismatchException e)] to catch(IllegalArgumentException|IndexOutOfBoundsException|TypeMismatchException e) in method public convert(multipartFile MultipartFile) : List<T> from class common.webapp.converter.CsvFileConverter


    /**
     * {@inheritDoc}
     */
    @Override
    public List<T> convert(MultipartFile multipartFile) {
        String modelName = clazz.getSimpleName();
        Map<String, List<T>> model = new HashMap<>();
        model.put(modelName, new ArrayList<>());

        try {
            if (new JxlsFileReader().read(new ClassPathResource(modelName + ".xml", getClass()), multipartFile, model).isStatusOK()) {
                return model.get(modelName);
            } else {
                throw new FileException("errors.convert");
            }
        } catch (IOException e) {
            throw new FileException("errors.io", e);
        } catch (IllegalArgumentException | InvalidFormatException | XLSDataReadException | SAXException e) {
            throw new FileException("errors.convert", e);
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<T> convert(MultipartFile multipartFile) {
        String modelName = clazz.getSimpleName();
        Map<String, List<T>> model = new HashMap<>();
        model.put(modelName, new ArrayList<>());

        try {
            if (new JxlsFileReader().read(new ClassPathResource(modelName + ".xml", getClass()), multipartFile, model).isStatusOK()) {
                return model.get(modelName);
            } else {
                throw new FileException("errors.convert");
            }
        } catch (IOException e) {
            throw new FileException("errors.io", e);
        } catch (IllegalArgumentException e) {
            throw new FileException("errors.convert", e);
        } catch (InvalidFormatException e) {
            throw new FileException("errors.convert", e);
        } catch (XLSDataReadException e) {
            throw new FileException("errors.convert", e);
        } catch (SAXException e) {
            throw new FileException("errors.convert", e);
        }
    }

Merge Catch [catch(IllegalArgumentException e), catch(InvalidFormatException e), catch(XLSDataReadException e), catch(SAXException e)] to catch(IllegalArgumentException|InvalidFormatException|XLSDataReadException|SAXException e) in method public convert(multipartFile MultipartFile) : List<T> from class common.webapp.converter.XlsFileConverter


    /**
     * コンストラクタ.
     *
     * @param beanList
     *            オブジェクトリスト
     * @param props
     *            変換対象のプロパティ名
     */
    public Grid(List<?> beanList, String... props) {
        beanWrapper = new BeanWrapperImpl();
        this.beanList = new ArrayList<>(beanList);
        this.props = props;
    }

    /**
     * コンストラクタ.
     *
     * @param beanList
     *            オブジェクトリスト
     * @param props
     *            変換対象のプロパティ名
     */
    public Grid(List<?> beanList, String... props) {
        beanWrapper = new BeanWrapperImpl();
        this.beanList = new ArrayList<Object>(beanList);
        this.props = props;
    }

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method public Grid(beanList List<?>, props String...) from class common.webapp.converter.util.Grid


    /**
     * オブジェクトをString配列に変換する.
     *
     * @param grid
     *            オブジェクトと配列を相互変換するクラス
     * @param formatters
     *            変換ルール
     * @return 配列に変換されたオブジェクト
     */
    public static List<String[]> toStringArray(Grid grid, Set<Formatter<?>> formatters) {
        FormattingConversionServiceFactoryBean factoryBean = new FormattingConversionServiceFactoryBean();
        factoryBean.setFormatters(formatters);
        factoryBean.afterPropertiesSet();
        grid.setConversionService(factoryBean.getObject());

        List<String[]> result = new ArrayList<>();

        for (int row = 0; row < grid.rows(); row++) {
            String[] line = new String[grid.columns()];

            for (int col = 0; col < grid.columns(); col++) {
                line[col] = grid.get(row, col, String.class);
            }

            result.add(line);
        }

        return result;
    }

    /**
     * オブジェクトをString配列に変換する.
     *
     * @param grid
     *            オブジェクトと配列を相互変換するクラス
     * @param formatters
     *            変換ルール
     * @return 配列に変換されたオブジェクト
     */
    public static List<String[]> toStringArray(Grid grid, Set<Formatter<?>> formatters) {
        FormattingConversionServiceFactoryBean factoryBean = new FormattingConversionServiceFactoryBean();
        factoryBean.setFormatters(formatters);
        factoryBean.afterPropertiesSet();
        grid.setConversionService(factoryBean.getObject());

        List<String[]> result = new ArrayList<String[]>();

        for (int row = 0; row < grid.rows(); row++) {
            String[] line = new String[grid.columns()];

            for (int col = 0; col < grid.columns(); col++) {
                line[col] = grid.get(row, col, String.class);
            }

            result.add(line);
        }

        return result;
    }

Replace Generic With Diamond ArrayList<String[]> with ArrayList<> in method public toStringArray(grid Grid, formatters Set<Formatter<?>>) : List<String[]> from class common.webapp.converter.util.GridUtil


    /**
     * メールを送信する.
     *
     * @param user
     *            ユーザ
     * @param template
     *            テンプレート
     * @param subject
     *            件名
     * @param message
     *            本文
     * @param url
     *            URL
     */
    private void sendUserEmail(User user, String template, String subject, String message, String url) {
        mailMessage.setSubject("[" + messages.getMessage("webapp.name") + "] " + subject);
        mailMessage.setTo(user.getEmail());

        Map<String, Object> model = new HashMap<>();
        model.put("user", user);
        model.put("message", message);
        model.put("URL", url);

        mailEngine.sendMessage(mailMessage, template, model);
    }

    /**
     * メールを送信する.
     *
     * @param user
     *            ユーザ
     * @param template
     *            テンプレート
     * @param subject
     *            件名
     * @param message
     *            本文
     * @param url
     *            URL
     */
    private void sendUserEmail(User user, String template, String subject, String message, String url) {
        mailMessage.setSubject("[" + messages.getMessage("webapp.name") + "] " + subject);
        mailMessage.setTo(user.getEmail());

        Map<String, Object> model = new HashMap<String, Object>();
        model.put("user", user);
        model.put("message", message);
        model.put("URL", url);

        mailEngine.sendMessage(mailMessage, template, model);
    }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method private sendUserEmail(user User, template String, subject String, message String, url String) : void from class common.service.impl.UserManagerImpl


    public List<Integer> spiralOrder(int[][] matrix)
    {
        List<Integer> result = new ArrayList<>();
        if(matrix.length == 0) return result;

        int rowBegin = 0;
        int rowEnd = matrix.length - 1;
        int colBegin = 0;
        int colEnd = matrix[0].length - 1;

        while(rowBegin <= rowEnd && colBegin <= colEnd)
        {
            // Traverse Right
            for(int j=colBegin; j<= colEnd; j++)
            {
                result.add(matrix[rowBegin][j]);
            }

            // Top row done. Increase rowBegin
            rowBegin++;

            // Traverse Down
            for(int i=rowBegin; i<= rowEnd; i++)
            {
                result.add(matrix[i][colEnd]);
            }

            // Right most column done. Decrease colEnd.
            colEnd--;

            // This guard checks the corner case of just one row in the input
            if(rowBegin <= rowEnd)
            {
                // Traverse Left
                for(int j=colEnd; j>= colBegin; j--)
                {
                    result.add(matrix[rowEnd][j]);
                }

                // Bottom most column done. Decrease the rowEnd
                rowEnd--;
            }

            // This guard checks the corner case of just one column in the input
            if(colBegin <= colEnd)
            {
                // Traverse up
                for(int i=rowEnd; i>= rowBegin; i--)
                {
                    result.add(matrix[i][colBegin]);
                }

                // Leftmost column done. Increase colBegin.
                colBegin++;
            }

        }

        return result;
    }

    public List<Integer> spiralOrder(int[][] matrix)
    {
        List<Integer> result = new ArrayList<Integer>();
        if(matrix.length == 0) return result;

        int rowBegin = 0;
        int rowEnd = matrix.length - 1;
        int colBegin = 0;
        int colEnd = matrix[0].length - 1;

        while(rowBegin <= rowEnd && colBegin <= colEnd)
        {
            // Traverse Right
            for(int j=colBegin; j<= colEnd; j++)
            {
                result.add(matrix[rowBegin][j]);
            }

            // Top row done. Increase rowBegin
            rowBegin++;

            // Traverse Down
            for(int i=rowBegin; i<= rowEnd; i++)
            {
                result.add(matrix[i][colEnd]);
            }

            // Right most column done. Decrease colEnd.
            colEnd--;

            // This guard checks the corner case of just one row in the input
            if(rowBegin <= rowEnd)
            {
                // Traverse Left
                for(int j=colEnd; j>= colBegin; j--)
                {
                    result.add(matrix[rowEnd][j]);
                }

                // Bottom most column done. Decrease the rowEnd
                rowEnd--;
            }

            // This guard checks the corner case of just one column in the input
            if(colBegin <= colEnd)
            {
                // Traverse up
                for(int i=rowEnd; i>= rowBegin; i--)
                {
                    result.add(matrix[i][colBegin]);
                }

                // Leftmost column done. Increase colBegin.
                colBegin++;
            }

        }

        return result;
    }

Replace Generic With Diamond ArrayList<Integer> with ArrayList<> in method public spiralOrder(matrix int[][]) : List<Integer> from class Leetcode.Medium.SpiralMatrix


    @Override
    public Map<String, Object> pageList(int start, int length, int jobGroup, int triggerStatus, String jobDesc, String glueType, String author) {

        // page list
        List<JobInfo> list = jobInfoMapper.pageList(start, length, jobGroup, triggerStatus, jobDesc, glueType, author);
        int list_count = jobInfoMapper.pageListCount(start, length, jobGroup, triggerStatus, jobDesc, glueType, author);

        // package result
        Map<String, Object> maps = new HashMap<>();
        maps.put("recordsTotal", list_count);        // 总记录数
        maps.put("recordsFiltered", list_count);    // 过滤后的总记录数
        maps.put("data", list);                    // 分页列表
        return maps;
    }

    @Override
    public Map<String, Object> pageList(int start, int length, int jobGroup, int triggerStatus, String jobDesc, String glueType, String author) {

        // page list
        List<JobInfo> list = jobInfoMapper.pageList(start, length, jobGroup, triggerStatus, jobDesc, glueType, author);
        int list_count = jobInfoMapper.pageListCount(start, length, jobGroup, triggerStatus, jobDesc, glueType, author);

        // package result
        Map<String, Object> maps = new HashMap<String, Object>();
        maps.put("recordsTotal", list_count);        // 总记录数
        maps.put("recordsFiltered", list_count);    // 过滤后的总记录数
        maps.put("data", list);                    // 分页列表
        return maps;
    }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method public pageList(start int, length int, jobGroup int, triggerStatus int, jobDesc String, glueType String, author String) : Map<String,Object> from class com.wugui.datax.admin.service.impl.JobServiceImpl


	@Override
	public Map<String, Object> pageList(int start, int length, int jobGroup, String jobDesc, String executorHandler, String author) {

		// page list
		List<JobTemplate> list = jobTemplateMapper.pageList(start, length, jobGroup, jobDesc, executorHandler, author);
		int list_count = jobTemplateMapper.pageListCount(start, length, jobGroup, jobDesc, executorHandler, author);

		// package result
		Map<String, Object> maps = new HashMap<>();
	    maps.put("recordsTotal", list_count);		// 总记录数
	    maps.put("recordsFiltered", list_count);	// 过滤后的总记录数
	    maps.put("data", list);  					// 分页列表
		return maps;
	}

	@Override
	public Map<String, Object> pageList(int start, int length, int jobGroup, String jobDesc, String executorHandler, String author) {

		// page list
		List<JobTemplate> list = jobTemplateMapper.pageList(start, length, jobGroup, jobDesc, executorHandler, author);
		int list_count = jobTemplateMapper.pageListCount(start, length, jobGroup, jobDesc, executorHandler, author);

		// package result
		Map<String, Object> maps = new HashMap<String, Object>();
	    maps.put("recordsTotal", list_count);		// 总记录数
	    maps.put("recordsFiltered", list_count);	// 过滤后的总记录数
	    maps.put("data", list);  					// 分页列表
		return maps;
	}

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method public pageList(start int, length int, jobGroup int, jobDesc String, executorHandler String, author String) : Map<String,Object> from class com.wugui.datax.admin.service.impl.JobTemplateServiceImpl


    @Override
    public ReturnT<String> update(JobInfo jobInfo) {

        // valid
        if (!CronExpression.isValidExpression(jobInfo.getJobCron())) {
            return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid"));
        }
        if (jobInfo.getGlueType().equals(GlueTypeEnum.BEAN.getDesc()) && jobInfo.getJobJson().trim().length() <= 2) {
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_jobjson")));
        }
        if (jobInfo.getJobDesc() == null || jobInfo.getJobDesc().trim().length() == 0) {
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_jobdesc")));
        }
        if (jobInfo.getAuthor() == null || jobInfo.getAuthor().trim().length() == 0) {
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_author")));
        }
        if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy") + I18nUtil.getString("system_unvalid")));
        }
        if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy") + I18nUtil.getString("system_unvalid")));
        }

        // ChildJobId valid
        if (jobInfo.getChildJobId() != null && jobInfo.getChildJobId().trim().length() > 0) {
            String[] childJobIds = jobInfo.getChildJobId().split(",");
            for (String childJobIdItem : childJobIds) {
                if (childJobIdItem != null && childJobIdItem.trim().length() > 0 && isNumeric(childJobIdItem)) {
                    JobInfo childJobInfo = jobInfoMapper.loadById(Integer.parseInt(childJobIdItem));
                    if (childJobInfo == null) {
                        return new ReturnT<String>(ReturnT.FAIL_CODE,
                                MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId") + "({0})" + I18nUtil.getString("system_not_found")), childJobIdItem));
                    }
                } else {
                    return new ReturnT<String>(ReturnT.FAIL_CODE,
                            MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId") + "({0})" + I18nUtil.getString("system_unvalid")), childJobIdItem));
                }
            }

            // join , avoid "xxx,,"
            String temp = "";
            for (String item : childJobIds) {
                temp += item + ",";
            }
            temp = temp.substring(0, temp.length() - 1);

            jobInfo.setChildJobId(temp);
        }

        // group valid
        JobGroup jobGroup = jobGroupMapper.load(jobInfo.getJobGroup());
        if (jobGroup == null) {
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_jobgroup") + I18nUtil.getString("system_unvalid")));
        }

        // stage job info
        JobInfo exists_jobInfo = jobInfoMapper.loadById(jobInfo.getId());
        if (exists_jobInfo == null) {
            return new ReturnT<>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_id") + I18nUtil.getString("system_not_found")));
        }

        // next trigger time (5s后生效，避开预读周期)
        long nextTriggerTime = exists_jobInfo.getTriggerNextTime();
        if (exists_jobInfo.getTriggerStatus() == 1 && !jobInfo.getJobCron().equals(exists_jobInfo.getJobCron())) {
            try {
                Date nextValidTime = new CronExpression(jobInfo.getJobCron()).getNextValidTimeAfter(new Date(System.currentTimeMillis() + JobScheduleHelper.PRE_READ_MS));
                if (nextValidTime == null) {
                    return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_never_fire"));
                }
                nextTriggerTime = nextValidTime.getTime();
            } catch (ParseException e) {
                logger.error(e.getMessage(), e);
                return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid") + " | " + e.getMessage());
            }
        }

        exists_jobInfo.setJobGroup(jobInfo.getJobGroup());
        exists_jobInfo.setJobCron(jobInfo.getJobCron());
        exists_jobInfo.setJobDesc(jobInfo.getJobDesc());
        exists_jobInfo.setAuthor(jobInfo.getAuthor());
        exists_jobInfo.setAlarmEmail(jobInfo.getAlarmEmail());
        exists_jobInfo.setExecutorRouteStrategy(jobInfo.getExecutorRouteStrategy());
        exists_jobInfo.setExecutorHandler(jobInfo.getExecutorHandler());
        exists_jobInfo.setExecutorParam(jobInfo.getExecutorParam());
        exists_jobInfo.setExecutorBlockStrategy(jobInfo.getExecutorBlockStrategy());
        exists_jobInfo.setExecutorTimeout(jobInfo.getExecutorTimeout());
        exists_jobInfo.setExecutorFailRetryCount(jobInfo.getExecutorFailRetryCount());
        exists_jobInfo.setChildJobId(jobInfo.getChildJobId());
        exists_jobInfo.setTriggerNextTime(nextTriggerTime);
        exists_jobInfo.setReplaceParam(jobInfo.getReplaceParam());
        exists_jobInfo.setJvmParam(jobInfo.getJvmParam());
        exists_jobInfo.setIncStartTime(jobInfo.getIncStartTime());
        exists_jobInfo.setUpdateTime(new Date());
        exists_jobInfo.setGlueType(jobInfo.getGlueType());
        exists_jobInfo.setPartitionInfo(jobInfo.getPartitionInfo());

        if (GlueTypeEnum.BEAN.getDesc().equals(jobInfo.getGlueType())) {
            exists_jobInfo.setJobJson(jobInfo.getJobJson());
            exists_jobInfo.setGlueSource(null);
        } else {
            exists_jobInfo.setGlueSource(jobInfo.getGlueSource());
            exists_jobInfo.setJobJson(null);
        }
        exists_jobInfo.setGlueUpdatetime(new Date());
        jobInfoMapper.update(exists_jobInfo);

        return ReturnT.SUCCESS;
    }

    @Override
    public ReturnT<String> update(JobInfo jobInfo) {

        // valid
        if (!CronExpression.isValidExpression(jobInfo.getJobCron())) {
            return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid"));
        }
        if (jobInfo.getGlueType().equals(GlueTypeEnum.BEAN.getDesc()) && jobInfo.getJobJson().trim().length() <= 2) {
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_jobjson")));
        }
        if (jobInfo.getJobDesc() == null || jobInfo.getJobDesc().trim().length() == 0) {
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_jobdesc")));
        }
        if (jobInfo.getAuthor() == null || jobInfo.getAuthor().trim().length() == 0) {
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_author")));
        }
        if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy") + I18nUtil.getString("system_unvalid")));
        }
        if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy") + I18nUtil.getString("system_unvalid")));
        }

        // ChildJobId valid
        if (jobInfo.getChildJobId() != null && jobInfo.getChildJobId().trim().length() > 0) {
            String[] childJobIds = jobInfo.getChildJobId().split(",");
            for (String childJobIdItem : childJobIds) {
                if (childJobIdItem != null && childJobIdItem.trim().length() > 0 && isNumeric(childJobIdItem)) {
                    JobInfo childJobInfo = jobInfoMapper.loadById(Integer.parseInt(childJobIdItem));
                    if (childJobInfo == null) {
                        return new ReturnT<String>(ReturnT.FAIL_CODE,
                                MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId") + "({0})" + I18nUtil.getString("system_not_found")), childJobIdItem));
                    }
                } else {
                    return new ReturnT<String>(ReturnT.FAIL_CODE,
                            MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId") + "({0})" + I18nUtil.getString("system_unvalid")), childJobIdItem));
                }
            }

            // join , avoid "xxx,,"
            String temp = "";
            for (String item : childJobIds) {
                temp += item + ",";
            }
            temp = temp.substring(0, temp.length() - 1);

            jobInfo.setChildJobId(temp);
        }

        // group valid
        JobGroup jobGroup = jobGroupMapper.load(jobInfo.getJobGroup());
        if (jobGroup == null) {
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_jobgroup") + I18nUtil.getString("system_unvalid")));
        }

        // stage job info
        JobInfo exists_jobInfo = jobInfoMapper.loadById(jobInfo.getId());
        if (exists_jobInfo == null) {
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_id") + I18nUtil.getString("system_not_found")));
        }

        // next trigger time (5s后生效，避开预读周期)
        long nextTriggerTime = exists_jobInfo.getTriggerNextTime();
        if (exists_jobInfo.getTriggerStatus() == 1 && !jobInfo.getJobCron().equals(exists_jobInfo.getJobCron())) {
            try {
                Date nextValidTime = new CronExpression(jobInfo.getJobCron()).getNextValidTimeAfter(new Date(System.currentTimeMillis() + JobScheduleHelper.PRE_READ_MS));
                if (nextValidTime == null) {
                    return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_never_fire"));
                }
                nextTriggerTime = nextValidTime.getTime();
            } catch (ParseException e) {
                logger.error(e.getMessage(), e);
                return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid") + " | " + e.getMessage());
            }
        }

        exists_jobInfo.setJobGroup(jobInfo.getJobGroup());
        exists_jobInfo.setJobCron(jobInfo.getJobCron());
        exists_jobInfo.setJobDesc(jobInfo.getJobDesc());
        exists_jobInfo.setAuthor(jobInfo.getAuthor());
        exists_jobInfo.setAlarmEmail(jobInfo.getAlarmEmail());
        exists_jobInfo.setExecutorRouteStrategy(jobInfo.getExecutorRouteStrategy());
        exists_jobInfo.setExecutorHandler(jobInfo.getExecutorHandler());
        exists_jobInfo.setExecutorParam(jobInfo.getExecutorParam());
        exists_jobInfo.setExecutorBlockStrategy(jobInfo.getExecutorBlockStrategy());
        exists_jobInfo.setExecutorTimeout(jobInfo.getExecutorTimeout());
        exists_jobInfo.setExecutorFailRetryCount(jobInfo.getExecutorFailRetryCount());
        exists_jobInfo.setChildJobId(jobInfo.getChildJobId());
        exists_jobInfo.setTriggerNextTime(nextTriggerTime);
        exists_jobInfo.setReplaceParam(jobInfo.getReplaceParam());
        exists_jobInfo.setJvmParam(jobInfo.getJvmParam());
        exists_jobInfo.setIncStartTime(jobInfo.getIncStartTime());
        exists_jobInfo.setUpdateTime(new Date());
        exists_jobInfo.setGlueType(jobInfo.getGlueType());
        exists_jobInfo.setPartitionInfo(jobInfo.getPartitionInfo());

        if (GlueTypeEnum.BEAN.getDesc().equals(jobInfo.getGlueType())) {
            exists_jobInfo.setJobJson(jobInfo.getJobJson());
            exists_jobInfo.setGlueSource(null);
        } else {
            exists_jobInfo.setGlueSource(jobInfo.getGlueSource());
            exists_jobInfo.setJobJson(null);
        }
        exists_jobInfo.setGlueUpdatetime(new Date());
        jobInfoMapper.update(exists_jobInfo);

        return ReturnT.SUCCESS;
    }

Replace Generic With Diamond ReturnT<String> with ReturnT<> in method public update(jobInfo JobInfo) : ReturnT<String> from class com.wugui.datax.admin.service.impl.JobServiceImpl


    /**
     * make server thread pool
     *
     * @param serverType
     * @return
     */
    public static ThreadPoolExecutor makeServerThreadPool(final String serverType, int corePoolSize, int maxPoolSize) {
        ThreadPoolExecutor serverHandlerPool = new ThreadPoolExecutor(
                corePoolSize,
                maxPoolSize,
                60L,
                TimeUnit.SECONDS,
                new LinkedBlockingQueue<>(1000),
                r -> new Thread(r, "xxl-rpc, " + serverType + "-serverHandlerPool-" + r.hashCode()),
                (r, executor) -> {
                    throw new XxlRpcException("xxl-rpc " + serverType + " Thread pool is EXHAUSTED!");
                });        // default maxThreads 300, minThreads 60

        return serverHandlerPool;
    }

    /**
     * make server thread pool
     *
     * @param serverType
     * @return
     */
    public static ThreadPoolExecutor makeServerThreadPool(final String serverType, int corePoolSize, int maxPoolSize){
        ThreadPoolExecutor serverHandlerPool = new ThreadPoolExecutor(
                corePoolSize,
                maxPoolSize,
                60L,
                TimeUnit.SECONDS,
                new LinkedBlockingQueue<Runnable>(1000),
                new ThreadFactory() {
                    @Override
                    public Thread newThread(Runnable r) {
                        return new Thread(r, "xxl-rpc, "+serverType+"-serverHandlerPool-" + r.hashCode());
                    }
                },
                new RejectedExecutionHandler() {
                    @Override
                    public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
                        throw new XxlRpcException("xxl-rpc "+serverType+" Thread pool is EXHAUSTED!");
                    }
                });		// default maxThreads 300, minThreads 60

        return serverHandlerPool;
    }

Replace Generic With Diamond ThreadPoolExecutor with ThreadPoolExecutor in method public makeServerThreadPool(serverType String, corePoolSize int, maxPoolSize int) : ThreadPoolExecutor from class com.wugui.datax.rpc.util.ThreadPoolUtil


    private static DateFormat getDateFormat(String pattern) {
        if (pattern==null || pattern.trim().length()==0) {
            throw new IllegalArgumentException("pattern cannot be empty.");
        }

        Map<String, DateFormat> dateFormatMap = dateFormatThreadLocal.get();
        if(dateFormatMap!=null && dateFormatMap.containsKey(pattern)){
            return dateFormatMap.get(pattern);
        }

        synchronized (dateFormatThreadLocal) {
            if (dateFormatMap == null) {
                dateFormatMap = new HashMap<>();
            }
            dateFormatMap.put(pattern, new SimpleDateFormat(pattern));
            dateFormatThreadLocal.set(dateFormatMap);
        }

        return dateFormatMap.get(pattern);
    }

    private static DateFormat getDateFormat(String pattern) {
        if (pattern==null || pattern.trim().length()==0) {
            throw new IllegalArgumentException("pattern cannot be empty.");
        }

        Map<String, DateFormat> dateFormatMap = dateFormatThreadLocal.get();
        if(dateFormatMap!=null && dateFormatMap.containsKey(pattern)){
            return dateFormatMap.get(pattern);
        }

        synchronized (dateFormatThreadLocal) {
            if (dateFormatMap == null) {
                dateFormatMap = new HashMap<String, DateFormat>();
            }
            dateFormatMap.put(pattern, new SimpleDateFormat(pattern));
            dateFormatThreadLocal.set(dateFormatMap);
        }

        return dateFormatMap.get(pattern);
    }

Replace Generic With Diamond HashMap<String,DateFormat> with HashMap<> in method private getDateFormat(pattern String) : DateFormat from class com.wugui.datatx.core.util.DateUtil


    @Override
    public void start(final XxlRpcProviderFactory xxlRpcProviderFactory) {

        thread = new Thread(() -> {
            // param
            final ThreadPoolExecutor serverHandlerPool = ThreadPoolUtil.makeServerThreadPool(
                    NettyHttpServer.class.getSimpleName(),
                    xxlRpcProviderFactory.getCorePoolSize(),
                    xxlRpcProviderFactory.getMaxPoolSize());
            EventLoopGroup bossGroup = new NioEventLoopGroup();
            EventLoopGroup workerGroup = new NioEventLoopGroup();

            try {
                // start server
                ServerBootstrap bootstrap = new ServerBootstrap();
                bootstrap.group(bossGroup, workerGroup)
                        .channel(NioServerSocketChannel.class)
                        .childHandler(new ChannelInitializer<SocketChannel>() {
                            @Override
                            public void initChannel(SocketChannel channel) {
                                channel.pipeline()
                                        .addLast(new IdleStateHandler(0, 0, Beat.BEAT_INTERVAL * 3, TimeUnit.SECONDS))  // beat 3N, close if idle
                                        .addLast(new HttpServerCodec())
                                        .addLast(new HttpObjectAggregator(NettyConstant.MAX_LENGTH))  // merge request & reponse to FULL
                                        .addLast(new NettyHttpServerHandler(xxlRpcProviderFactory, serverHandlerPool));
                            }
                        })
                        .childOption(ChannelOption.SO_KEEPALIVE, true);

                // bind
                ChannelFuture future = bootstrap.bind(xxlRpcProviderFactory.getPort()).sync();

                logger.info(">>>>>>>>>>> xxl-rpc remoting server start success, nettype = {}, port = {}", NettyHttpServer.class.getName(), xxlRpcProviderFactory.getPort());
                onStarted();

                // wait util stop
                future.channel().closeFuture().sync();

            } catch (InterruptedException e) {
                if (e instanceof InterruptedException) {
                    logger.info(">>>>>>>>>>> xxl-rpc remoting server stop.");
                } else {
                    logger.error(">>>>>>>>>>> xxl-rpc remoting server error.", e);
                }
            } finally {

                // stop
                try {
                    serverHandlerPool.shutdown();    // shutdownNow
                } catch (Exception e) {
                    logger.error(e.getMessage(), e);
                }
                try {
                    workerGroup.shutdownGracefully();
                    bossGroup.shutdownGracefully();
                } catch (Exception e) {
                    logger.error(e.getMessage(), e);
                }
            }

        });
        thread.setDaemon(true);    // daemon, service jvm, user thread leave >>> daemon leave >>> jvm leave
        thread.start();
    }

    @Override
    public void start(final XxlRpcProviderFactory xxlRpcProviderFactory) throws Exception {

        thread = new Thread(new Runnable() {

            @Override
            public void run() {

                // param
                final ThreadPoolExecutor serverHandlerPool = ThreadPoolUtil.makeServerThreadPool(
                        NettyHttpServer.class.getSimpleName(),
                        xxlRpcProviderFactory.getCorePoolSize(),
                        xxlRpcProviderFactory.getMaxPoolSize());
                EventLoopGroup bossGroup = new NioEventLoopGroup();
                EventLoopGroup workerGroup = new NioEventLoopGroup();

                try {
                    // start server
                    ServerBootstrap bootstrap = new ServerBootstrap();
                    bootstrap.group(bossGroup, workerGroup)
                            .channel(NioServerSocketChannel.class)
                            .childHandler(new ChannelInitializer<SocketChannel>() {
                                @Override
                                public void initChannel(SocketChannel channel) throws Exception {
                                    channel.pipeline()
                                            .addLast(new IdleStateHandler(0, 0, Beat.BEAT_INTERVAL * 3, TimeUnit.SECONDS))  // beat 3N, close if idle
                                            .addLast(new HttpServerCodec())
                                            .addLast(new HttpObjectAggregator(5 * 1024 * 1024))  // merge request & reponse to FULL
                                            .addLast(new NettyHttpServerHandler(xxlRpcProviderFactory, serverHandlerPool));
                                }
                            })
                            .childOption(ChannelOption.SO_KEEPALIVE, true);

                    // bind
                    ChannelFuture future = bootstrap.bind(xxlRpcProviderFactory.getPort()).sync();

                    logger.info(">>>>>>>>>>> xxl-rpc remoting server start success, nettype = {}, port = {}", NettyHttpServer.class.getName(), xxlRpcProviderFactory.getPort());
                    onStarted();

                    // wait util stop
                    future.channel().closeFuture().sync();

                } catch (InterruptedException e) {
                    if (e instanceof InterruptedException) {
                        logger.info(">>>>>>>>>>> xxl-rpc remoting server stop.");
                    } else {
                        logger.error(">>>>>>>>>>> xxl-rpc remoting server error.", e);
                    }
                } finally {

                    // stop
                    try {
                        serverHandlerPool.shutdown();    // shutdownNow
                    } catch (Exception e) {
                        logger.error(e.getMessage(), e);
                    }
                    try {
                        workerGroup.shutdownGracefully();
                        bossGroup.shutdownGracefully();
                    } catch (Exception e) {
                        logger.error(e.getMessage(), e);
                    }
                }

            }

        });
        thread.setDaemon(true);    // daemon, service jvm, user thread leave >>> daemon leave >>> jvm leave
        thread.start();
    }

Replace Anonymous With Lambda com.wugui.datax.rpc.remoting.net.impl.netty_http.server.NettyHttpServer.start.new Thread.new Runnable with () -> {final ThreadPoolExecutor serverHandlerPool=ThreadPoolUtil.makeServerThreadPool(NettyHttpServer.class.getSimpleName(),xxlRpcProviderFactory.getCorePoolSize(),xxlRpcProviderFactory.getMaxPoolSize()); in method public start(xxlRpcProviderFactory XxlRpcProviderFactory) : void from class com.wugui.datax.rpc.remoting.net.impl.netty_http.server.NettyHttpServer


	@RequestMapping(value ="/logDetailCat",method = RequestMethod.GET)
	@ApiOperation("运行日志详情")
	public ReturnT<LogResult> logDetailCat(String executorAddress, long triggerTime, long logId, int fromLineNum){
		try {
			ExecutorBiz executorBiz = JobScheduler.getExecutorBiz(executorAddress);
			ReturnT<LogResult> logResult = executorBiz.log(triggerTime, logId, fromLineNum);

			// is end
			if (logResult.getContent()!=null && logResult.getContent().getFromLineNum() > logResult.getContent().getToLineNum()) {
				JobLog jobLog = jobLogMapper.load(logId);
				if (jobLog.getHandleCode() > 0) {
					logResult.getContent().setEnd(true);
				}
			}

			return logResult;
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			return new ReturnT<>(ReturnT.FAIL_CODE, e.getMessage());
		}
	}

	@RequestMapping(value ="/logDetailCat",method = RequestMethod.GET)
	@ApiOperation("运行日志详情")
	public ReturnT<LogResult> logDetailCat(String executorAddress, long triggerTime, long logId, int fromLineNum){
		try {
			ExecutorBiz executorBiz = JobScheduler.getExecutorBiz(executorAddress);
			ReturnT<LogResult> logResult = executorBiz.log(triggerTime, logId, fromLineNum);

			// is end
			if (logResult.getContent()!=null && logResult.getContent().getFromLineNum() > logResult.getContent().getToLineNum()) {
				JobLog jobLog = jobLogMapper.load(logId);
				if (jobLog.getHandleCode() > 0) {
					logResult.getContent().setEnd(true);
				}
			}

			return logResult;
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			return new ReturnT<LogResult>(ReturnT.FAIL_CODE, e.getMessage());
		}
	}

Replace Generic With Diamond ReturnT<LogResult> with ReturnT<> in method public logDetailCat(executorAddress String, triggerTime long, logId long, fromLineNum int) : ReturnT<LogResult> from class com.wugui.datax.admin.controller.JobLogController


    /**
     * new trigger to queue
     *
     * @param triggerParam
     * @return
     */
    public ReturnT<String> pushTriggerQueue(TriggerParam triggerParam) {
        // avoid repeat
        if (triggerLogIdSet.contains(triggerParam.getLogId())) {
            logger.info(">>>>>>>>>>> repeate trigger job, logId:{}", triggerParam.getLogId());
            return new ReturnT<>(ReturnT.FAIL_CODE, "repeate trigger job, logId:" + triggerParam.getLogId());
        }

        triggerLogIdSet.add(triggerParam.getLogId());
        triggerQueue.add(triggerParam);
        return ReturnT.SUCCESS;
    }

    /**
     * new trigger to queue
     *
     * @param triggerParam
     * @return
     */
    public ReturnT<String> pushTriggerQueue(TriggerParam triggerParam) {
        // avoid repeat
        if (triggerLogIdSet.contains(triggerParam.getLogId())) {
            logger.info(">>>>>>>>>>> repeate trigger job, logId:{}", triggerParam.getLogId());
            return new ReturnT<String>(ReturnT.FAIL_CODE, "repeate trigger job, logId:" + triggerParam.getLogId());
        }

        triggerLogIdSet.add(triggerParam.getLogId());
        triggerQueue.add(triggerParam);
        return ReturnT.SUCCESS;
    }

Replace Generic With Diamond ReturnT<String> with ReturnT<> in method public pushTriggerQueue(triggerParam TriggerParam) : ReturnT<String> from class com.wugui.datatx.core.thread.JobThread


	@GetMapping("/pageList")
	@ApiOperation("运行日志列表")
	public ReturnT<Map<String, Object>> pageList(
										@RequestParam(required = false, defaultValue = "0") int current,
										@RequestParam(required = false, defaultValue = "10") int size,
										int jobGroup, int jobId, int logStatus, String filterTime) {

		// valid permission
		//JobInfoController.validPermission(request, jobGroup);	// 仅管理员支持查询全部；普通用户仅支持查询有权限的 jobGroup

		// parse param
		Date triggerTimeStart = null;
		Date triggerTimeEnd = null;
		if (filterTime!=null && filterTime.trim().length()>0) {
			String[] temp = filterTime.split(" - ");
			if (temp.length == 2) {
				triggerTimeStart = DateUtil.parseDateTime(temp[0]);
				triggerTimeEnd = DateUtil.parseDateTime(temp[1]);
			}
		}

		// page query
		List<JobLog> list = jobLogMapper.pageList((current-1)*size, size, jobGroup, jobId, triggerTimeStart, triggerTimeEnd, logStatus);
		int list_count = jobLogMapper.pageListCount((current-1)*size, size, jobGroup, jobId, triggerTimeStart, triggerTimeEnd, logStatus);

		// package result
		Map<String, Object> maps = new HashMap<>();
		maps.put("recordsTotal", list_count);		// 总记录数
		maps.put("recordsFiltered", list_count);	// 过滤后的总记录数
		maps.put("data", list);  					// 分页列表
		return new ReturnT<>(maps);
	}

	@GetMapping("/pageList")
	@ApiOperation("运行日志列表")
	public ReturnT<Map<String, Object>> pageList(
										@RequestParam(required = false, defaultValue = "0") int current,
										@RequestParam(required = false, defaultValue = "10") int size,
										int jobGroup, int jobId, int logStatus, String filterTime) {

		// valid permission
		//JobInfoController.validPermission(request, jobGroup);	// 仅管理员支持查询全部；普通用户仅支持查询有权限的 jobGroup

		// parse param
		Date triggerTimeStart = null;
		Date triggerTimeEnd = null;
		if (filterTime!=null && filterTime.trim().length()>0) {
			String[] temp = filterTime.split(" - ");
			if (temp.length == 2) {
				triggerTimeStart = DateUtil.parseDateTime(temp[0]);
				triggerTimeEnd = DateUtil.parseDateTime(temp[1]);
			}
		}

		// page query
		List<JobLog> list = jobLogMapper.pageList((current-1)*size, size, jobGroup, jobId, triggerTimeStart, triggerTimeEnd, logStatus);
		int list_count = jobLogMapper.pageListCount((current-1)*size, size, jobGroup, jobId, triggerTimeStart, triggerTimeEnd, logStatus);

		// package result
		Map<String, Object> maps = new HashMap<String, Object>();
		maps.put("recordsTotal", list_count);		// 总记录数
		maps.put("recordsFiltered", list_count);	// 过滤后的总记录数
		maps.put("data", list);  					// 分页列表
		return new ReturnT<>(maps);
	}

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method public pageList(current int, size int, jobGroup int, jobId int, logStatus int, filterTime String) : ReturnT<Map<String,Object>> from class com.wugui.datax.admin.controller.JobLogController


    @PostMapping(value = "/update")
    @ApiOperation("更新用户信息")
    public ReturnT<String> update(@RequestBody JobUser jobUser) {
        // valid password
        if (StringUtils.hasText(jobUser.getPassword())) {
            jobUser.setPassword(jobUser.getPassword().trim());
            if (!(jobUser.getPassword().length()>=4 && jobUser.getPassword().length()<=20)) {
                return new ReturnT<>(ReturnT.FAIL_CODE, I18nUtil.getString("system_lengh_limit") + "[4-20]");
            }
            jobUser.setPassword(bCryptPasswordEncoder.encode(jobUser.getPassword()));
        } else {
            jobUser.setPassword(null);
        }
        // write
        jobUserMapper.update(jobUser);
        return ReturnT.SUCCESS;
    }

    @PostMapping(value = "/update")
    @ApiOperation("更新用户信息")
    public ReturnT<String> update(@RequestBody JobUser jobUser) {
        // valid password
        if (StringUtils.hasText(jobUser.getPassword())) {
            jobUser.setPassword(jobUser.getPassword().trim());
            if (!(jobUser.getPassword().length()>=4 && jobUser.getPassword().length()<=20)) {
                return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_lengh_limit")+"[4-20]" );
            }
            jobUser.setPassword(bCryptPasswordEncoder.encode(jobUser.getPassword()));
        } else {
            jobUser.setPassword(null);
        }
        // write
        jobUserMapper.update(jobUser);
        return ReturnT.SUCCESS;
    }

Replace Generic With Diamond ReturnT<String> with ReturnT<> in method public update(jobUser JobUser) : ReturnT<String> from class com.wugui.datax.admin.controller.UserController


    @Override
    public ReturnT<String> idleBeat(int jobId) {

        // isRunningOrHasQueue
        boolean isRunningOrHasQueue = false;
        JobThread jobThread = JobExecutor.loadJobThread(jobId);
        if (jobThread != null && jobThread.isRunningOrHasQueue()) {
            isRunningOrHasQueue = true;
        }

        if (isRunningOrHasQueue) {
            return new ReturnT<>(ReturnT.FAIL_CODE, "job thread is running or has trigger queue.");
        }
        return ReturnT.SUCCESS;
    }

    @Override
    public ReturnT<String> idleBeat(int jobId) {

        // isRunningOrHasQueue
        boolean isRunningOrHasQueue = false;
        JobThread jobThread = JobExecutor.loadJobThread(jobId);
        if (jobThread != null && jobThread.isRunningOrHasQueue()) {
            isRunningOrHasQueue = true;
        }

        if (isRunningOrHasQueue) {
            return new ReturnT<String>(ReturnT.FAIL_CODE, "job thread is running or has trigger queue.");
        }
        return ReturnT.SUCCESS;
    }

Replace Generic With Diamond ReturnT<String> with ReturnT<> in method public idleBeat(jobId int) : ReturnT<String> from class com.wugui.datatx.core.biz.impl.ExecutorBizImpl


    @Override
    public ReturnT<String> kill(int jobId) {
        // kill handlerThread, and create new one
        JobThread jobThread = JobExecutor.loadJobThread(jobId);
        if (jobThread != null) {
            JobExecutor.removeJobThread(jobId, "scheduling center kill job.");
            return ReturnT.SUCCESS;
        }

        return new ReturnT<>(ReturnT.SUCCESS_CODE, "job thread already killed.");
    }

    @Override
    public ReturnT<String> kill(int jobId) {
        // kill handlerThread, and create new one
        JobThread jobThread = JobExecutor.loadJobThread(jobId);
        if (jobThread != null) {
            JobExecutor.removeJobThread(jobId, "scheduling center kill job.");
            return ReturnT.SUCCESS;
        }

        return new ReturnT<String>(ReturnT.SUCCESS_CODE, "job thread already killed.");
    }

Replace Generic With Diamond ReturnT<String> with ReturnT<> in method public kill(jobId int) : ReturnT<String> from class com.wugui.datatx.core.biz.impl.ExecutorBizImpl


    @Override
    public ReturnT<LogResult> log(long logDateTim, long logId, int fromLineNum) {
        // log filename: logPath/yyyy-MM-dd/9999.log
        String logFileName = JobFileAppender.makeLogFileName(new Date(logDateTim), logId);

        LogResult logResult = JobFileAppender.readLog(logFileName, fromLineNum);
        return new ReturnT<>(logResult);
    }

    @Override
    public ReturnT<LogResult> log(long logDateTim, long logId, int fromLineNum) {
        // log filename: logPath/yyyy-MM-dd/9999.log
        String logFileName = JobFileAppender.makeLogFileName(new Date(logDateTim), logId);

        LogResult logResult = JobFileAppender.readLog(logFileName, fromLineNum);
        return new ReturnT<LogResult>(logResult);
    }

Replace Generic With Diamond ReturnT<LogResult> with ReturnT<> in method public log(logDateTim long, logId long, fromLineNum int) : ReturnT<LogResult> from class com.wugui.datatx.core.biz.impl.ExecutorBizImpl


    private void initAdminBizList(String adminAddresses, String accessToken) throws Exception {
        if (adminAddresses!=null && adminAddresses.trim().length()>0) {
            for (String address: adminAddresses.trim().split(",")) {
                if (address!=null && address.trim().length()>0) {
                    //实例化AdminBizClient
                    AdminBiz adminBiz = new AdminBizClient(address.trim(), accessToken);

                    if (adminBizList == null) {
                        adminBizList = new ArrayList<>();
                    }
                    adminBizList.add(adminBiz);
                }
            }
        }
    }

    private void initAdminBizList(String adminAddresses, String accessToken) throws Exception {
        if (adminAddresses!=null && adminAddresses.trim().length()>0) {
            for (String address: adminAddresses.trim().split(",")) {
                if (address!=null && address.trim().length()>0) {
                    //实例化AdminBizClient
                    AdminBiz adminBiz = new AdminBizClient(address.trim(), accessToken);

                    if (adminBizList == null) {
                        adminBizList = new ArrayList<AdminBiz>();
                    }
                    adminBizList.add(adminBiz);
                }
            }
        }
    }

Replace Generic With Diamond ArrayList<AdminBiz> with ArrayList<> in method private initAdminBizList(adminAddresses String, accessToken String) : void from class com.wugui.datatx.core.executor.JobExecutor


    private void initRpcProvider(String ip, int port, String appName, String accessToken) throws Exception {

        // init, provider factory
        String address = IpUtil.getIpPort(ip, port);
        Map<String, String> serviceRegistryParam = new HashMap<>();
        serviceRegistryParam.put("appName", appName);
        serviceRegistryParam.put("address", address);

        xxlRpcProviderFactory = new XxlRpcProviderFactory();

        xxlRpcProviderFactory.setServer(NettyHttpServer.class);
        xxlRpcProviderFactory.setSerializer(HessianSerializer.class);
        xxlRpcProviderFactory.setCorePoolSize(20);
        xxlRpcProviderFactory.setMaxPoolSize(200);
        xxlRpcProviderFactory.setIp(ip);
        xxlRpcProviderFactory.setPort(port);
        xxlRpcProviderFactory.setAccessToken(accessToken);
        xxlRpcProviderFactory.setServiceRegistry(ExecutorServiceRegistry.class);
        xxlRpcProviderFactory.setServiceRegistryParam(serviceRegistryParam);

        // add services
        xxlRpcProviderFactory.addService(ExecutorBiz.class.getName(), null, new ExecutorBizImpl());

        // start
        xxlRpcProviderFactory.start();

    }

    private void initRpcProvider(String ip, int port, String appName, String accessToken) throws Exception {

        // init, provider factory
        String address = IpUtil.getIpPort(ip, port);
        Map<String, String> serviceRegistryParam = new HashMap<String, String>();
        serviceRegistryParam.put("appName", appName);
        serviceRegistryParam.put("address", address);

        xxlRpcProviderFactory = new XxlRpcProviderFactory();

        xxlRpcProviderFactory.setServer(NettyHttpServer.class);
        xxlRpcProviderFactory.setSerializer(HessianSerializer.class);
        xxlRpcProviderFactory.setCorePoolSize(20);
        xxlRpcProviderFactory.setMaxPoolSize(200);
        xxlRpcProviderFactory.setIp(ip);
        xxlRpcProviderFactory.setPort(port);
        xxlRpcProviderFactory.setAccessToken(accessToken);
        xxlRpcProviderFactory.setServiceRegistry(ExecutorServiceRegistry.class);
        xxlRpcProviderFactory.setServiceRegistryParam(serviceRegistryParam);

        // add services
        xxlRpcProviderFactory.addService(ExecutorBiz.class.getName(), null, new ExecutorBizImpl());

        // start
        xxlRpcProviderFactory.start();

    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method private initRpcProvider(ip String, port int, appName String, accessToken String) : void from class com.wugui.datatx.core.executor.JobExecutor


    public XxlRegistryClient(String adminAddress, String accessToken, String biz, String env) {
        registryBaseClient = new XxlRegistryBaseClient(adminAddress, accessToken, biz, env);
        logger.info(">>>>>>>>>>> xxl-registry, XxlRegistryClient init .... [adminAddress={}, accessToken={}, biz={}, env={}]", adminAddress, accessToken, biz, env);

        // registry thread
        registryThread = new Thread(() -> {
            while (!registryThreadStop) {
                try {
                    if (registryData.size() > 0) {

                        boolean ret = registryBaseClient.registry(new ArrayList<>(registryData));
                        logger.debug(">>>>>>>>>>> xxl-registry, refresh registry data {}, registryData = {}", ret ? "success" : "fail", registryData);
                    }
                } catch (Exception e) {
                    if (!registryThreadStop) {
                        logger.error(">>>>>>>>>>> xxl-registry, registryThread error.", e);
                    }
                }
                try {
                    TimeUnit.SECONDS.sleep(10);
                } catch (Exception e) {
                    if (!registryThreadStop) {
                        logger.error(">>>>>>>>>>> xxl-registry, registryThread error.", e);
                    }
                }
            }
            logger.info(">>>>>>>>>>> xxl-registry, registryThread stoped.");
        });
        registryThread.setName("xxl-registry, XxlRegistryClient registryThread.");
        registryThread.setDaemon(true);
        registryThread.start();

        // discovery thread
        discoveryThread = new Thread(() -> {
            while (!registryThreadStop) {

                if (discoveryData.size() == 0) {
                    try {
                        TimeUnit.SECONDS.sleep(3);
                    } catch (Exception e) {
                        if (!registryThreadStop) {
                            logger.error(">>>>>>>>>>> xxl-registry, discoveryThread error.", e);
                        }
                    }
                } else {
                    try {
                        // monitor
                        boolean monitorRet = registryBaseClient.monitor(discoveryData.keySet());

                        // avoid fail-retry request too quick
                        if (!monitorRet) {
                            TimeUnit.SECONDS.sleep(10);
                        }

                        // refreshDiscoveryData, all
                        refreshDiscoveryData(discoveryData.keySet());
                    } catch (Exception e) {
                        if (!registryThreadStop) {
                            logger.error(">>>>>>>>>>> xxl-registry, discoveryThread error.", e);
                        }
                    }
                }

            }
            logger.info(">>>>>>>>>>> xxl-registry, discoveryThread stoped.");
        });
        discoveryThread.setName("xxl-registry, XxlRegistryClient discoveryThread.");
        discoveryThread.setDaemon(true);
        discoveryThread.start();

        logger.info(">>>>>>>>>>> xxl-registry, XxlRegistryClient init success.");
    }

    public XxlRegistryClient(String adminAddress, String accessToken, String biz, String env) {
        registryBaseClient = new XxlRegistryBaseClient(adminAddress, accessToken, biz, env);
        logger.info(">>>>>>>>>>> xxl-registry, XxlRegistryClient init .... [adminAddress={}, accessToken={}, biz={}, env={}]", adminAddress, accessToken, biz, env);

        // registry thread
        registryThread = new Thread(new Runnable() {
            @Override
            public void run() {
                while (!registryThreadStop) {
                    try {
                        if (registryData.size() > 0) {

                            boolean ret = registryBaseClient.registry(new ArrayList<XxlRegistryDataParamVO>(registryData));
                            logger.debug(">>>>>>>>>>> xxl-registry, refresh registry data {}, registryData = {}", ret?"success":"fail",registryData);
                        }
                    } catch (Exception e) {
                        if (!registryThreadStop) {
                            logger.error(">>>>>>>>>>> xxl-registry, registryThread error.", e);
                        }
                    }
                    try {
                        TimeUnit.SECONDS.sleep(10);
                    } catch (Exception e) {
                        if (!registryThreadStop) {
                            logger.error(">>>>>>>>>>> xxl-registry, registryThread error.", e);
                        }
                    }
                }
                logger.info(">>>>>>>>>>> xxl-registry, registryThread stoped.");
            }
        });
        registryThread.setName("xxl-registry, XxlRegistryClient registryThread.");
        registryThread.setDaemon(true);
        registryThread.start();

        // discovery thread
        discoveryThread = new Thread(new Runnable() {
            @Override
            public void run() {
                while (!registryThreadStop) {

                    if (discoveryData.size() == 0) {
                        try {
                            TimeUnit.SECONDS.sleep(3);
                        } catch (Exception e) {
                            if (!registryThreadStop) {
                                logger.error(">>>>>>>>>>> xxl-registry, discoveryThread error.", e);
                            }
                        }
                    } else {
                        try {
                            // monitor
                            boolean monitorRet = registryBaseClient.monitor(discoveryData.keySet());

                            // avoid fail-retry request too quick
                            if (!monitorRet){
                                TimeUnit.SECONDS.sleep(10);
                            }

                            // refreshDiscoveryData, all
                            refreshDiscoveryData(discoveryData.keySet());
                        } catch (Exception e) {
                            if (!registryThreadStop) {
                                logger.error(">>>>>>>>>>> xxl-registry, discoveryThread error.", e);
                            }
                        }
                    }

                }
                logger.info(">>>>>>>>>>> xxl-registry, discoveryThread stoped.");
            }
        });
        discoveryThread.setName("xxl-registry, XxlRegistryClient discoveryThread.");
        discoveryThread.setDaemon(true);
        discoveryThread.start();

        logger.info(">>>>>>>>>>> xxl-registry, XxlRegistryClient init success.");
    }

Replace Anonymous With Lambda com.wugui.datax.registry.XxlRegistryClient.XxlRegistryClient.new Thread.new Runnable with () -> {while(!registryThreadStop){tryif(registryData.size() > 0){boolean ret=registryBaseClient.registry(new ArrayList<>(registryData)); in method public XxlRegistryClient(adminAddress String, accessToken String, biz String, env String) from class com.wugui.datax.registry.XxlRegistryClient


    /**
     * @param param ignore, not use
     */
    @Override
    public void start(Map<String, String> param) {
        registryData = new HashMap<>();
    }

    /**
     * @param param ignore, not use
     */
    @Override
    public void start(Map<String, String> param) {
        registryData = new HashMap<String, TreeSet<String>>();
    }

Replace Generic With Diamond HashMap<String,TreeSet<String>> with HashMap<> in method public start(param Map<String,String>) : void from class com.wugui.datax.rpc.registry.impl.LocalServiceRegistry


    public void notifyInvokerFuture(String requestId, final XxlRpcResponse xxlRpcResponse) {

        // get
        final XxlRpcFutureResponse futureResponse = futureResponsePool.get(requestId);
        if (futureResponse == null) {
            return;
        }

        // notify
        if (futureResponse.getInvokeCallback() != null) {

            // callback type
            try {
                executeResponseCallback(() -> {
                    if (xxlRpcResponse.getErrorMsg() != null) {
                        futureResponse.getInvokeCallback().onFailure(new XxlRpcException(xxlRpcResponse.getErrorMsg()));
                    } else {
                        futureResponse.getInvokeCallback().onSuccess(xxlRpcResponse.getResult());
                    }
                });
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        } else {

            // other nomal type
            futureResponse.setResponse(xxlRpcResponse);
        }

        // do remove
        futureResponsePool.remove(requestId);

    }

    public void notifyInvokerFuture(String requestId, final XxlRpcResponse xxlRpcResponse){

        // get
        final XxlRpcFutureResponse futureResponse = futureResponsePool.get(requestId);
        if (futureResponse == null) {
            return;
        }

        // notify
        if (futureResponse.getInvokeCallback()!=null) {

            // callback type
            try {
                executeResponseCallback(new Runnable() {
                    @Override
                    public void run() {
                        if (xxlRpcResponse.getErrorMsg() != null) {
                            futureResponse.getInvokeCallback().onFailure(new XxlRpcException(xxlRpcResponse.getErrorMsg()));
                        } else {
                            futureResponse.getInvokeCallback().onSuccess(xxlRpcResponse.getResult());
                        }
                    }
                });
            }catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        } else {

            // other nomal type
            futureResponse.setResponse(xxlRpcResponse);
        }

        // do remove
        futureResponsePool.remove(requestId);

    }

Replace Anonymous With Lambda com.wugui.datax.rpc.remoting.invoker.XxlRpcInvokerFactory.notifyInvokerFuture.executeResponseCallback.new Runnable with () -> {if(xxlRpcResponse.getErrorMsg() != null){futureResponse.getInvokeCallback().onFailure(new XxlRpcException(xxlRpcResponse.getErrorMsg())); in method public notifyInvokerFuture(requestId String, xxlRpcResponse XxlRpcResponse) : void from class com.wugui.datax.rpc.remoting.invoker.XxlRpcInvokerFactory


    public void executeResponseCallback(Runnable runnable) {

        if (responseCallbackThreadPool == null) {
            synchronized (this) {
                if (responseCallbackThreadPool == null) {
                    responseCallbackThreadPool = new ThreadPoolExecutor(
                            10,
                            100,
                            60L,
                            TimeUnit.SECONDS,
                            new LinkedBlockingQueue<>(1000),
                            r -> new Thread(r, "xxl-rpc, XxlRpcInvokerFactory-responseCallbackThreadPool-" + r.hashCode()),
                            (r, executor) -> {
                                throw new XxlRpcException("xxl-rpc Invoke Callback Thread pool is EXHAUSTED!");
                            });        // default maxThreads 300, minThreads 60
                }
            }
        }
        responseCallbackThreadPool.execute(runnable);
    }

    public void executeResponseCallback(Runnable runnable){

        if (responseCallbackThreadPool == null) {
            synchronized (this) {
                if (responseCallbackThreadPool == null) {
                    responseCallbackThreadPool = new ThreadPoolExecutor(
                            10,
                            100,
                            60L,
                            TimeUnit.SECONDS,
                            new LinkedBlockingQueue<Runnable>(1000),
                            new ThreadFactory() {
                                @Override
                                public Thread newThread(Runnable r) {
                                    return new Thread(r, "xxl-rpc, XxlRpcInvokerFactory-responseCallbackThreadPool-" + r.hashCode());
                                }
                            },
                            new RejectedExecutionHandler() {
                                @Override
                                public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
                                    throw new XxlRpcException("xxl-rpc Invoke Callback Thread pool is EXHAUSTED!");
                                }
                            });		// default maxThreads 300, minThreads 60
                }
            }
        }
        responseCallbackThreadPool.execute(runnable);
    }

Replace Generic With Diamond ThreadPoolExecutor with ThreadPoolExecutor in method public executeResponseCallback(runnable Runnable) : void from class com.wugui.datax.rpc.remoting.invoker.XxlRpcInvokerFactory


    @Override
    public boolean postProcessAfterInstantiation(final Object bean, final String beanName) throws BeansException {

        // collection
        final Set<String> serviceKeyList = new HashSet<>();

        // parse XxlRpcReferenceBean
        ReflectionUtils.doWithFields(bean.getClass(), field -> {
            if (field.isAnnotationPresent(XxlRpcReference.class)) {
                // valid
                Class iface = field.getType();
                if (!iface.isInterface()) {
                    throw new XxlRpcException("xxl-rpc, reference(XxlRpcReference) must be interface.");
                }

                XxlRpcReference rpcReference = field.getAnnotation(XxlRpcReference.class);

                // init reference bean
                XxlRpcReferenceBean referenceBean = new XxlRpcReferenceBean();
                referenceBean.setClient(rpcReference.client());
                referenceBean.setSerializer(rpcReference.serializer());
                referenceBean.setCallType(rpcReference.callType());
                referenceBean.setLoadBalance(rpcReference.loadBalance());
                referenceBean.setIface(iface);
                referenceBean.setVersion(rpcReference.version());
                referenceBean.setTimeout(rpcReference.timeout());
                referenceBean.setAddress(rpcReference.address());
                referenceBean.setAccessToken(rpcReference.accessToken());
                referenceBean.setInvokeCallback(null);
                referenceBean.setInvokerFactory(xxlRpcInvokerFactory);

                // get proxyObj
                Object serviceProxy;
                try {
                    serviceProxy = referenceBean.getObject();
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }

                // set bean
                field.setAccessible(true);
                field.set(bean, serviceProxy);

                logger.info(">>>>>>>>>>> xxl-rpc, invoker factory init reference bean success. serviceKey = {}, bean.field = {}.{}",
                        XxlRpcProviderFactory.makeServiceKey(iface.getName(), rpcReference.version()), beanName, field.getName());

                // collection
                String serviceKey = XxlRpcProviderFactory.makeServiceKey(iface.getName(), rpcReference.version());
                serviceKeyList.add(serviceKey);

            }
        });

        // mult discovery
        if (xxlRpcInvokerFactory.getServiceRegistry() != null) {
            try {
                xxlRpcInvokerFactory.getServiceRegistry().discovery(serviceKeyList);
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        }

        return super.postProcessAfterInstantiation(bean, beanName);
    }

    @Override
    public boolean postProcessAfterInstantiation(final Object bean, final String beanName) throws BeansException {

        // collection
        final Set<String> serviceKeyList = new HashSet<>();

        // parse XxlRpcReferenceBean
        ReflectionUtils.doWithFields(bean.getClass(), new ReflectionUtils.FieldCallback() {
            @Override
            public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
                if (field.isAnnotationPresent(XxlRpcReference.class)) {
                    // valid
                    Class iface = field.getType();
                    if (!iface.isInterface()) {
                        throw new XxlRpcException("xxl-rpc, reference(XxlRpcReference) must be interface.");
                    }

                    XxlRpcReference rpcReference = field.getAnnotation(XxlRpcReference.class);

                    // init reference bean
                    XxlRpcReferenceBean referenceBean = new XxlRpcReferenceBean();
                    referenceBean.setClient(rpcReference.client());
                    referenceBean.setSerializer(rpcReference.serializer());
                    referenceBean.setCallType(rpcReference.callType());
                    referenceBean.setLoadBalance(rpcReference.loadBalance());
                    referenceBean.setIface(iface);
                    referenceBean.setVersion(rpcReference.version());
                    referenceBean.setTimeout(rpcReference.timeout());
                    referenceBean.setAddress(rpcReference.address());
                    referenceBean.setAccessToken(rpcReference.accessToken());
                    referenceBean.setInvokeCallback(null);
                    referenceBean.setInvokerFactory(xxlRpcInvokerFactory);

                    // get proxyObj
                    Object serviceProxy = null;
                    try {
                        serviceProxy = referenceBean.getObject();
                    } catch (Exception e) {
                        throw new RuntimeException(e);
                    }

                    // set bean
                    field.setAccessible(true);
                    field.set(bean, serviceProxy);

                    logger.info(">>>>>>>>>>> xxl-rpc, invoker factory init reference bean success. serviceKey = {}, bean.field = {}.{}",
                            XxlRpcProviderFactory.makeServiceKey(iface.getName(), rpcReference.version()), beanName, field.getName());

                    // collection
                    String serviceKey = XxlRpcProviderFactory.makeServiceKey(iface.getName(), rpcReference.version());
                    serviceKeyList.add(serviceKey);

                }
            }
        });

        // mult discovery
        if (xxlRpcInvokerFactory.getServiceRegistry() != null) {
            try {
                xxlRpcInvokerFactory.getServiceRegistry().discovery(serviceKeyList);
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        }

        return super.postProcessAfterInstantiation(bean, beanName);
    }

Replace Anonymous With Lambda com.wugui.datax.rpc.remoting.invoker.impl.XxlRpcSpringInvokerFactory.postProcessAfterInstantiation.doWithFields.new ReflectionUtils.FieldCallback with field -> {if(field.isAnnotationPresent(XxlRpcReference.class)){Class iface=field.getType(); in method public postProcessAfterInstantiation(bean Object, beanName String) : boolean from class com.wugui.datax.rpc.remoting.invoker.impl.XxlRpcSpringInvokerFactory