레이블이 java인 게시물을 표시합니다. 모든 게시물 표시
레이블이 java인 게시물을 표시합니다. 모든 게시물 표시

2014년 6월 2일 월요일

java checked exception unchecked exception

http://tutorials.jenkov.com/java-exception-handling/checked-or-unchecked-exceptions.html

2014년 5월 15일 목요일

Java Generic 클래스를 정의하고 그 클래스에서만 사용할 Exception 을 inner 클래스로 정의해서 사용하려 했더니 컴파일 에러가 난다. 하지만 그 Exception 을 static 으로 바꾸니 에러가 나지 않는다. 이유가 뭔가 했더니...


Java doesn't allow generic subclasses of Throwable. And, a nonstatic inner class is effectively parameterized by the type parameters of its outerclass (See Oracle JDK Bug 5086027). For instance, in your example, instances of your innerclass have types of form SomeGenericClass<T>.SomeInternalException. So, Java doesn't allow the static inner class of a generic class to extend Throwable.

static 으로 바꾸면 그 inner 클래스는 generic 클래스가 아니다.
A workaround would be to make SomeInternalException a static inner class. This is because if the innerclass is static its type won't be generic, i.e., SomeGenericClass.SomeInternalException.

자세한 내용은 아래 참조
http://stackoverflow.com/questions/13694637/making-the-inner-class-of-a-generic-class-extend-throwable


2014년 5월 13일 화요일

Atomic Operation

Java volatile
http://docs.oracle.com/javase/tutorial/essential/concurrency/atomic.html

2014년 5월 12일 월요일

java reference and reachability

understanding of weakly reference

https://weblogs.java.net/blog/2006/05/04/understanding-weak-references
http://blog.yohanliyanage.com/2010/10/ktjs-3-soft-weak-phantom-references

java reference and gc

http://helloworld.naver.com/helloworld/329631


은근 제대로 알고 있는 사람이 없는 것 같다.
오늘 면접 본 회사의 실무자도 틀리게 알고 있었어.
(너무 당당하길래 이야기 하길래 그런줄 알았는데...-_-;)
Soft Reference 와 Weakly Reference는 같지 않습니다.

여튼, 나도 살짝 개념이 약했던지라 다시 정리한다.

2014년 5월 5일 월요일

JVM 및 Java 성능 튜닝


JVM

http://docs.oracle.com/javase/specs/jvms/se7/jvms7.pdf
http://helloworld.naver.com/helloworld/1230
http://helloworld.naver.com/helloworld/184615

GC  

gc
http://helloworld.naver.com/helloworld/1329
http://helloworld.naver.com/helloworld/329631

모니터링
http://helloworld.naver.com/helloworld/helloworld/6043

튜닝
http://helloworld.naver.com/helloworld/37111


졸업한지 7년이다. 근데 깊게 들어갈수록 대학 시절 전공 수업이 중요했다는 것을 깨닫는다.
컴파일러 교수님이 생각나네. 어찌나 감사한지...

지식이란 깊이가 더해져 점점 단단해지는 것 같다.
그리고 세상에 고수들은 많다.

2014년 4월 28일 월요일

Java IO Vs NIO

Java IO vo NIO


별도로 정리가 필요하지 않을 정도로 잘 요약이 되어 있다.

http://tutorials.jenkov.com/java-nio/nio-vs-io.html