<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>DavidChen&#39;s blog</title>
  
  <subtitle>Technical blogging</subtitle>
  <link href="https://davidchenblog.com/atom.xml" rel="self"/>
  
  <link href="https://davidchenblog.com/"/>
  <updated>2026-11-26T17:30:00.000Z</updated>
  <id>https://davidchenblog.com/</id>
  
  <author>
    <name>David Chen</name>
    
  </author>
  
  <generator uri="https://hexo.io/">Hexo</generator>
  
  <entry>
    <title>裝飾模式與代理模式：動態增加功能 vs 控制存取，以及四種常見的代理</title>
    <link href="https://davidchenblog.com/posts/a52392a6/"/>
    <id>https://davidchenblog.com/posts/a52392a6/</id>
    <published>2024-07-22T23:53:10.000Z</published>
    <updated>2026-11-26T17:30:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;這篇是《大話設計模式》裝飾模式與代理模式的讀書筆記。兩者的結構很像，都是一個物件包住另一個物件，但目的不同：&lt;strong&gt;裝飾模式&lt;/strong&gt;是動態地替物件增加功能，&lt;strong&gt;代理模式&lt;/strong&gt;是控制對物件的存取。最後整理遠端代理、虛擬代理、安全代理、智慧代理四種常見的代理。&lt;/p&gt;</summary>
    
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/categories/ObjectOrientedProgramming/"/>
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/tags/ObjectOrientedProgramming/"/>
    
    <category term="DesignPattern" scheme="https://davidchenblog.com/tags/DesignPattern/"/>
    
    <category term="Decorator" scheme="https://davidchenblog.com/tags/Decorator/"/>
    
    <category term="Proxy" scheme="https://davidchenblog.com/tags/Proxy/"/>
    
  </entry>
  
  <entry>
    <title>單例模式（Singleton）：private 建構子、多執行緒下的 lock、雙重鎖定與靜態初始化</title>
    <link href="https://davidchenblog.com/posts/d6738e4e/"/>
    <id>https://davidchenblog.com/posts/d6738e4e/</id>
    <published>2024-11-18T23:52:42.000Z</published>
    <updated>2026-11-26T17:30:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;這篇是《大話設計模式》單例模式的讀書筆記：如何用 private 建構子讓類別自己負責「只有一個實體」、單例和靜態類別的差別、多執行緒同時呼叫時可能建立出多個實體的問題，以及三種執行緒安全的寫法：lock、雙重鎖定（Double-Check Locking）和靜態初始化。&lt;/p&gt;</summary>
    
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/categories/ObjectOrientedProgramming/"/>
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/tags/ObjectOrientedProgramming/"/>
    
    <category term="DesignPattern" scheme="https://davidchenblog.com/tags/DesignPattern/"/>
    
    <category term="Singleton" scheme="https://davidchenblog.com/tags/Singleton/"/>
    
  </entry>
  
  <entry>
    <title>簡單工廠模式與策略模式：用計算機與商場收銀範例理解，以及兩者如何結合</title>
    <link href="https://davidchenblog.com/posts/ebc3c7ac/"/>
    <id>https://davidchenblog.com/posts/ebc3c7ac/</id>
    <published>2024-04-12T22:33:44.000Z</published>
    <updated>2026-11-26T17:30:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;這篇是《大話設計模式》前兩章的讀書筆記：先用「加減乘除計算機」說明如何用繼承把各種運算拆開、再用&lt;strong&gt;簡單工廠模式&lt;/strong&gt;決定要建立哪一種運算；接著用「商場收銀（正常收費、打折、滿額送）」說明&lt;strong&gt;策略模式&lt;/strong&gt;，最後把策略模式和簡單工廠結合，讓用戶端只需要認識一個類別。&lt;/p&gt;</summary>
    
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/categories/ObjectOrientedProgramming/"/>
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/tags/ObjectOrientedProgramming/"/>
    
    <category term="DesignPattern" scheme="https://davidchenblog.com/tags/DesignPattern/"/>
    
    <category term="SimpleFactory" scheme="https://davidchenblog.com/tags/SimpleFactory/"/>
    
    <category term="Strategy" scheme="https://davidchenblog.com/tags/Strategy/"/>
    
  </entry>
  
  <entry>
    <title>備忘錄模式（Memento）：在不破壞封裝的前提下保存與還原物件狀態，以遊戲存檔為例</title>
    <link href="https://davidchenblog.com/posts/cdbdc277/"/>
    <id>https://davidchenblog.com/posts/cdbdc277/</id>
    <published>2024-10-22T22:21:46.000Z</published>
    <updated>2026-11-26T17:30:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;這篇是《大話設計模式》備忘錄模式的讀書筆記：用「遊戲角色打 Boss 前先存檔」的例子，說明如何把物件的內部狀態保存到另一個物件、之後再還原，而不讓外部直接存取角色的內部欄位。也整理了三個角色的分工、適用情境與缺點。&lt;/p&gt;</summary>
    
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/categories/ObjectOrientedProgramming/"/>
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/tags/ObjectOrientedProgramming/"/>
    
    <category term="DesignPattern" scheme="https://davidchenblog.com/tags/DesignPattern/"/>
    
    <category term="Memento" scheme="https://davidchenblog.com/tags/Memento/"/>
    
  </entry>
  
  <entry>
    <title>物件導向設計原則：單一職責、開放封閉、依賴倒轉、里氏替換與迪米特法則</title>
    <link href="https://davidchenblog.com/posts/c995348/"/>
    <id>https://davidchenblog.com/posts/c995348/</id>
    <published>2024-05-19T23:34:46.000Z</published>
    <updated>2026-11-26T17:30:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;這篇是《大話設計模式》設計原則部分的讀書筆記：物件導向為什麼能讓程式好維護、單一職責原則、開放封閉原則、依賴倒轉原則、里氏替換原則和迪米特法則（最少知識原則）。這些原則是後面所有設計模式的基礎。&lt;/p&gt;</summary>
    
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/categories/ObjectOrientedProgramming/"/>
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/tags/ObjectOrientedProgramming/"/>
    
    <category term="DesignPattern" scheme="https://davidchenblog.com/tags/DesignPattern/"/>
    
    <category term="SOLID" scheme="https://davidchenblog.com/tags/SOLID/"/>
    
  </entry>
  
  <entry>
    <title>工廠方法模式與抽象工廠模式：切換資料庫的範例、優缺點，以及用反射和設定檔去除 switch</title>
    <link href="https://davidchenblog.com/posts/171763bc/"/>
    <id>https://davidchenblog.com/posts/171763bc/</id>
    <published>2024-09-10T23:06:23.000Z</published>
    <updated>2026-11-26T17:30:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;這篇是《大話設計模式》工廠方法模式與抽象工廠模式的讀書筆記：工廠方法如何把「建立哪個產品」交給子類別、抽象工廠如何一次建立一整個系列的產品（以同時支援 SQL Server 和 Access 的資料存取為例）、抽象工廠的優缺點，以及用反射加設定檔取代工廠裡的 &lt;code&gt;switch&lt;/code&gt;。&lt;/p&gt;</summary>
    
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/categories/ObjectOrientedProgramming/"/>
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/tags/ObjectOrientedProgramming/"/>
    
    <category term="DesignPattern" scheme="https://davidchenblog.com/tags/DesignPattern/"/>
    
    <category term="FactoryMethod" scheme="https://davidchenblog.com/tags/FactoryMethod/"/>
    
    <category term="AbstractFactory" scheme="https://davidchenblog.com/tags/AbstractFactory/"/>
    
  </entry>
  
  <entry>
    <title>外觀模式（Facade）：替複雜的子系統提供一個簡單的介面，以及三個適用時機</title>
    <link href="https://davidchenblog.com/posts/21259fa8/"/>
    <id>https://davidchenblog.com/posts/21259fa8/</id>
    <published>2024-08-15T23:03:28.000Z</published>
    <updated>2026-11-26T17:30:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;這篇是《大話設計模式》外觀模式的讀書筆記：用一個 Facade 類別替好幾個子系統提供統一、簡單的介面，降低用戶端和子系統之間的耦合，並整理在設計初期、開發中、維護舊系統三個階段該如何運用外觀模式。&lt;/p&gt;</summary>
    
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/categories/ObjectOrientedProgramming/"/>
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/tags/ObjectOrientedProgramming/"/>
    
    <category term="DesignPattern" scheme="https://davidchenblog.com/tags/DesignPattern/"/>
    
    <category term="Facade" scheme="https://davidchenblog.com/tags/Facade/"/>
    
  </entry>
  
  <entry>
    <title>建造者模式（Builder）：把複雜物件的建構過程和表示分離，Builder 與 Director 的角色</title>
    <link href="https://davidchenblog.com/posts/916b7cf7/"/>
    <id>https://davidchenblog.com/posts/916b7cf7/</id>
    <published>2024-08-23T23:22:14.000Z</published>
    <updated>2026-11-26T17:30:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;這篇是《大話設計模式》建造者模式的讀書筆記：用「畫小人」的例子說明為什麼要把建造步驟固定下來（避免漏畫一隻手）、Builder 和 Director 各自負責什麼，以及建造者模式的基本結構。最後補充現代程式常見的「流暢介面」Builder 寫法。&lt;/p&gt;</summary>
    
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/categories/ObjectOrientedProgramming/"/>
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/tags/ObjectOrientedProgramming/"/>
    
    <category term="DesignPattern" scheme="https://davidchenblog.com/tags/DesignPattern/"/>
    
    <category term="Builder" scheme="https://davidchenblog.com/tags/Builder/"/>
    
  </entry>
  
  <entry>
    <title>橋接模式（Bridge）與合成聚合複用原則：用組合取代繼承，讓多個維度各自獨立變化</title>
    <link href="https://davidchenblog.com/posts/a28e7eef/"/>
    <id>https://davidchenblog.com/posts/a28e7eef/</id>
    <published>2024-12-06T23:43:19.000Z</published>
    <updated>2026-11-26T17:30:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;這篇是《大話設計模式》橋接模式的讀書筆記：先說明過度使用繼承會帶來的問題，再介紹「合成 &amp;#x2F; 聚合複用原則」（優先使用組合而不是繼承），接著用「手機品牌 × 手機軟體」的例子說明橋接模式如何讓兩個維度各自獨立變化，最後是橋接模式的基本結構。&lt;/p&gt;</summary>
    
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/categories/ObjectOrientedProgramming/"/>
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/tags/ObjectOrientedProgramming/"/>
    
    <category term="DesignPattern" scheme="https://davidchenblog.com/tags/DesignPattern/"/>
    
    <category term="Bridge" scheme="https://davidchenblog.com/tags/Bridge/"/>
    
  </entry>
  
  <entry>
    <title>範本方法模式（Template Method）：把不變的流程放在父類別，可變的步驟交給子類別</title>
    <link href="https://davidchenblog.com/posts/15f1a5c9/"/>
    <id>https://davidchenblog.com/posts/15f1a5c9/</id>
    <published>2024-08-06T12:18:06.000Z</published>
    <updated>2026-11-26T17:30:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;這篇是《大話設計模式》範本方法模式的讀書筆記：用「考卷」的例子說明如何把相同的題目搬到父類別、每個學生只寫自己的答案，再整理範本方法模式的基本結構和它解決的問題：去除子類別之間重複的不變行為。&lt;/p&gt;</summary>
    
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/categories/ObjectOrientedProgramming/"/>
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/tags/ObjectOrientedProgramming/"/>
    
    <category term="DesignPattern" scheme="https://davidchenblog.com/tags/DesignPattern/"/>
    
    <category term="TemplateMethod" scheme="https://davidchenblog.com/tags/TemplateMethod/"/>
    
  </entry>
  
  <entry>
    <title>原型模式（Prototype）：用 Clone 複製物件，以及淺複製與深複製的差別</title>
    <link href="https://davidchenblog.com/posts/be91522b/"/>
    <id>https://davidchenblog.com/posts/be91522b/</id>
    <published>2024-07-29T00:13:26.000Z</published>
    <updated>2026-11-26T17:30:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;這篇是《大話設計模式》原型模式的讀書筆記：為什麼用複製（Clone）建立物件比一直 &lt;code&gt;new&lt;/code&gt; 更好、C# 的 &lt;code&gt;MemberwiseClone&lt;/code&gt; 是淺複製，以及物件裡有參考型別的欄位時，如何實作深複製。&lt;/p&gt;</summary>
    
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/categories/ObjectOrientedProgramming/"/>
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/tags/ObjectOrientedProgramming/"/>
    
    <category term="DesignPattern" scheme="https://davidchenblog.com/tags/DesignPattern/"/>
    
    <category term="Prototype" scheme="https://davidchenblog.com/tags/Prototype/"/>
    
  </entry>
  
  <entry>
    <title>組合模式（Composite）：用樹狀結構表示部分與整體，透明方式與安全方式的取捨</title>
    <link href="https://davidchenblog.com/posts/8df1bc94/"/>
    <id>https://davidchenblog.com/posts/8df1bc94/</id>
    <published>2024-10-24T22:24:48.000Z</published>
    <updated>2026-11-26T17:30:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;這篇是《大話設計模式》組合模式的讀書筆記：用樹狀結構表示「部分與整體」的階層，讓用戶端可以用同樣的方式處理單一物件（葉節點）和組合物件（樹枝）。包含基本結構、透明方式和安全方式的差別、使用時機與好處。&lt;/p&gt;</summary>
    
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/categories/ObjectOrientedProgramming/"/>
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/tags/ObjectOrientedProgramming/"/>
    
    <category term="DesignPattern" scheme="https://davidchenblog.com/tags/DesignPattern/"/>
    
    <category term="Composite" scheme="https://davidchenblog.com/tags/Composite/"/>
    
  </entry>
  
  <entry>
    <title>轉接器模式（Adapter）：介面不相容時的轉接，以籃球翻譯和 .NET DataAdapter 為例</title>
    <link href="https://davidchenblog.com/posts/712ff256/"/>
    <id>https://davidchenblog.com/posts/712ff256/</id>
    <published>2024-10-05T23:08:06.000Z</published>
    <updated>2026-11-26T17:30:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;這篇是《大話設計模式》轉接器模式的讀書筆記：系統的資料和行為都正確、只是介面對不上時，如何用轉接器把一個既有類別的介面轉換成用戶端期望的介面。包含物件轉接器的基本結構、外籍球員需要翻譯的範例，以及 .NET 的 &lt;code&gt;DataAdapter&lt;/code&gt;。&lt;/p&gt;</summary>
    
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/categories/ObjectOrientedProgramming/"/>
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/tags/ObjectOrientedProgramming/"/>
    
    <category term="DesignPattern" scheme="https://davidchenblog.com/tags/DesignPattern/"/>
    
    <category term="Adapter" scheme="https://davidchenblog.com/tags/Adapter/"/>
    
  </entry>
  
  <entry>
    <title>狀態模式（State）：用類別取代一長串的狀態判斷，以「工作狀態」範例說明與優缺點</title>
    <link href="https://davidchenblog.com/posts/c23865e3/"/>
    <id>https://davidchenblog.com/posts/c23865e3/</id>
    <published>2024-09-27T23:13:42.000Z</published>
    <updated>2026-11-26T17:30:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;這篇是《大話設計模式》狀態模式的讀書筆記：從「方法過長是壞味道」開始，說明當一個物件的行為取決於它的狀態、而狀態判斷的 &lt;code&gt;if / else&lt;/code&gt; 越寫越長時，如何把每個狀態拆成一個類別；接著是狀態模式的基本結構、「一天的工作狀態」範例，以及優缺點和使用時機。&lt;/p&gt;</summary>
    
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/categories/ObjectOrientedProgramming/"/>
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/tags/ObjectOrientedProgramming/"/>
    
    <category term="DesignPattern" scheme="https://davidchenblog.com/tags/DesignPattern/"/>
    
    <category term="State" scheme="https://davidchenblog.com/tags/State/"/>
    
  </entry>
  
  <entry>
    <title>觀察者模式（Observer）：發佈 / 訂閱的基本結構、特點與不足，以及用 C# 事件委託改寫</title>
    <link href="https://davidchenblog.com/posts/aeda381b/"/>
    <id>https://davidchenblog.com/posts/aeda381b/</id>
    <published>2024-08-26T01:17:22.000Z</published>
    <updated>2026-11-26T17:30:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;這篇是《大話設計模式》觀察者模式的讀書筆記：觀察者模式（又叫發佈 &amp;#x2F; 訂閱模式）的基本結構、它如何解除通知者和觀察者之間的耦合、觀察者模式的不足（觀察者還是得實作同一個介面），以及如何用 C# 的事件委託（delegate &amp;#x2F; event）解決這個問題。&lt;/p&gt;</summary>
    
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/categories/ObjectOrientedProgramming/"/>
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/tags/ObjectOrientedProgramming/"/>
    
    <category term="DesignPattern" scheme="https://davidchenblog.com/tags/DesignPattern/"/>
    
    <category term="Observer" scheme="https://davidchenblog.com/tags/Observer/"/>
    
    <category term="Delegate" scheme="https://davidchenblog.com/tags/Delegate/"/>
    
  </entry>
  
  <entry>
    <title>迭代器模式（Iterator）：不暴露內部結構就能走訪集合，以及 .NET 的 IEnumerator 與 foreach</title>
    <link href="https://davidchenblog.com/posts/dc0af3f9/"/>
    <id>https://davidchenblog.com/posts/dc0af3f9/</id>
    <published>2024-11-06T22:19:20.000Z</published>
    <updated>2026-11-26T17:30:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;這篇是《大話設計模式》迭代器模式的讀書筆記：迭代器模式的定義與使用時機、.NET 用 &lt;code&gt;IEnumerator&lt;/code&gt; 和 &lt;code&gt;IEnumerable&lt;/code&gt; 兩個介面實現迭代器，以及 &lt;code&gt;foreach&lt;/code&gt; 在背後其實就是在使用迭代器。&lt;/p&gt;</summary>
    
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/categories/ObjectOrientedProgramming/"/>
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/tags/ObjectOrientedProgramming/"/>
    
    <category term="DesignPattern" scheme="https://davidchenblog.com/tags/DesignPattern/"/>
    
    <category term="Iterator" scheme="https://davidchenblog.com/tags/Iterator/"/>
    
  </entry>
  
  <entry>
    <title>命令模式（Command）：從緊耦合到鬆耦合，用「點烤肉串」範例說明請求的封裝、排隊、取消與記錄</title>
    <link href="https://davidchenblog.com/posts/52dfc6d1/"/>
    <id>https://davidchenblog.com/posts/52dfc6d1/</id>
    <published>2024-12-26T22:53:23.000Z</published>
    <updated>2026-11-26T17:30:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;這篇是《大話設計模式》命令模式的讀書筆記：用路邊攤點烤肉串的例子，從「顧客直接對老闆喊」的緊耦合寫法開始，一步步改成透過服務生和命令物件下單的鬆耦合設計，最後再讓服務生能記錄訂單、取消訂單、婉拒賣完的品項。&lt;/p&gt;</summary>
    
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/categories/ObjectOrientedProgramming/"/>
    
    
    <category term="ObjectOrientedProgramming" scheme="https://davidchenblog.com/tags/ObjectOrientedProgramming/"/>
    
    <category term="DesignPattern" scheme="https://davidchenblog.com/tags/DesignPattern/"/>
    
    <category term="Command" scheme="https://davidchenblog.com/tags/Command/"/>
    
  </entry>
  
  <entry>
    <title>註冊 AWS 帳號步驟：建立帳號、付款與身分驗證、Support Plan，以及設定免費額度與帳單告警</title>
    <link href="https://davidchenblog.com/posts/4c3725cb/"/>
    <id>https://davidchenblog.com/posts/4c3725cb/</id>
    <published>2022-01-19T08:32:08.000Z</published>
    <updated>2026-11-26T17:00:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;這篇整理註冊 AWS 帳號的完整流程：填寫帳號資訊、加入付款方式、電話驗證身分、選擇 Support Plan，以及最重要的一步：&lt;strong&gt;設定免費額度告警和 CloudWatch 帳單告警&lt;/strong&gt;，避免不小心開了資源忘記關，月底收到大額帳單。&lt;/p&gt;</summary>
    
    
    
    <category term="AWS" scheme="https://davidchenblog.com/categories/AWS/"/>
    
    
    <category term="AWS" scheme="https://davidchenblog.com/tags/AWS/"/>
    
    <category term="CloudWatch" scheme="https://davidchenblog.com/tags/CloudWatch/"/>
    
    <category term="Billing" scheme="https://davidchenblog.com/tags/Billing/"/>
    
  </entry>
  
  <entry>
    <title>JDK 20 起 new URL() 被標為 deprecated：原因與改用 URI.toURL() 的寫法</title>
    <link href="https://davidchenblog.com/posts/fd629380/"/>
    <id>https://davidchenblog.com/posts/fd629380/</id>
    <published>2024-09-14T22:09:23.000Z</published>
    <updated>2026-11-26T17:00:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;升級到 JDK 20 以後，&lt;code&gt;new URL(&amp;quot;...&amp;quot;)&lt;/code&gt; 會出現 deprecation 警告。原因是 &lt;code&gt;java.net.URL&lt;/code&gt; 的建構子不會依照 RFC 2396 編碼或解碼網址，容易造成錯誤甚至安全問題。這篇說明為什麼被棄用，以及改用 &lt;code&gt;URI.create(...).toURL()&lt;/code&gt;、&lt;code&gt;Path.toUri().toURL()&lt;/code&gt; 的寫法。&lt;/p&gt;</summary>
    
    
    
    <category term="URL" scheme="https://davidchenblog.com/categories/URL/"/>
    
    
    <category term="Java" scheme="https://davidchenblog.com/tags/Java/"/>
    
    <category term="URL" scheme="https://davidchenblog.com/tags/URL/"/>
    
    <category term="JDK20" scheme="https://davidchenblog.com/tags/JDK20/"/>
    
  </entry>
  
  <entry>
    <title>Redisson 連線錯誤排查：WriteRedisConnectionException 與 RedisTimeoutException 的原因與調整方式</title>
    <link href="https://davidchenblog.com/posts/1ef3314c/"/>
    <id>https://davidchenblog.com/posts/1ef3314c/</id>
    <published>2022-07-26T09:37:24.000Z</published>
    <updated>2026-11-26T17:00:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;使用 Redisson 時遇到 &lt;code&gt;WriteRedisConnectionException: Unable to write command into connection! Increase connection pool size&lt;/code&gt; 或 &lt;code&gt;RedisTimeoutException&lt;/code&gt;，錯誤訊息叫你加大連線池，但真正的原因不一定是連線不夠。這篇整理這兩個錯誤常見的四個原因、Redisson 官方建議的調整順序，以及為什麼 Redis 的 slowlog 裡可能找不到那個慢指令。&lt;/p&gt;</summary>
    
    
    
    <category term="Redisson" scheme="https://davidchenblog.com/categories/Redisson/"/>
    
    
    <category term="Redisson" scheme="https://davidchenblog.com/tags/Redisson/"/>
    
    <category term="Exception" scheme="https://davidchenblog.com/tags/Exception/"/>
    
    <category term="Redis" scheme="https://davidchenblog.com/tags/Redis/"/>
    
  </entry>
  
</feed>
