Skip to content

Commit

Permalink
JAMES-1954 Solve IntelliJ warning in CommandDispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
chibenwa committed Mar 13, 2017
1 parent 76f0f5b commit 381f2d7
Showing 1 changed file with 7 additions and 12 deletions.
Expand Up @@ -179,17 +179,15 @@ protected Response dispatchCommandHandlers(Session session, Request request) {
} }
List<CommandHandler<Session>> commandHandlers = getCommandHandlers(request.getCommand(), session); List<CommandHandler<Session>> commandHandlers = getCommandHandlers(request.getCommand(), session);
// fetch the command handlers registered to the command // fetch the command handlers registered to the command
Iterator<CommandHandler<Session>> handlers = commandHandlers.iterator();

for (CommandHandler<Session> commandHandler : commandHandlers) {
while (handlers.hasNext()) {
final long start = System.currentTimeMillis(); final long start = System.currentTimeMillis();
CommandHandler<Session> cHandler = handlers.next(); Response response = commandHandler.onCommand(session, request);
Response response = cHandler.onCommand(session, request);
if (response != null) { if (response != null) {
long executionTime = System.currentTimeMillis() - start; long executionTime = System.currentTimeMillis() - start;


// now process the result handlers // now process the result handlers
response = executeResultHandlers(session, response, executionTime, cHandler, rHandlers.iterator()); response = executeResultHandlers(session, response, executionTime, commandHandler, rHandlers.iterator());
if (response != null) { if (response != null) {
return response; return response;
} }
Expand Down Expand Up @@ -223,7 +221,7 @@ public void onResponse(FutureResponse response) {
// just return the new FutureResponse which will get notified once its ready // just return the new FutureResponse which will get notified once its ready
return futureResponse; return futureResponse;
} else { } else {
response = resultHandlers.next().onResponse(session, response, executionTime, (CommandHandler<Session>) cHandler); response = resultHandlers.next().onResponse(session, response, executionTime, cHandler);


// call the next ResultHandler // call the next ResultHandler
return executeResultHandlers(session, response, executionTime, cHandler, resultHandlers); return executeResultHandlers(session, response, executionTime, cHandler, resultHandlers);
Expand All @@ -233,14 +231,11 @@ public void onResponse(FutureResponse response) {
} }
/** /**
* Parse the line into a {@link Request} * Parse the line into a {@link Request}
* *
* @param session
* @param line
* @return request
* @throws Exception * @throws Exception
*/ */
protected Request parseRequest(Session session, ByteBuffer buffer) throws Exception { protected Request parseRequest(Session session, ByteBuffer buffer) throws Exception {
String curCommandName = null; String curCommandName;
String curCommandArgument = null; String curCommandArgument = null;
byte[] line; byte[] line;
if (buffer.hasArray()) { if (buffer.hasArray()) {
Expand Down

0 comments on commit 381f2d7

Please sign in to comment.