Korysam15 / cs414-f17-301-GenericTeamName

This repository will provide a working solution to implement the game known as Banqi.
3 stars 1 forks source link

P4: Feedback #39

Open lmorenoc opened 6 years ago

lmorenoc commented 6 years ago
Pflagert commented 6 years ago

Regarding "edu.colostate.cs.cs414.p4.console.AbstractConsole.accept(). This method unconditionally invokes itself. This would seem to indicate an infinite recursive loop that will result in a stack overflow."

This infinite recursive loop is intentional (definitely not good practice). However, there is really only one condition that will trigger the recursion and that's when the server's JVM process terminated. Thanks to the blocking nature of "readLine()" it is unlikely that this method will result in a stack overflow, but I agree that this method needs improvement.

The recursive nature of this method is to allow for a potential new command "connect-to-server". Which should allow a user to switch between servers (especially useful in the event of one server disconnecting).

If the accept() method does not recurse when a server goes down, then the user's process will terminate abruptly (as this method is performing the final instructions).

What would be the best way to address this issue?