2020/11(6)
-
Java thread에서의 Lock의 종류?
자바에서 2개의 Lock이 있는데 첫번째는 자바에서 thread간 동기화를 위해 synchronized 키워드를 사용하는것을 사용 합니다. 이런 synchronized 키워드를 사용하는 lock을 Intrinsic Lock 또는 Built-in Lock이라고 한다. // Mutual Exclusion public synchroized void intrinsicLockfunc(){ ... } // Wait synchronized(this){ ... this.wait(); ... } // signal synchronized(this){ ... this.notify(); ... } 두번째는 Java 1.5에서 java.util.concurrent.locks 패키지를 통해 제공되는 Explicit Lock이 있..
2020.11.24 -
Jackson Annotation Examples
@JsonInclude 어노테이션 속성을 제외 하는데 사용. ex) JSONObject _connects가 null인 경우에 제외! @JsonInclude(JsonInclude.Include.NON_NULL) private JSONObject _connects; @JsonIgnoreProperties 클래스 레벨의 어노테이션이고 무시할 속성을 표시 @JsonIgnoreProperties({ "id" }) public class BeanWithIgnore { public int id; public String name; } id는 무시되는걸 알수 있다. @Test public void whenSerializingUsingJsonIgnoreProperties_thenCorrect() throws JsonPr..
2020.11.17 -
@Retryable
특정 Exception이 발생하면 일정 횟수만큼 재시도 할 수 있는 어노테이션이다. @EnableRetry 작성.(configuration 등) 재시도 하고 싶은 메소드에 @Retryable 작성. include : 특정 Exception이 발생할 때 retry exclude : 설정 된 Exception 재시도 제외 maxAttempts : 최대 재시도 횟수(default 3회) backoff : 재시도 pause 시간 ex) FailedStoreException 발생 시 최대 5번 시도! delay 10 @Retryable(value = { FailedStoreException.class }, maxAttempts = 5, backoff = @Backoff(delay = 10)) 참고 // // So..
2020.11.17 -
k8s 자격증?
온라인 시험이.. 300달러..!!! 개 비싸다 ㅋㅋ 열공하고 회사에서 지원해주면 도전해 볼 만할듯! ㅋㅋ www.cncf.io/certification/cka/ Certified Kubernetes Administrator (CKA) | Cloud Native Computing Foundation The Certified Kubernetes Administrator (CKA) program was created by the Cloud Native Computing Foundation (CNCF), in collaboration with The Linux Foundation, to help develop the Kubernetes ecosystem. www.cncf.io
2020.11.12 -
@PreDestory란?
이 메소드는 소멸 메소드이며 이전 @PostConstruct와 상반된 개념이다. JSR-250 스펙에 따라 구현 되었다. (걍 자바에서 사용하려면 또는 springframework 2.5미만 버전에서는 javax.annotation 패키지 관련 라이브러리가 필요 함.) Springframework 2.5부터는 사용 가능! 현재 프로젝트에서는 @PostConstruct와 @PreDestory만 사용하고 있다. 하지만 찾아보니 여러가지 방법이 존재했다. 아래의 멋진 사이트를 참고하면 된다. 정리 및 공유 감사용! madplay.github.io/post/spring-bean-lifecycle-methods 그 중 흥미로운 테스트가 있었는데 바로 생성자/소멸자 호출 순서 테스트이다. import javax.a..
2020.11.12 -
@PostConstruct란?
@PostConstruct? javax.annotation Annotation Type PostConstruct @Documented @Retention(value=RUNTIME) @Target(value=METHOD) public @interface PostConstruct The PostConstruct annotation is used on a method that needs to be executed after dependency injection is done to perform any initialization. This method MUST be invoked before the class is put into service. This annotation MUST be supported on..
2020.11.10