-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a servlet which can cause thread leak
- Loading branch information
Showing
6 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/main/java/org/t246osslab/easybuggy/troubles/ThreadLeakServlet.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,36 @@ | ||
package org.t246osslab.easybuggy.troubles; | ||
|
||
import java.io.IOException; | ||
|
||
import javax.servlet.ServletException; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
import org.t246osslab.easybuggy.utils.HTTPResponseCreator; | ||
import org.t246osslab.easybuggy.utils.MessageUtils; | ||
|
||
@SuppressWarnings("serial") | ||
@WebServlet(urlPatterns = { "/threadleak" }) | ||
public class ThreadLeakServlet extends HttpServlet { | ||
|
||
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { | ||
SubThread sub = new SubThread(); | ||
sub.start(); | ||
StringBuilder bodyHtml = new StringBuilder(); | ||
bodyHtml.append(MessageUtils.getMsg("msg.thread.leak.occur", req.getLocale())); | ||
HTTPResponseCreator.createSimpleResponse(res, null, bodyHtml.toString()); | ||
} | ||
} | ||
|
||
class SubThread extends Thread { | ||
public void run() { | ||
while (true) { | ||
try { | ||
Thread.sleep(100000); | ||
} catch (InterruptedException e) { | ||
} | ||
} | ||
} | ||
} |
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
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
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