6645197: (so) Timed read with socket adaptor throws ClosedSelectorException if temporary selector GC'ed

Temporary selector for timeout is not protected from possilbe GC when used first time

Reviewed-by: alanb
This commit is contained in:
Xueming Shen 2008-06-27 08:32:30 -07:00
parent 827decba87
commit 84b91226e3

View File

@ -142,11 +142,10 @@ class Util {
|| ((sel = selWrapper.get()) == null)
|| (sel.provider() != sc.provider())) {
sel = sc.provider().openSelector();
localSelector.set(new SoftReference<SelectorWrapper>(
new SelectorWrapper(sel)));
} else {
localSelectorWrapper.set(selWrapper);
selWrapper = new SelectorWrapper(sel);
localSelector.set(new SoftReference<SelectorWrapper>(selWrapper));
}
localSelectorWrapper.set(selWrapper);
return sel;
}