Skip to content

Commit e6a8dd8

Browse files
authored
Merge pull request #2 from NHNAcademy4th-CIA/leejungbum
Leejungbum code review request
2 parents b6954b5 + 132848d commit e6a8dd8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1337
-0
lines changed

Diff for: 3481345949028747701

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta content="ie=edge" http-equiv=x-ua-compatible><title>NHN Cloud Member Login</title><link href=/dist/favicon.ico rel="shortcut icon"><meta content="width=device-width,initial-scale=1" name=viewport><link href=/dist/1697107588475/assets/css/chunk-common.3a8bc609b64e86fabf50.css rel=stylesheet><link href=/dist/1697107588475/assets/css/login.cc0a00afc59d6483c901.css rel=stylesheet></head><body><script type=text/javascript>window.jspVariables = {
2+
returnUrl: 'https%3A%2F%2Fiam.nhncloud.com%2Foauth%3Fclient_id%3Dn6ow0YfxCU0EBT1eAdzc%26domain%3Dnhnacademy.dooray.com%26loginUserCode%3D%26login_hint%3D%26pt%3D%26redirect_uri%3Dhttp%3A%2F%2Fnhnacademy.dooray.com%2Fauth%2Fsignin%2Fprocess%2Fiam%3FnextUrl%253D%25252Fpage-files%25252F3481345949028747701%2526loginUserCode%253D%2526pt%253D%2526login_hint%253D%26response_type%3Dcode%26service%3Ddooray%26state%3D8QG2QC' || '',
3+
domain: 'nhnacademy.dooray.com' || '',
4+
locale: '' || '',
5+
organizationName: 'NHN \uC544\uCE74\uB370\uBBF8' || '',
6+
service: 'dooray' || '',
7+
serviceName: 'Dooray!' || '',
8+
serviceId: '' || '',
9+
loginUserCode: '' || '',
10+
loginErrorCode: '' || '',
11+
envCategory: 'pub',
12+
rk: 'MIIBCgKCAQEAvjgiKRP2BbCNps3t+hJ1z6+EdxtALanfqLQXQyDgM+ZVJQzV8hNgzOp4PyJfI2ejGi8SfHGErbVVLGcGpLjIvKKnznd9r03Nv7zbOuAOLQO+mVl6OysRqw8JA4ZRDxUEVfeQbYVOsnvu0WyzUURUk3w94szJYE00mrLhV7swcfu+UXkZCRQXhACKr/u6Vc19/RTU2PpDRJbO8/0vqAEvm+HsowxCIE1o2uz41X4AsLDxotj4QM1EexHMogaaf7DSpuo9AHNboluzupOf3DNWRpXewlgKymQmuH6W3OA9e/MsQ2MGq/boYSg9fshivzgto0fHKusGl1Ar1Zf2sP3HzwIDAQAB',
13+
backLink: ('false' || '') === 'true'
14+
};</script><div id=app></div><script src=/dist/1697107588475/assets/js/chunk-vendors.7bd1bcee7f3e77c0023a.js type=text/javascript></script><script src=/dist/1697107588475/assets/js/chunk-common.eb553181e201bbc048bd.js type=text/javascript></script><script src=/dist/1697107588475/assets/js/login.6b0cb58e89d2a1793b7e.js type=text/javascript></script></body></html>

