goelrajat opened a new pull request #143: KNOX-1997: Adding changes to buffer 
messages from backend in onMessag…
URL: https://github.com/apache/knox/pull/143
 
 
   ## What changes were proposed in this pull request?
   
   Adding changes to buffer messages from backend in onMessageText() if 
frontend session related data structures have not been setup i.e. remote is 
null. Message buffer will be flushed when remote is set by other thread 
executing onWebSocketConnect() API. To synchronize reading/flushing buffer, 
added a lock
   
   ## How was this patch tested?
   
   Race condition was easily reproducible with our service UI and backedn when 
integrated with Knox. After this change, I no longer see the 
NullPointerException. Since this is a race condition, its hard to add a unit 
test case for it. In my case, the race condition was getting hit when service 
backend used to send a data frame immediately after opening a websocket 
connection but Knox hadn't setup the connection related data structures. So I 
added a test case for scenario where send a message to frontend while opening a 
websocket.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to