-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #197 from jamebal/develop
perf: 文件监控使用性能更好的watchService
- Loading branch information
Showing
6 changed files
with
151 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/com/jmal/clouddisk/exception/BrokenPipeFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.jmal.clouddisk.exception; | ||
|
||
import jakarta.servlet.*; | ||
|
||
import java.io.IOException; | ||
|
||
public class BrokenPipeFilter implements Filter { | ||
|
||
@Override | ||
public void init(FilterConfig filterConfig) {} | ||
|
||
@Override | ||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) | ||
throws IOException, ServletException { | ||
try { | ||
chain.doFilter(request, response); | ||
} catch (IOException e) { | ||
if (e.getMessage().contains("Broken pipe")) { | ||
// 忽略 Broken pipe 错误 | ||
return; | ||
} | ||
throw e; | ||
} | ||
} | ||
|
||
@Override | ||
public void destroy() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.