본문 바로가기

java

Java8 G1 garbage collection 특징 Java 8 부터는 G1 GC 를 기본으로 설정 되어있다. 자세히 알아보기 전에 미리 알아두어야 할 것들이 있다. Java 7update 4 부터 parallel GC 가 기본으로 설정되어있다.JVM 옵션 (아래 둘 중에 아무거나 하나)-XX:+UseParallelGC-XX:+UseParallelOldGC parallel GC 의 특징application 의 throughput 이 latency 보다 중요할 때 (i.e. batch 프로그램) CMS GC 의 특징application thread 와 garbage collection thread 가 동시에 실행된다.application latency 를 향상 시키는 것에 주안점을 두었다. (GC 의 횟수를 줄이는 것)parallel GC 보다 약 10~2.. 더보기
Java GC tuning 현재 이용가능한 Java GC 알고리즘들에 대해서 간단하게 알아보고 tuning 하는 방법에 대해서 알아봅니다. 자료가 약간 오래되어서 지금은 적용이 안 될 수도 있는 것이 있습니다. 자료 다운로드 더보기
Functional Programming in Java Part2 - Java8 Java 8 언어로 어떻게 하면 함수형으로 프로그래밍 할 수 있는 지 보여줍니다. 자료 다운로드 더보기
Functional Programming in Java Part1 - Java8 Java 8 언어로 어떻게 하면 함수형으로 프로그래밍 할 수 있는 지 보여줍니다. 자료 다운로드 더보기
el capitan 에서 java 설치하기 el capitan 으로 업그레이드 하고 나서 java 6 가 지워져서 이것을 사용하는 프로그램이 작동을 하지 않는 일이 생겼다. 그래서 java 6 설치하는 방법을 남겨둔다. 아래 사이트에서 OSX 전용으로 만들어진 package 를 다운로드 받아서 설치하면 된다.https://support.apple.com/kb/DL1572?locale=ko_KR 다른 java 버전도 설치하길 원한다면, 설명이 잘 되어있는 아래 링크를 참고하길 바란다.http://www.clien.net/cs2/bbs/board.php?bo_table=lecture&wr_id=274767 더보기
IntelliJ tomcat 구동시 유의사항 IntelliJ 로 Web application 을 구동하는 경우에 war: exploded 혹은 war 로 deploy 를 하게 된다. 보통 web application 을 개발할 시 maven 을 사용하게 되는데, IntelliJ 에서 제공하는 Make 는 library dependency 를 잘 고려하 여 컴파일을 하지만, tomcat 을 이용하여 deploy 할 경우, dependency 들을 잘 반영하여 war packaging 을 하지 못한다.그리하여 maven pom.xml 파일에 library 들을 잘 명시하더라도 막상 해당 web application 을 구동하면 NoClassFound Exception 이 발생한다.이를 방지하고자 maven 으로 package 혹은 compile 을 이.. 더보기
Setting up logback in Java and Scala project Logback is promising log library I think, So in this time, I am going to set up logback in Java and Scala project using maven. Setting up logback is quite straitforward and simple. At first, you have to download maven dependencies.Things to remember you have to, org.slf4j library and ch.qos.logback libraries version should match each other. Otherwise, you have error message during executing prog.. 더보기
IntelliJ GenerateSerialVersionUID In IntelliJ, compared with Eclipse, you should install GenerateSerialVersionUID manually, if you want get serialVersionUID field automatically. (IntelliJ 에는 Serializable interface 를 implements 할 경우, serialVersionUID 를 자동으로 생성해 주는 plugin 을 설치해야 한다.) Install plugins like below (아래와 같은 방식으로 설치를 하면 된다.)Preference -> Plugins -> Browse repositories -> GenerateSerialVersionUID 더보기
ExceptionUtils - java 에서 exception 관련 처리를 쉽게 도와주는 클래스 Exception 관련 처리를 임의로 가공하여 처리하고 싶을때 편의를 제공해 주는 apache commons-lang package 에 있는 library 이다. http://commons.apache.org/proper/commons-lang/ 사용예: String message = null; try { String str = null str.toUpperCase(); } catch (Exception e) { message = ExceptionUtils.getFullStackTrace(e); } System.out.println(message); 이보다 다양한 기능을 제공하고 있으니 documentation 을 참고하자. javadoc api: http://commons.apache.org/prope.. 더보기
Java 에서 자원 할당하고 해제하기 (괜찮은 패턴) Java 에서 자원을 할당하고 해제하는 코드는 상당히 귀찮고 코드도 복잡하게 될 수 있다. 보통 아래와 같이 코드를 작성한다. public void test(String inputFileName, String outputFileName) { InputStream in = null; OutputStream out = null; try { in = new FileInputStream(inputFileName); out = new FileOutputStream(outputFileName); copy(in, out); } catch (FileNotFoundException e) { e.printStackTrace(); } finally { if (in != null) { try { in.close(); } ca.. 더보기