|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 전의 클래스 다음의 클래스 | 프레임 있어 프레임 없음 | |||||||||
| 개요: 상자 | 필드 | 생성자 | 메소드 | 상세: 필드 | 생성자 | 메소드 | |||||||||
java.lang.Objectjava.util.concurrent.AbstractExecutorService
public abstract class AbstractExecutorService
ExecutorService 실행 메소드의 디폴트 구현을 제공합니다. 이 클래스는, 이 패키지로 제공되는 FutureTask 클래스가 디폴트인 newTaskFor 에 의해 반환되는 RunnableFuture 를 사용해,submit,invokeAny, 및 invokeAll 메소드를 구현합니다. 예를 들어,submit(Runnable) 의 구현에 의해 관련하는 RunnableFuture 가 작성되어 이것이 실행되어 결과가 돌려주어집니다. 서브 클래스는,FutureTask 이외의 RunnableFuture 구현을 돌려주도록,newTaskFor 메소드를 오버라이드(override) 할 수가 있습니다.
확장예. 여기에서는, 디폴트의 FutureTask 는 아니고 CustomTask 클래스를 사용해 ThreadPoolExecutor 를 커스터마이즈 하는 클래스의 개략을 나타냅니다.
public class CustomThreadPoolExecutor extends ThreadPoolExecutor {
static class CustomTask<V> implements RunnableFuture<V> {...}
protected <V> RunnableFuture<V> newTaskFor(Callable<V> c) {
return new CustomTask<V>(c);
}
protected <V> RunnableFuture<V> newTaskFor(Runnable r, V v) {
return new CustomTask<V>(r, v);
}
// ... add constructors, etc.
}
| 생성자 의 개요 | |
|---|---|
AbstractExecutorService ()
|
|
| 메소드의 개요 | ||
|---|---|---|
|
invokeAll (Collection <? extends Callable <T>> tasks)
지정된 태스크를 실행해, 모두 완료하면(자), 상태와 결과를 포함한 Future 의 리스트를 돌려줍니다. |
|
|
invokeAll (Collection <? extends Callable <T>> tasks,
long timeout,
TimeUnit unit)
지정된 태스크를 실행해, 모든 것이 완료할까 마감 시간이 되는지, 그 어느쪽이든가 최초로 발생한 시점에서, 상태와 결과를 포함한 Future 의 리스트를 돌려줍니다. |
|
|
invokeAny (Collection <? extends Callable <T>> tasks)
지정된 태스크를 실행해, 예외를 throw 하지 않고 정상적으로 완료한 태스크가 존재하는 경우는, 그 결과를 돌려줍니다. |
|
|
invokeAny (Collection <? extends Callable <T>> tasks,
long timeout,
TimeUnit unit)
지정된 태스크를 실행해, 타임 아웃이 경과하기 전에 예외를 throw 하지 않고 정상적으로 완료한 태스크가 존재하는 경우는, 그 결과를 돌려줍니다. |
|
protected
|
newTaskFor (Callable <T> callable)
지정된 호출 가능 태스크의 RunnableFuture 를 돌려줍니다. |
|
protected
|
newTaskFor (Runnable runnable,
T value)
지정된 실행 가능 태스크 및 디폴트 값의 RunnableFuture 를 돌려줍니다. |
|
|
submit (Callable <T> task)
값을 돌려주는 실행용 태스크를 송신해, 보류 상태의 태스크 결과를 나타내는 Future 를 돌려줍니다. |
|
Future <? > |
submit (Runnable task)
실행용의 Runnable 태스크를 송신해, 그 태스크를 나타내는 Future 를 돌려줍니다. |
|
|
submit (Runnable task,
T result)
실행용의 Runnable 태스크를 송신해, 그 태스크를 나타내는 Future 를 돌려줍니다. |
|
| 클래스 java.lang. Object 로부터 상속된 메소드 |
|---|
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
| 인터페이스 java.util.concurrent. ExecutorService 로부터 상속된 메소드 |
|---|
awaitTermination , isShutdown , isTerminated , shutdown , shutdownNow |
| 인터페이스 java.util.concurrent. Executor 로부터 상속된 메소드 |
|---|
execute |
| 생성자 의 상세 |
|---|
public AbstractExecutorService()
| 메소드의 상세 |
|---|
protected <T> RunnableFuture <T> newTaskFor(Runnable runnable,
T value)
runnable - 랩 되는 실행 가능 태스크value - 반환되는 Future 의 디폴트 값
protected <T> RunnableFuture <T> newTaskFor(Callable <T> callable)
callable - 랩 되는 호출 가능 태스크
public Future <? > submit(Runnable task)
ExecutorService 의 기술:
ExecutorService 내의 submit task - 송신하는 태스크
public <T> Future <T> submit(Runnable task,
T result)
ExecutorService 의 기술:
ExecutorService 내의 submit task - 송신하는 태스크result - 돌려주는 결과
public <T> Future <T> submit(Callable <T> task)
ExecutorService 의 기술:태스크의 대기를 즉시 블록 하는 경우는,result = exec.submit(aCallable). get(); 의 형식의 구축을 사용할 수 있습니다.
주:Executors 클래스에는, 크로 전기밥통을 닮은 다른 일반 객체를 변환할 수 있는 메소드 세트가 포함됩니다. 예를 들어,PrivilegedAction 를 Callable 형식으로 변환해, 송신 가능하게 할 수가 있습니다.
ExecutorService 내의 submit task - 송신하는 태스크
public <T> T invokeAny(Collection <? extends Callable <T>> tasks)
throws InterruptedException ,
ExecutionException
ExecutorService 의 기술:
ExecutorService 내의 invokeAny tasks - 태스크의 컬렉션
InterruptedException - 대기중에 인터럽트가 발생했을 경우
ExecutionException - 정상적으로 완료한 태스크가 없는 경우
public <T> T invokeAny(Collection <? extends Callable <T>> tasks,
long timeout,
TimeUnit unit)
throws InterruptedException ,
ExecutionException ,
TimeoutException
ExecutorService 의 기술:
ExecutorService 내의 invokeAny tasks - 태스크의 컬렉션timeout - 대기하는 최장 시간unit - timeout 인수의 시간 단위
InterruptedException - 대기중에 인터럽트가 발생했을 경우
ExecutionException - 정상적으로 완료한 태스크가 없는 경우
TimeoutException - 태스크가 정상적으로 완료하기 전에, 지정된 타임 아웃이 경과했을 경우
public <T> List <Future <T>> invokeAll(Collection <? extends Callable <T>> tasks)
throws InterruptedException
ExecutorService 의 기술:Future.isDone() 는 true 가 됩니다. 「완료했다」태스크는, 일반적으로 대로나 예외를 throw 하는 것으로 종료하고 있습니다. 오퍼레이션의 진행중에, 지정된 컬렉션이 변경되었을 경우, 이 메소드의 결과는 정의되고 있지 않습니다.
ExecutorService 내의 invokeAll tasks - 태스크의 컬렉션
InterruptedException - 대기중에 인터럽트가 발생했을 경우. 이 경우, 미완료의 태스크는 삭제된다.
public <T> List <Future <T>> invokeAll(Collection <? extends Callable <T>> tasks,
long timeout,
TimeUnit unit)
throws InterruptedException
ExecutorService 의 기술:Future.isDone() 는 true 가 됩니다. 반환된 시점에서, 완료하고 있지 않는 태스크는 삭제됩니다. 「완료했다」태스크는, 일반적으로 대로나 예외를 throw 하는 것으로 종료하고 있습니다. 오퍼레이션의 진행중에, 지정된 컬렉션이 변경되었을 경우, 이 메소드의 결과는 정의되고 있지 않습니다.
ExecutorService 내의 invokeAll tasks - 태스크의 컬렉션timeout - 대기하는 최장 시간unit - timeout 인수의 시간 단위
InterruptedException - 대기중에 인터럽트가 발생했을 경우. 이 경우, 미완료의 태스크는 삭제된다
|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 전의 클래스 다음의 클래스 | 프레임 있어 프레임 없음 | |||||||||
| 개요: 상자 | 필드 | 생성자 | 메소드 | 상세: 필드 | 생성자 | 메소드 | |||||||||
Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy 도 참조해 주세요.