Diff for: 3481345949029027955

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta content="ie=edge" http-equiv=x-ua-compatible><title>NHN Cloud Member Login</title><link href=/dist/favicon.ico rel="shortcut icon"><meta content="width=device-width,initial-scale=1" name=viewport><link href=/dist/1697107588475/assets/css/chunk-common.3a8bc609b64e86fabf50.css rel=stylesheet><link href=/dist/1697107588475/assets/css/login.cc0a00afc59d6483c901.css rel=stylesheet></head><body><script type=text/javascript>window.jspVariables = {
2+
returnUrl: 'https%3A%2F%2Fiam.nhncloud.com%2Foauth%3Fclient_id%3Dn6ow0YfxCU0EBT1eAdzc%26domain%3Dnhnacademy.dooray.com%26loginUserCode%3D%26login_hint%3D%26pt%3D%26redirect_uri%3Dhttp%3A%2F%2Fnhnacademy.dooray.com%2Fauth%2Fsignin%2Fprocess%2Fiam%3FnextUrl%253D%25252Fpage-files%25252F3481345949029027955%2526loginUserCode%253D%2526pt%253D%2526login_hint%253D%26response_type%3Dcode%26service%3Ddooray%26state%3D4HsM6Y' || '',
3+
domain: 'nhnacademy.dooray.com' || '',
4+
locale: '' || '',
5+
organizationName: 'NHN \uC544\uCE74\uB370\uBBF8' || '',
6+
service: 'dooray' || '',
7+
serviceName: 'Dooray!' || '',
8+
serviceId: '' || '',
9+
loginUserCode: '' || '',
10+
loginErrorCode: '' || '',
11+
envCategory: 'pub',
12+
rk: 'MIIBCgKCAQEAvjgiKRP2BbCNps3t+hJ1z6+EdxtALanfqLQXQyDgM+ZVJQzV8hNgzOp4PyJfI2ejGi8SfHGErbVVLGcGpLjIvKKnznd9r03Nv7zbOuAOLQO+mVl6OysRqw8JA4ZRDxUEVfeQbYVOsnvu0WyzUURUk3w94szJYE00mrLhV7swcfu+UXkZCRQXhACKr/u6Vc19/RTU2PpDRJbO8/0vqAEvm+HsowxCIE1o2uz41X4AsLDxotj4QM1EexHMogaaf7DSpuo9AHNboluzupOf3DNWRpXewlgKymQmuH6W3OA9e/MsQ2MGq/boYSg9fshivzgto0fHKusGl1Ar1Zf2sP3HzwIDAQAB',
13+
backLink: ('false' || '') === 'true'
14+
};</script><div id=app></div><script src=/dist/1697107588475/assets/js/chunk-vendors.7bd1bcee7f3e77c0023a.js type=text/javascript></script><script src=/dist/1697107588475/assets/js/chunk-common.eb553181e201bbc048bd.js type=text/javascript></script><script src=/dist/1697107588475/assets/js/login.6b0cb58e89d2a1793b7e.js type=text/javascript></script></body></html>

Diff for: 3481345949033727759

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta content="ie=edge" http-equiv=x-ua-compatible><title>NHN Cloud Member Login</title><link href=/dist/favicon.ico rel="shortcut icon"><meta content="width=device-width,initial-scale=1" name=viewport><link href=/dist/1697107588475/assets/css/chunk-common.3a8bc609b64e86fabf50.css rel=stylesheet><link href=/dist/1697107588475/assets/css/login.cc0a00afc59d6483c901.css rel=stylesheet></head><body><script type=text/javascript>window.jspVariables = {
2+
returnUrl: 'https%3A%2F%2Fiam.nhncloud.com%2Foauth%3Fclient_id%3Dn6ow0YfxCU0EBT1eAdzc%26domain%3Dnhnacademy.dooray.com%26loginUserCode%3D%26login_hint%3D%26pt%3D%26redirect_uri%3Dhttp%3A%2F%2Fnhnacademy.dooray.com%2Fauth%2Fsignin%2Fprocess%2Fiam%3FnextUrl%253D%25252Fpage-files%25252F3481345949033727759%2526loginUserCode%253D%2526pt%253D%2526login_hint%253D%26response_type%3Dcode%26service%3Ddooray%26state%3D5Y2u1o' || '',
3+
domain: 'nhnacademy.dooray.com' || '',
4+
locale: '' || '',
5+
organizationName: 'NHN \uC544\uCE74\uB370\uBBF8' || '',
6+
service: 'dooray' || '',
7+
serviceName: 'Dooray!' || '',
8+
serviceId: '' || '',
9+
loginUserCode: '' || '',
10+
loginErrorCode: '' || '',
11+
envCategory: 'pub',
12+
rk: 'MIIBCgKCAQEAvjgiKRP2BbCNps3t+hJ1z6+EdxtALanfqLQXQyDgM+ZVJQzV8hNgzOp4PyJfI2ejGi8SfHGErbVVLGcGpLjIvKKnznd9r03Nv7zbOuAOLQO+mVl6OysRqw8JA4ZRDxUEVfeQbYVOsnvu0WyzUURUk3w94szJYE00mrLhV7swcfu+UXkZCRQXhACKr/u6Vc19/RTU2PpDRJbO8/0vqAEvm+HsowxCIE1o2uz41X4AsLDxotj4QM1EexHMogaaf7DSpuo9AHNboluzupOf3DNWRpXewlgKymQmuH6W3OA9e/MsQ2MGq/boYSg9fshivzgto0fHKusGl1Ar1Zf2sP3HzwIDAQAB',
13+
backLink: ('false' || '') === 'true'
14+
};</script><div id=app></div><script src=/dist/1697107588475/assets/js/chunk-vendors.7bd1bcee7f3e77c0023a.js type=text/javascript></script><script src=/dist/1697107588475/assets/js/chunk-common.eb553181e201bbc048bd.js type=text/javascript></script><script src=/dist/1697107588475/assets/js/login.6b0cb58e89d2a1793b7e.js type=text/javascript></script></body></html>

