시험대비

파일 읽고 쓰기

파일 모니터링

  • https://codify.tistory.com/146

Gson 읽고 쓰기

콘솔 읽고 쓰기

소켓

Jetty

외부프로그램

URLClassLoader

java.net.URLClassLoader Example - Examples Java Code Geeks - 2022

Concurrency(쓰레드)

타임아웃

java - How to timeout a thread - Stack Overflow

타이머

https://jeong-pro.tistory.com/150

참고코드

public static long time(Executor executor, int concurrency, Runnable action)
       throws InterruptedException {
       CountDownLatch ready = new CountDownLatch(concurrency);
       CountDownLatch start = new CountDownLatch(1);
       CountDownLatch done = new CountDownLatch(concurrency);
       
       for(int i=0; i < concurrency; i++) {
         executor.execute(() -> {
           try {
              start.await();
              action.run();
           } catch(InterruptedException e) {
              Thread.currentThread().interrupt();
           } finally {
              done.countDown();
           }
         }
       });
       
       ready.await();
       long startNanos = System.nanoTime();
       start.countDown();
       done.await();
       return System.nanoTime() - startNanos;
}

댓글