原创 剖析fail-fast機制和ConcurrentModificationException

快速失敗,是java集合中的一種錯誤檢測機制。當多個線程對集合進行結構上的改變操作時,就有可能會產生fail-fast機制。例如存在兩個線程1和2,線程1通過Iterator在遍歷集合中元素時,線程2修改了集合的結構(添加或者刪除

原创 leetcode138~Copy List with Random Pointer

A linked list is given such that each node contains an additional random pointer which could point to any node in t

原创 leetcode25~Reverse Nodes in k-Group

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive i

原创 leetcode82~Remove Duplicates from Sorted List II

Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the or

原创 畢業一年跳槽記

前記 在網易呆了一年零三個月左右,由於 被收購 事件,不得已選擇了跳槽,拿到了拼多多、頭條、螞蟻等幾家offer。在說明具體的面試題之前,先說一下近期面試給我帶來的感受。 首先,這個期間的hc是真的少,不管是不是整體經濟形式在走下

原创 畢業一年~頭條面試

系列篇 畢業一年跳槽記 頭條主要考察的是算法的能力,其次是業務的闡述要清晰。 一面 自我介紹(時間不要太久,主要說一下自己所負責的工作,面試官如果有感興趣的問題,會繼續問的,切忌一個人從頭說到尾,流水賬似的) 可以描述一下用

原创 限流原理和代碼實現

文章目錄介紹分類原理和代碼實現併發數限流固定時間窗口限流滑動時間窗口限流漏桶令牌桶 介紹 面對高併發的三大利器:限流、降級和緩存。這裏就來談談限流。 爲什麼需要限流?當服務接口的QPS或者併發量超過了接口的承受能力時,可能會導致接

原创 磁盤那點事情

文章目錄硬盤的組成基本概念磁道和扇區關係硬盤如何存儲信息硬盤讀取相關參數磁盤工作原理局部性原理 + 磁盤預讀爲什麼越來越慢參考 ​ 本人只是在看到數據庫從磁盤讀取數據相關知識時,對磁盤(硬盤)讀取這塊比較感興趣,並進行了一定的知識

原创 G1的RSet解讀

文章目錄RSet介紹爲什麼需要記錄跨代的引用RSet帶來的問題G1的RSet設計RSet的更新參考 RSet介紹 在G1中,引入了RSet(Remember Set,記憶集)的概念,用來記錄不同代際之間的引用關係,目的是爲了加快垃

原创 leetcode61~Rotate List

Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given 1->2->3->4->5

原创 leetcode24~Swap Nodes in Pairs

Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should

原创 leetcode19~Remove Nth Node From End of List

Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list

原创 如何優雅的中斷線程

文章目錄廢棄的做法-stop/suspend/resume中斷線程的方法自定義標誌位Interrupt()方法案例Interrupt實現機制Interruptible b != nullInterruptible b == null如

原创 銀行文件傳輸的方法

文章目錄傳輸方法https還是sftp?SFTP安全性? 來了網易快一年了,第一次接觸與合作方的文件傳輸方面的需求,這裏稍微整理一下整個流程紀要,以免遺忘~ 如果有不恰當的地方,還請指教~ 傳輸方法 生成N個業務文件,並對每個文件的

原创 分佈式鎖-redLock And Redisson

文章目錄CAPredis分佈式鎖存在的問題RedLockRedLock是什麼?RedLock算法失敗時重試釋放鎖性能、 崩潰恢復和redis同步針對redlock的爭議Redisson使用案例源碼 CAP 在引出RedLock之前,先