Diff for: 3481345949034048654

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta content="ie=edge" http-equiv=x-ua-compatible><title>NHN Cloud Member Login</title><link href=/dist/favicon.ico rel="shortcut icon"><meta content="width=device-width,initial-scale=1" name=viewport><link href=/dist/1697107588475/assets/css/chunk-common.3a8bc609b64e86fabf50.css rel=stylesheet><link href=/dist/1697107588475/assets/css/login.cc0a00afc59d6483c901.css rel=stylesheet></head><body><script type=text/javascript>window.jspVariables = {
2+
returnUrl: 'https%3A%2F%2Fiam.nhncloud.com%2Foauth%3Fclient_id%3Dn6ow0YfxCU0EBT1eAdzc%26domain%3Dnhnacademy.dooray.com%26loginUserCode%3D%26login_hint%3D%26pt%3D%26redirect_uri%3Dhttp%3A%2F%2Fnhnacademy.dooray.com%2Fauth%2Fsignin%2Fprocess%2Fiam%3FnextUrl%253D%25252Fpage-files%25252F3481345949034048654%2526loginUserCode%253D%2526pt%253D%2526login_hint%253D%26response_type%3Dcode%26service%3Ddooray%26state%3Dxl7bFC' || '',
3+
domain: 'nhnacademy.dooray.com' || '',
4+
locale: '' || '',
5+
organizationName: 'NHN \uC544\uCE74\uB370\uBBF8' || '',
6+
service: 'dooray' || '',
7+
serviceName: 'Dooray!' || '',
8+
serviceId: '' || '',
9+
loginUserCode: '' || '',
10+
loginErrorCode: '' || '',
11+
envCategory: 'pub',
12+
rk: 'MIIBCgKCAQEAvjgiKRP2BbCNps3t+hJ1z6+EdxtALanfqLQXQyDgM+ZVJQzV8hNgzOp4PyJfI2ejGi8SfHGErbVVLGcGpLjIvKKnznd9r03Nv7zbOuAOLQO+mVl6OysRqw8JA4ZRDxUEVfeQbYVOsnvu0WyzUURUk3w94szJYE00mrLhV7swcfu+UXkZCRQXhACKr/u6Vc19/RTU2PpDRJbO8/0vqAEvm+HsowxCIE1o2uz41X4AsLDxotj4QM1EexHMogaaf7DSpuo9AHNboluzupOf3DNWRpXewlgKymQmuH6W3OA9e/MsQ2MGq/boYSg9fshivzgto0fHKusGl1Ar1Zf2sP3HzwIDAQAB',
13+
backLink: ('false' || '') === 'true'
14+
};</script><div id=app></div><script src=/dist/1697107588475/assets/js/chunk-vendors.7bd1bcee7f3e77c0023a.js type=text/javascript></script><script src=/dist/1697107588475/assets/js/chunk-common.eb553181e201bbc048bd.js type=text/javascript></script><script src=/dist/1697107588475/assets/js/login.6b0cb58e89d2a1793b7e.js type=text/javascript></script></body></html>

