본문 바로가기

Java

(36)
Java Programming - Why this warning comes when i use Generics in java1.5 Why this warning comes when i use Generics in java1.5? "The cast fromObject to List is actually checking against the erased type of List" I m getting this warning whenever I am fetching any List from a Map object. headerList = (List)listMap.get("headerList"); Re: Why this warning comes when i use Generics in java1.5? The cast fromObject to List is actually checking against the erased type of Lis..
ThreadPoolExecutor http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ThreadPoolExecutor.html#execute(java.lang.Runnable)ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueueRunnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) * corePoolSize : Pool의 MIN크기* maximumPoolSize : Pool의 MAX 크기* keepAliveTime : Thread가 Idle이고 현재 ..
Java Semaphore Semaphore import java.util.concurrent.Semaphore; //Solving the mutual exclusion problem using Semaphore class class Process2 extends Thread { private int id; private Semaphore sem; public Process2(int i, Semaphore s) { id = i; sem = s; } private int random(int n) { return (int) Math.round(n * Math.random() - 0.5); } private void busy() { try { sleep(random(500)); } catch (InterruptedException e)..
ThreadpoolExecutor ThreadpoolExecutor 출처: http://programmingexamples.wikidot.com/threadpoolexecutor public class ThreadPoolExecutor extends AbstractExecutorService An ExecutorService that executes each submitted task using one of possibly several pooled threads, normally configured using Executors factory methods. Thread pools address two different problems: they usually provide improved performance when executing..