private class JobRunner implements Runnable {
		private Handler handler;
		public JobRunner(Handler h) {
			handler = h;
		}
		@Override
		public void run() {
			while(true) {
				if( isRunning == false )
					break;
				
				IconGetJob job = mJobQ.poll();
				if( job == null ) {
					continue;
//					isRunning = false;
//					break;
				}
				
				Game game = job.getGame();
				GameDataHandlable gdh = job.getHandler();
				Bitmap bitmap = gdh.getIconBitmap(game);
				JobResult result = new JobResult(game, bitmap);			
				Message msg = new Message();
				msg.obj = result;
				handler.sendMessage(msg);
				try {
					Thread.sleep(100);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			
			}
		}
	}


간단히 요약하자며 큐(LinkedBlockingQueue)에다가 작업할거(비트맵 가져오기) 가 쌓여 있다고 하면,

쓰레드가 큐에서 작업을 하나씩 가져와서 작업을 수행합니다.

큐에 작업이 없으면 continue 를 하는 식으로 만들었는데 cpu 점유율이 100% 더군요;;

sleep() 시간을 늘려도 마찬가지 입니다.


busy wait 방식이라고 하던데.. 머가 문제 인가요..? notify, wait 를 사용해야 한다고 하는데 어떻게 사용해야 합니까?

도와 주세요.