Diff for: 3481345949034798740

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta content="ie=edge" http-equiv=x-ua-compatible><title>NHN Cloud Member Login</title><link href=/dist/favicon.ico rel="shortcut icon"><meta content="width=device-width,initial-scale=1" name=viewport><link href=/dist/1697107588475/assets/css/chunk-common.3a8bc609b64e86fabf50.css rel=stylesheet><link href=/dist/1697107588475/assets/css/login.cc0a00afc59d6483c901.css rel=stylesheet></head><body><script type=text/javascript>window.jspVariables = {
2+
returnUrl: 'https%3A%2F%2Fiam.nhncloud.com%2Foauth%3Fclient_id%3Dn6ow0YfxCU0EBT1eAdzc%26domain%3Dnhnacademy.dooray.com%26loginUserCode%3D%26login_hint%3D%26pt%3D%26redirect_uri%3Dhttp%3A%2F%2Fnhnacademy.dooray.com%2Fauth%2Fsignin%2Fprocess%2Fiam%3FnextUrl%253D%25252Fpage-files%25252F3481345949034798740%2526loginUserCode%253D%2526pt%253D%2526login_hint%253D%26response_type%3Dcode%26service%3Ddooray%26state%3Do93TfK' || '',
3+
domain: 'nhnacademy.dooray.com' || '',
4+
locale: '' || '',
5+
organizationName: 'NHN \uC544\uCE74\uB370\uBBF8' || '',
6+
service: 'dooray' || '',
7+
serviceName: 'Dooray!' || '',
8+
serviceId: '' || '',
9+
loginUserCode: '' || '',
10+
loginErrorCode: '' || '',
11+
envCategory: 'pub',
12+
rk: 'MIIBCgKCAQEAvjgiKRP2BbCNps3t+hJ1z6+EdxtALanfqLQXQyDgM+ZVJQzV8hNgzOp4PyJfI2ejGi8SfHGErbVVLGcGpLjIvKKnznd9r03Nv7zbOuAOLQO+mVl6OysRqw8JA4ZRDxUEVfeQbYVOsnvu0WyzUURUk3w94szJYE00mrLhV7swcfu+UXkZCRQXhACKr/u6Vc19/RTU2PpDRJbO8/0vqAEvm+HsowxCIE1o2uz41X4AsLDxotj4QM1EexHMogaaf7DSpuo9AHNboluzupOf3DNWRpXewlgKymQmuH6W3OA9e/MsQ2MGq/boYSg9fshivzgto0fHKusGl1Ar1Zf2sP3HzwIDAQAB',
13+
backLink: ('false' || '') === 'true'
14+
};</script><div id=app></div><script src=/dist/1697107588475/assets/js/chunk-vendors.7bd1bcee7f3e77c0023a.js type=text/javascript></script><script src=/dist/1697107588475/assets/js/chunk-common.eb553181e201bbc048bd.js type=text/javascript></script><script src=/dist/1697107588475/assets/js/login.6b0cb58e89d2a1793b7e.js type=text/javascript></script></body></html>

