From 38d51ebeb1bbf4b154d326036a7d0b8a73d57b09 Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 7 Mar 2016 00:00:27 +0100 Subject: [PATCH] Updated object pool to new API --- README.md | 2 +- src/dorkbox/inputConsole/InputConsole.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8f0be94..e078d83 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ This project is **kept in sync** with the utilities library, so "jar hell" is no com.dorkbox InputConsole - 2.1 + 2.2 ``` diff --git a/src/dorkbox/inputConsole/InputConsole.java b/src/dorkbox/inputConsole/InputConsole.java index 3c59572..ca7d970 100644 --- a/src/dorkbox/inputConsole/InputConsole.java +++ b/src/dorkbox/inputConsole/InputConsole.java @@ -92,7 +92,7 @@ class InputConsole { */ public static String getVersion() { - return "2.1"; + return "2.2"; } /** @@ -179,7 +179,7 @@ class InputConsole { e.printStackTrace(); } } - this.pool = new ObjectPool(new ByteBuffer2Poolable(), readers2); + this.pool = ObjectPool.Blocking(new ByteBuffer2Poolable(), readers2); String type = System.getProperty(TerminalType.TYPE, TerminalType.AUTO).toLowerCase(); if ("dumb".equals(System.getenv("TERM"))) { @@ -293,7 +293,7 @@ class InputConsole { this.threadBufferCounter.set(bufferCounter); try { - buffer = this.pool.take(); + buffer = this.pool.takeInterruptibly(); buffer.clear(); } catch (InterruptedException e) { logger.error("Interrupted while receiving buffer from pool."); @@ -352,7 +352,7 @@ class InputConsole { if (this.readLineBuff.get() == null) { ByteBuffer2 buffer; try { - buffer = this.pool.take(); + buffer = this.pool.takeInterruptibly(); } catch (InterruptedException e) { logger.error("Interrupted while receiving buffer from pool."); buffer = pool.newInstance(); @@ -387,7 +387,7 @@ class InputConsole { buffer.clearSecure(); this.readLineBuffers.remove(buffer); - this.pool.release(buffer); + this.pool.put(buffer); this.readLineBuff.set(null); return readChars;