Refactor: dispatch method of ResponseDispatcher is now unchecked and throws ResponseDispatchException
This commit is contained in:
+6
-1
@@ -30,9 +30,14 @@ public class ResponseDispatcher {
|
|||||||
* @throws InterruptedException if the thread is interrupted while waiting to enqueue the
|
* @throws InterruptedException if the thread is interrupted while waiting to enqueue the
|
||||||
* primitive response
|
* primitive response
|
||||||
*/
|
*/
|
||||||
public void dispatch(Response response) throws InterruptedException {
|
public void dispatch(Response response) {
|
||||||
PrimitiveResponse primitiveResponse = ResponseEncoder.encode(response);
|
PrimitiveResponse primitiveResponse = ResponseEncoder.encode(response);
|
||||||
Session session = sessionManager.getSessionById(response.getSessionId());
|
Session session = sessionManager.getSessionById(response.getSessionId());
|
||||||
|
try {
|
||||||
session.getResponseQueue().put(primitiveResponse);
|
session.getResponseQueue().put(primitiveResponse);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
throw new ResponseDispatchException("Interrupted while dispatching response", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user