Diff for: 3481345949034913349

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta content="ie=edge" http-equiv=x-ua-compatible><title>NHN Cloud Member Login</title><link href=/dist/favicon.ico rel="shortcut icon"><meta content="width=device-width,initial-scale=1" name=viewport><link href=/dist/1697107588475/assets/css/chunk-common.3a8bc609b64e86fabf50.css rel=stylesheet><link href=/dist/1697107588475/assets/css/login.cc0a00afc59d6483c901.css rel=stylesheet></head><body><script type=text/javascript>window.jspVariables = {
2+
returnUrl: 'https%3A%2F%2Fiam.nhncloud.com%2Foauth%3Fclient_id%3Dn6ow0YfxCU0EBT1eAdzc%26domain%3Dnhnacademy.dooray.com%26loginUserCode%3D%26login_hint%3D%26pt%3D%26redirect_uri%3Dhttp%3A%2F%2Fnhnacademy.dooray.com%2Fauth%2Fsignin%2Fprocess%2Fiam%3FnextUrl%253D%25252Fpage-files%25252F3481345949034913349%2526loginUserCode%253D%2526pt%253D%2526login_hint%253D%26response_type%3Dcode%26service%3Ddooray%26state%3D6rX7M3' || '',
3+
domain: 'nhnacademy.dooray.com' || '',
4+
locale: '' || '',
5+
organizationName: 'NHN \uC544\uCE74\uB370\uBBF8' || '',
6+
service: 'dooray' || '',
7+
serviceName: 'Dooray!' || '',
8+
serviceId: '' || '',
9+
loginUserCode: '' || '',
10+
loginErrorCode: '' || '',
11+
envCategory: 'pub',
12+
rk: 'MIIBCgKCAQEAvjgiKRP2BbCNps3t+hJ1z6+EdxtALanfqLQXQyDgM+ZVJQzV8hNgzOp4PyJfI2ejGi8SfHGErbVVLGcGpLjIvKKnznd9r03Nv7zbOuAOLQO+mVl6OysRqw8JA4ZRDxUEVfeQbYVOsnvu0WyzUURUk3w94szJYE00mrLhV7swcfu+UXkZCRQXhACKr/u6Vc19/RTU2PpDRJbO8/0vqAEvm+HsowxCIE1o2uz41X4AsLDxotj4QM1EexHMogaaf7DSpuo9AHNboluzupOf3DNWRpXewlgKymQmuH6W3OA9e/MsQ2MGq/boYSg9fshivzgto0fHKusGl1Ar1Zf2sP3HzwIDAQAB',
13+
backLink: ('false' || '') === 'true'
14+
};</script><div id=app></div><script src=/dist/1697107588475/assets/js/chunk-vendors.7bd1bcee7f3e77c0023a.js type=text/javascript></script><script src=/dist/1697107588475/assets/js/chunk-common.eb553181e201bbc048bd.js type=text/javascript></script><script src=/dist/1697107588475/assets/js/login.6b0cb58e89d2a1793b7e.js type=text/javascript></script></body></html>

