Updated object pool to new API
This commit is contained in:
parent
452e5bb5c0
commit
38d51ebeb1
@ -37,7 +37,7 @@ This project is **kept in sync** with the utilities library, so "jar hell" is no
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.dorkbox</groupId>
|
<groupId>com.dorkbox</groupId>
|
||||||
<artifactId>InputConsole</artifactId>
|
<artifactId>InputConsole</artifactId>
|
||||||
<version>2.1</version>
|
<version>2.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class InputConsole {
|
|||||||
*/
|
*/
|
||||||
public static
|
public static
|
||||||
String getVersion() {
|
String getVersion() {
|
||||||
return "2.1";
|
return "2.2";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -179,7 +179,7 @@ class InputConsole {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.pool = new ObjectPool<ByteBuffer2>(new ByteBuffer2Poolable(), readers2);
|
this.pool = ObjectPool.Blocking(new ByteBuffer2Poolable(), readers2);
|
||||||
|
|
||||||
String type = System.getProperty(TerminalType.TYPE, TerminalType.AUTO).toLowerCase();
|
String type = System.getProperty(TerminalType.TYPE, TerminalType.AUTO).toLowerCase();
|
||||||
if ("dumb".equals(System.getenv("TERM"))) {
|
if ("dumb".equals(System.getenv("TERM"))) {
|
||||||
@ -293,7 +293,7 @@ class InputConsole {
|
|||||||
this.threadBufferCounter.set(bufferCounter);
|
this.threadBufferCounter.set(bufferCounter);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
buffer = this.pool.take();
|
buffer = this.pool.takeInterruptibly();
|
||||||
buffer.clear();
|
buffer.clear();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
logger.error("Interrupted while receiving buffer from pool.");
|
logger.error("Interrupted while receiving buffer from pool.");
|
||||||
@ -352,7 +352,7 @@ class InputConsole {
|
|||||||
if (this.readLineBuff.get() == null) {
|
if (this.readLineBuff.get() == null) {
|
||||||
ByteBuffer2 buffer;
|
ByteBuffer2 buffer;
|
||||||
try {
|
try {
|
||||||
buffer = this.pool.take();
|
buffer = this.pool.takeInterruptibly();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
logger.error("Interrupted while receiving buffer from pool.");
|
logger.error("Interrupted while receiving buffer from pool.");
|
||||||
buffer = pool.newInstance();
|
buffer = pool.newInstance();
|
||||||
@ -387,7 +387,7 @@ class InputConsole {
|
|||||||
buffer.clearSecure();
|
buffer.clearSecure();
|
||||||
|
|
||||||
this.readLineBuffers.remove(buffer);
|
this.readLineBuffers.remove(buffer);
|
||||||
this.pool.release(buffer);
|
this.pool.put(buffer);
|
||||||
this.readLineBuff.set(null);
|
this.readLineBuff.set(null);
|
||||||
|
|
||||||
return readChars;
|
return readChars;
|
||||||
|
Loading…
Reference in New Issue
Block a user