changeset 126:dc977f532a4a

8076148: INPUT_DATA_AVAILABLE event and timeout 8075945: [UART] InputRoundListener is affected by timeout Summary: Get rid of timer setup for INPUT_DATA_AVAILABLE subscription Reviewed-by: alkonsta
author snazarki
date Fri, 27 Mar 2015 12:28:09 +0300
parents 4ea5718a30d3
children 21dba9ff250c
files src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java
diffstat 1 files changed, 1 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java	Tue Mar 24 11:29:20 2015 +0300
+++ b/src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java	Fri Mar 27 12:28:09 2015 +0300
@@ -68,7 +68,6 @@
 
     private int receiveTriggerLevel;
     private int inputTimeout = Integer.MAX_VALUE;//timeout is disabled
-    private Timer receiveTimer;
 
 
     UARTImpl(DeviceDescriptor<UART> dscr, int mode)
@@ -130,29 +129,6 @@
             };
     }
 
-    private void startReceiveTimer(){
-
-        if(receiveTimer != null){
-            receiveTimer.cancel();
-        }
-        receiveTimer = new Timer();
-        receiveTimer.schedule(new TimerTask(){
-                                            @Override
-                                            public void run() {
-                                            try{
-                                                UARTEventHandler.getInstance().sendTimeoutEvent(getHandle().getNativeHandle());
-                                            }catch(Exception e){
-                                                //do nothing
-                                            }
-                                        }
-                                   },inputTimeout);
-    }
-
-    private void stopReceiveTimer(){
-        if(receiveTimer != null){
-            receiveTimer.cancel();
-        }
-    }
 
     private boolean isAlphaNumerical(char ch) {
         if ((('a' <= ch && ch <= 'z') ||
@@ -213,16 +189,9 @@
         UARTEventListener listener = eventListeners.get(event);
         if (listener != null){
             try{
-                if(event == UARTEvent.INPUT_DATA_AVAILABLE){
-                    stopReceiveTimer();
-                }
                 UARTEvent uartEvent = new UARTEvent(this, event);
                 listener.eventDispatched(uartEvent);
-                if(event == UARTEvent.INPUT_DATA_AVAILABLE){
-                    startReceiveTimer();
-                }
-            }
-            catch(Exception e){
+            } catch(Throwable e){
                 //do nothing
             }
         }
@@ -445,9 +414,6 @@
         }else{
              eventListeners.put(eventId, listener);
              subscribe(eventId);
-             if(eventId == UARTEvent.INPUT_DATA_AVAILABLE && inputTimeout < Integer.MAX_VALUE){
-                startReceiveTimer();
-             }
         }
     }