第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

Java高并發(fā)秒殺API之業(yè)務(wù)分析與DAO層

  • 靈活使用insert ignore奇淫巧技
    查看全部
  • 從這節(jié)課開始看,

    本節(jié)概括了一些框架特性

    Spring IOC整合Service

    查看全部
  • public?class?ResortByDel?{
    ????private?static?String?BIG_FILE_NAME?=?"D:\\test1.txt";
    ????private?static?Integer?BATCH_SIZE?=?100;
    ????private?static?String?LINE_SEPARATOR?=?",";
    ????private?static?String?SORT_FILE_NAME?=?"D:\\test2.txt";
    
    ????private?static?List<String>?separateFile()?{
    ????????List<String>?fileNameList?=?new?ArrayList<>();
    ????????try?(BufferedReader?reader?=?new?BufferedReader(new?FileReader(BIG_FILE_NAME)))?{
    ????????????int?index?=?0;
    ????????????List<String>?batchLineList?=?new?ArrayList<>(BATCH_SIZE);
    ????????????String?line;
    ????????????while?((line?=?reader.readLine())?!=?null?||?batchLineList.size()?>?0)?{
    ????????????????if?(line?!=?null)?batchLineList.add(line);
    
    ????????????????if?(batchLineList.size()?==?BATCH_SIZE?||?(line?==?null?&&?batchLineList.size()?>?0))?{
    ????????????????????//?內(nèi)容排序
    ????????????????????batchLineList.sort((a,?b)?->?a.compareTo(b));
    ????????????????????//?寫小文件
    ????????????????????String?fileName?=?BIG_FILE_NAME?+?".tmp."?+?index++;
    ????????????????????try?(FileWriter?tmpWriter?=?new?FileWriter(fileName))?{
    ????????????????????????for?(String?val?:?batchLineList)?{
    ????????????????????????????tmpWriter.write(val?+?"\r\n");
    ????????????????????????}
    ????????????????????}
    ????????????????????fileNameList.add(fileName);
    ????????????????????batchLineList.clear();
    ????????????????}
    ????????????}
    
    ????????}?catch?(IOException?e)?{
    ????????????e.printStackTrace();
    ????????}
    ????????return?fileNameList;
    ????}
    
    ????private?static?void?mergeFile(List<String>?fileNameList)?{
    ????????Map<BufferedReader,?String>?map?=?new?HashMap<>();
    ????????String?preStr?=?null;
    ????????try?(FileWriter?writer?=?new?FileWriter(SORT_FILE_NAME))?{
    ????????????for?(String?fileName?:?fileNameList)?{
    ????????????????BufferedReader?tmpReader?=?new?BufferedReader(new?FileReader(fileName));
    ????????????????map.put(tmpReader,?tmpReader.readLine());
    ????????????}
    ????????????while?(true)?{
    ????????????????boolean?canRead?=?false;
    ????????????????Map.Entry<BufferedReader,?String>?minEntry?=?null;
    ????????????????for?(Map.Entry<BufferedReader,?String>?entry?:?map.entrySet())?{
    ????????????????????String?value?=?entry.getValue();
    ????????????????????if?(value?==?null)?{
    ????????????????????????continue;
    ????????????????????}
    ????????????????????//?獲取當(dāng)前?reader?內(nèi)容最小?entry
    ????????????????????if?((minEntry?==?null)?||?(Integer.valueOf(value)?<?Integer.valueOf(minEntry.getValue())))?{
    ????????????????????????minEntry?=?entry;
    ????????????????????}
    ????????????????????canRead?=?true;
    ????????????????}
    ????????????????//?當(dāng)且僅當(dāng)所有?reader?內(nèi)容為空時(shí),跳出循環(huán)
    ????????????????if?(!canRead)?{
    ????????????????????break;
    ????????????????}
    ????????????????//去重
    ????????????????if?(preStr?!=?null?&&?preStr.equals(minEntry.getValue()))?{
    ????????????????????minEntry.setValue(minEntry.getKey().readLine());
    ????????????????????continue;
    ????????????????}
    ????????????????preStr?=?minEntry.getValue();
    ????????????????writer.write(minEntry.getValue()?+?"\r\n");
    ????????????????minEntry.setValue(minEntry.getKey().readLine());
    ????????????}
    ????????}?catch?(Exception?e)?{
    ????????????e.printStackTrace();
    ????????}?finally?{
    ????????????//?注意關(guān)閉分片文件輸入流
    ????????????for?(BufferedReader?reader?:?map.keySet())?{
    ????????????????try?{
    ????????????????????reader.close();
    ????????????????}?catch?(IOException?e)?{
    ????????????????????e.printStackTrace();
    ????????????????}
    ????????????}
    ????????}
    ????}
    
    ????public?static?void?main(String[]?args)?throws?IOException?{
    ????????List<String>?separateFiles?=?separateFile();
    ????????mergeFile(separateFiles);
    ????}
    }


    查看全部
  • mybatis做對象關(guān)系映射
    查看全部
  • 數(shù)據(jù)庫連接池配置

    查看全部
  • mybatis 連表查詢

    查看全部

舉報(bào)

0/150
提交
取消
課程須知
《Java高并發(fā)秒殺API》是系列課程,共四門課,分別為業(yè)務(wù)分析和DAO層,Service層,Web層和高并發(fā)優(yōu)化。本門課程是第一門課程,學(xué)習(xí)前需要了解如下知識: 1、精通JavaWeb基礎(chǔ) 2、熟悉SpringMVC、Spring和MyBatis框架
老師告訴你能學(xué)到什么?
1、掌握秒殺業(yè)務(wù) 2、能夠進(jìn)行SpringMVC+Spring+MyBatis的整合開發(fā) 3、能夠進(jìn)行秒殺業(yè)務(wù)DAO層的設(shè)計(jì)與實(shí)現(xiàn)

微信掃碼,參與3人拼團(tuán)

微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號

友情提示:

您好,此課程屬于遷移課程,您已購買該課程,無需重復(fù)購買,感謝您對慕課網(wǎng)的支持!