추상 선택 가능 채널
추상 선택 가능 채널 (AbstractSelectableChannel)
선택 가능한 채널을 위한 기본 구현 클래스예요. 채널 등록·등록 해제·닫기의 메커니즘을 처리합니다.
본문
AbstractSelectableChannel은 선택 가능한 채널을 위한 기본 구현 클래스예요.
public abstract class AbstractSelectableChannel extends SelectableChannel
이 클래스는 채널 등록(registration), 등록 해제(deregistration), 닫기(closing)의 메커니즘을 처리하는 메서드를 정의해요. 채널의 현재 차단 모드와 현재 선택 키 집합을 유지하고, SelectableChannel 명세를 구현하는 데 필요한 모든 동기화를 수행합니다.
public final SelectorProvider provider()
public final boolean isRegistered()
public final SelectionKey keyFor(Selector sel)
public final SelectionKey register(Selector sel, int ops, Object att) throws ClosedChannelException
public final boolean isBlocking()
public final Object blockingLock()
public final SelectableChannel configureBlocking(boolean block) throws IOException
protected final void implCloseChannel() throws IOException
protected abstract void implCloseSelectableChannel() throws IOException
protected abstract void implConfigureBlocking(boolean block) throws IOException
여기 정의된 protected 추상 메서드(implCloseSelectableChannel(), implConfigureBlocking())를 구현할 때는 같은 연산을 수행할 수 있는 다른 스레드에 대해 동기화할 필요가 없어요. provider(), isRegistered(), register() 등은 final로 고정되어 있어 채널 등록 메커니즘이 일관되게 유지됩니다.