changeset 88:344490bdebb8

8071466: UART timeout feature is disabled by default Summary: DIO1.0.1 clarifies that UART timeout feature is disabled by default. It is necessary to update implementation to reflect this requirement and remove jdk.dio.uart.timeout property Reviewed-by: jld Contributed-by: alexey.karaksin@oracle.com
author amironov
date Mon, 26 Jan 2015 17:34:34 +0300
parents c6c932e7ba18
children 1a63316a2a5d
files src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java
diffstat 1 files changed, 7 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java	Fri Jan 23 13:33:49 2015 +0400
+++ b/src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java	Mon Jan 26 17:34:34 2015 +0300
@@ -85,7 +85,7 @@
     private Hashtable<Integer, UARTEventListener> eventListeners;
 
     private int receiveTriggerLevel;
-    private int inputTimeout;
+    private int inputTimeout;//init value 0 means timeout is desabled
     private Timer receiveTimer;
 
 
@@ -122,8 +122,6 @@
             );
         }
 
-        inputTimeout = Configuration.getNonNegativeIntProperty("jdk.dio.uart.inputTimeout", 2000);
-
         openUARTByConfig0(devName, cfg.getBaudRate(), cfg.getStopBits(), cfg.getFlowControlMode(),
                                    cfg.getDataBits(), cfg.getParity(), mode == DeviceManager.EXCLUSIVE);
 
@@ -678,12 +676,12 @@
                 int readRes = read0(dst);
                 shiftBufferPosition(dst, ret + readRes);
                 if (dst.hasRemaining()) {
-                    if (!UARTEventHandler.getInstance().isDispatchThread()) {
-                    /*
-                     * the user calls read() from the event callback,
-                     * exit immediatelly,
-                     * else read with timeout
-                     */
+                    if (!UARTEventHandler.getInstance().isDispatchThread() && inputTimeout > 0) {
+                        /*
+                         * the user calls read() from the event callback, or inputTimeout is 0
+                         * exit immediatelly,
+                         * else read with timeout
+                         */
                         startReading(dst, getLocalInputRoundListener());
                         synchronized(synchReadLock){
                             try{