|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jruby.util.io.SelectorPool
public class SelectorPool
This is a simple implementation of a hard-referenced java.nio.channels.Selector
pool. It is intended to allow us to reuse a small pool of selectors rather
than creating them new for each use (which causes problem for Windows and
its socket-per-selector impl) or saving them per-thread (which causes
problems when there are many not-quite-dead threads in flight.
The selectors are kept open in the pool and you should call cleanup()
for releasing selectors.
Constructor Summary | |
---|---|
SelectorPool()
|
Method Summary | |
---|---|
void |
cleanup()
Clean up a pool. |
java.nio.channels.Selector |
get()
Get a selector from the pool (or create a new one). |
void |
put(java.nio.channels.Selector selector)
Put a selector back into the pool. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SelectorPool()
Method Detail |
---|
public java.nio.channels.Selector get() throws java.io.IOException
java.io.IOException
- if there's a problem opening a new selectorpublic void put(java.nio.channels.Selector selector)
selector
- the selector to put backpublic void cleanup()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |