3월, 2016의 게시물 표시

[Tomcat] SE[VERE: IOException while loading persisted sessions: java.io.EOFException

이미지
젠킨스를 이용하여 자동빌드를 하던 도중 갑자기 connection refuse 에러가 발생. 카탈리나 로그를 확인해 보니 아래와 같은 에러가 발생하며 배포가 되지 않았다. SEVERE: IOException while loading persisted sessions: java.io.EOFException Tomcat 디렉토리를 clean 해주지 못하는 경우 발생. 문제가 발생한 app 경로를 찾아가 SESSION.ser 파일을 삭제해주면 깔끔하게 해결된다. ${catalina.home}/work/Catalina/localhost/<app>/SESSION.ser    나의 경우는  ${catalina.home}/work/Catalina/localhost/manager에 있는 SESSION.ser 파일을  삭제해 주어 해결하였다.  refs :  http://stackoverflow.com/questions/12348170/what-is-wrong-with-my-config-severe-ioexception-while-loading-persisted-sessio

[JAVA8] 람다식을 이용한 Batch Insert 구현하기

Java 8 에서 람다식을 이용한 Batch Insert 구현하기   조회한 데이터의 사이즈가 커서 일정 단위로 잘라 넣어야 할 일이 생겼다. 람다식을 이용한 메서드를 만들어 사용하였으며, 간결하다고 생각되어 해당 메서드를  공유해 본다. public static <T>Stream <List<T>>   batches (List<T> source, int length) {   if (length <= 0) throw new IllegalArgumentException("length = " + length);   int size = source.size();   if (size <= 0) return Stream.empty();   int fullChunks = (size - 1) / length;   return IntStream.range(0, fullChunks + 1).mapToObj(           n -> source.subList(n * length, n == fullChunks ? size : (n + 1) * length)); }  (코드 스타일이 적용이 되지 않아 실제 구현된 메서드는 텍스트로 표현) // 사용 예) public static void main(String[] args) { List list = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14); System.out.println("By 3:"); batches(list, 3).forEach(System.out::println); System.out.println("By 4:"); batches(list, 4).forEach(System.out::println); } refs :  http://stackoverflow.com/q