Diff for: src/main/java/org/nhnacademy/leejungbum/App.java

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package org.nhnacademy.leejungbum;
2+
3+
/**
4+
* Hello world!
5+
*
6+
*/
7+
public class App
8+
{
9+
10+
public static class Test extends Thread{
11+
@Override
12+
public void run(){
13+
System.out.println("test");
14+
}
15+
}
16+
public static void main( String[] args )
17+
{
18+
Test test = new Test();
19+
test.start();
20+
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package org.nhnacademy.leejungbum.counter.counter1;
2+
3+
public class Counter {
4+
5+
private String name;
6+
private int count;
7+
public Counter(){
8+
name="counter";
9+
count=0;
10+
}
11+
12+
public void run(){
13+
while (!Thread.interrupted()){
14+
try {
15+
Thread.sleep(1000);
16+
} catch (InterruptedException e) {
17+
throw new RuntimeException(e);
18+
}
19+
count++;
20+
System.out.println(getClass().getSimpleName()+ " : "+count);
21+
}
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package org.nhnacademy.leejungbum.counter.counter1;
2+
3+
public class TestCounter {
4+
public static void main(String[] args) {
5+
Counter counter = new Counter();
6+
counter.run();
7+
}
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package org.nhnacademy.leejungbum.counter.counter2;
2+
3+
public class Counter {
4+
5+
private String name;
6+
private int count;
7+
public Counter(String name){
8+
this.name=name;
9+
count=0;
10+
}
11+
12+
public void run(){
13+
while (!Thread.interrupted()){
14+
try {
15+
Thread.sleep(1000);
16+
} catch (InterruptedException e) {
17+
throw new RuntimeException(e);
18+
}
19+
count++;
20+
System.out.println(name+ " : "+count);
21+
}
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package org.nhnacademy.leejungbum.counter.counter2;
2+
3+
public class TestCounter {
4+
public static void main(String[] args) {
5+
Counter counter1 = new Counter("Counter1");
6+
Counter counter2 = new Counter("Counter2");
7+
8+
counter1.run();
9+
counter2.run();
10+
}
11+
}
12+
13+
//현재 counter1 에 while문을 빠져나오지 못하고있다.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package org.nhnacademy.leejungbum.counter.counter3;
2+
3+
public class CounterThread extends Thread {
4+
5+
private String name;
6+
private int count;
7+
public CounterThread(String name){
8+
this.name=name;
9+
count=0;
10+
}
11+
12+
@Override
13+
public void run(){
14+
while (!Thread.interrupted()){
15+
try {
16+
Thread.sleep(1000);
17+
} catch (InterruptedException e) {
18+
throw new RuntimeException(e);
19+
}
20+
count++;
21+
System.out.println(name+ " : "+count);
22+
}
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package org.nhnacademy.leejungbum.counter.counter3;
2+
3+
public class TestCounter {
4+
public static void main(String[] args) {
5+
CounterThread counterThread = new CounterThread("CounterThread");
6+
7+
counterThread.start();
8+
}
9+
}
10+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package org.nhnacademy.leejungbum.counter.counter4;
2+
3+
public class CounterThread extends Thread {
4+
5+
private String name;
6+
private int count;
7+
public CounterThread(String name){
8+
this.name=name;
9+
count=0;
10+
}
11+
12+
@Override
13+
public void run(){
14+
while (!Thread.interrupted()){
15+
try {
16+
Thread.sleep(1000);
17+
} catch (InterruptedException e) {
18+
throw new RuntimeException(e);
19+
}
20+
count++;
21+
System.out.println(name+ " : "+count);
22+
}
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package org.nhnacademy.leejungbum.counter.counter4;
2+
3+
public class TestCounter {
4+
public static void main(String[] args) {
5+
CounterThread counterThread1 = new CounterThread("CounterThread1");
6+
CounterThread counterThread2 = new CounterThread("CounterThread2");
7+
8+
counterThread1.start();
9+
counterThread2.start();
10+
}
11+
}
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package org.nhnacademy.leejungbum.counter.counter5;
2+
3+
public class CounterThread extends Thread {
4+
5+
private String name;
6+
private int count;
7+
public CounterThread(String name){
8+
this.name=name;
9+
count=0;
10+
}
11+
12+
@Override
13+
public void run(){
14+
while (!Thread.interrupted()){
15+
try {
16+
Thread.sleep(1000);
17+
} catch (InterruptedException e) {
18+
throw new RuntimeException(e);
19+
}
20+
count++;
21+
System.out.println(name+ " : "+count);
22+
}
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.nhnacademy.leejungbum.counter.counter5;
2+
3+
import org.nhnacademy.leejungbum.counter.counter2.Counter;
4+
5+
public class TestCounter {
6+
public static void main(String[] args) {
7+
Counter counter = new Counter("Counter");
8+
CounterThread counterThread1 = new CounterThread("CounterThread1");
9+
CounterThread counterThread2 = new CounterThread("CounterThread2");
10+
counterThread1.start();
11+
counter.run();
12+
13+
counterThread2.start();
14+
}
15+
}
16+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package org.nhnacademy.leejungbum.demonthread.demonthread1;
2+
3+
public class TestDaemonThread {
4+
public static class WorkerThread extends Thread {
5+
public WorkerThread(String name){
6+
super(name);
7+
}
8+
@Override
9+
public void run(){
10+
while (!Thread.interrupted()) {
11+
try {
12+
sleep(1000);
13+
} catch (InterruptedException e) {
14+
throw new RuntimeException(e);
15+
}
16+
System.out.println(getName()+" " +getState());
17+
}
18+
}
19+
}
20+
21+
public static void main(String[] args) {
22+
WorkerThread w1 = new WorkerThread("thread1");
23+
WorkerThread w2 = new WorkerThread("demon");
24+
25+
w1.setDaemon(true);
26+
w1.start();
27+
w2.start();
28+
try {
29+
Thread.sleep(1000);
30+
} catch (InterruptedException e) {
31+
throw new RuntimeException(e);
32+
}
33+
w2.interrupt();
34+
System.out.println("Main Thread terminated");
35+
}
36+
}

0 commit comments

Comments
 (0)