'Back-End/Java_1'에 해당되는 글 48건

donaricano-btn

JDK 환경변수 설정(configure) - Window10


1. JDK 다운

- 해당 주소에서 원하는 JDK 다운받는다

http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html


2. 환경변수 설정

1) 제어판 -> 시스템 및 보안 -> 시스템 -> 고급 시스템 설정

2) 환경변수

- 새로 만들기를 클릭한다

- JAVA_HOME 을 만들고 JDK의 위치를 설정한다

- Path 추가

- %JAVA_HOME%\bin을 추가한다

3. 확인

- cmd

- javac -version, java -version 을 입력하여 아래와 같이 나오면 된다



'Back-End > Java_1' 카테고리의 다른 글

[Java] Garbage Collection  (0) 2016.10.11
[Java] Shutdown Hook  (0) 2016.10.10
[Java] Thread pool  (0) 2016.10.10
[Java] Daemon Thread  (0) 2016.10.10
[Java] Thread Priority  (0) 2016.10.07
블로그 이미지

리딩리드

,
donaricano-btn

Garbage Collection

- Garbage Collection is process of reclaiming the runtime unused memory automatically

- It is a way to destroy the unused objects

- Java is performed automatically, Java provides better memory management


1. Advantage

- It makes java memory efficient

- It is automatically done by the garbage collector(a part of JVM)


2. How can an object be unreferenced?

- By nulling the reference

- By assigning a reference to another

- By annoymous object etc


1) By nulling a reference


2) By assigning a reference to another

 

3) By annonymous object

 

3. finalize() method

- The finalize() is invoked each time before the object is garbage collected

- It can be used to perform cleanup processing

 

1) point

- The garbage collector collects only those objects that are created by new keyword

- If you have created any object without new, you can use finalize method to perform cleanup processing


4. gc() method

- gc() is used to invoke the garbage collector to perform cleanup processing

- gc() is found in System and Runtime classes

 

1) point

- Garbage collection is performed by a daemon thread called GC

- This thread calls the finalize() before object is garbage collected



'Back-End > Java_1' 카테고리의 다른 글

[Java] JDK 환경변수 설정(configure) - Window10  (0) 2016.11.13
[Java] Shutdown Hook  (0) 2016.10.10
[Java] Thread pool  (0) 2016.10.10
[Java] Daemon Thread  (0) 2016.10.10
[Java] Thread Priority  (0) 2016.10.07
블로그 이미지

리딩리드

,
donaricano-btn

Shutdown Hook

- Shutdown hook can be used to perform cleanup resource or save the state when JVM shuts down normally or abruptly

- clean resource means closing log file, sending some alerts...]

- If you want to execute some code before JVM shuts down, use shutdown hook


1. When does the JVM shut down?

- user presses ctrl+c on the command prompt

- System.exit(int) method is invoked

- user logoff

- user shutdown etc..


2. The addShutdownHook(Thread hook) mehtod

- addShutdownHook() method of Runtime class is used to register the thread with the Virtual Machine


3. Simple Example

 

'Back-End > Java_1' 카테고리의 다른 글

[Java] JDK 환경변수 설정(configure) - Window10  (0) 2016.11.13
[Java] Garbage Collection  (0) 2016.10.11
[Java] Thread pool  (0) 2016.10.10
[Java] Daemon Thread  (0) 2016.10.10
[Java] Thread Priority  (0) 2016.10.07
블로그 이미지

리딩리드

,

[Java] Thread pool

Back-End/Java_1 2016. 10. 10. 15:56
donaricano-btn

Thread pool

- Thread pool represents a group of worker threads that are waiting for the job and reuse many times

- a group of fixed size threads are created

- A thread from thread pool is pulled out and assigned a job by service provider

- After completion of the job, thread is contained in the thread pool again


1. Advantage

- Better performance

- It saves time because there is no need to create new thread

2. Real time usage

- It is used in Servlet and JSP  where container creates a thread pool to process the request

3. Example



'Back-End > Java_1' 카테고리의 다른 글

[Java] Garbage Collection  (0) 2016.10.11
[Java] Shutdown Hook  (0) 2016.10.10
[Java] Daemon Thread  (0) 2016.10.10
[Java] Thread Priority  (0) 2016.10.07
[Java] Naming Thread  (0) 2016.10.07
블로그 이미지

리딩리드

,