๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๋ฐ˜์‘ํ˜•

Thread Pool1

[JAVA] ๋น„๋™๊ธฐ ์ฒ˜๋ฆฌ ๋ฐฉ๋ฒ• - Thread JAVA์—์„œ ๋น„๋™๊ธฐ ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•ด ์Šค๋ ˆ๋“œ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. ๋‹ค๋ฅธ ์„œ๋ฒ„๋กœ ์š”์ฒญ์„ ๋ณด๋‚ผ ๋•Œ ๋น„๋™๊ธฐ ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด ์•„๋ž˜์™€ ๊ฐ™์ด ์ž‘์„ฑํ•˜๋ฉด ๋œ๋‹ค. public void request() { Thread thread = new Thread(new Runnable() { @Override public void run() { //์ฝ”๋“œ ์ž‘์„ฑ } }); thread.start(); } ํ•˜์ง€๋งŒ ๋ณ‘๋ ฌ์ž‘์—… ์ฒ˜๋ฆฌ๋Ÿ‰์ด ๋งŽ์•„์ง€๋ฉด ์„ฑ๋Šฅ์ด ์ €ํ•˜๋˜๋Š”๋ฐ, ์ด๋ฅผ ๋ง‰๊ธฐ ์œ„ํ•ด์„œ ์Šค๋ ˆ๋“œ ํ’€์„ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค. ์Šค๋ ˆ๋“œํ’€์€ ์Šค๋ ˆ๋“œ ๊ฐœ์ˆ˜๋ฅผ ๋ฏธ๋ฆฌ ์ •ํ•ด ๋†“๊ณ , ์ž‘์—… ํ์— ๋“ค์–ด์˜ค๋Š” ์š”์ฒญ์„ ๋ฏธ๋ฆฌ ์ƒ์„ฑํ•ด ๋†“์€ ์Šค๋ ˆ๋“œ๋“ค์—๊ฒŒ ํ• ๋‹นํ•˜๋Š” ๋ฐฉ์‹์ด๋‹ค. JDK 1.5๋ถ€ํ„ฐ๋Š” java.util.concurrent Package์— ExecutorService ์ธํ„ฐํŽ˜์ด์Šค์™€ Ex.. 2022. 4. 27.
728x90
๋ฐ˜์‘ํ˜•