// from interface TableProvider
public void leaveTable (ClientObject caller, int tableId,
TableService.InvocationListener listener)
throws InvocationException
{
BodyObject leaver = (BodyObject)caller;
// look the table up
Table table = _tables.get(tableId);
if (table == null) {
throw new InvocationException(NO_SUCH_TABLE);
}
// if the table is in play, the user is not allowed to leave (he must leave the game)
if (table.inPlay()) {
throw new InvocationException(GAME_ALREADY_STARTED);
}
// request that the user be removed from the table
if (!table.clearPlayer(leaver.getVisibleName())) {
throw new InvocationException(NOT_AT_TABLE);
}
// remove the mapping from this user to the table
if (null == notePlayerRemoved(leaver.getOid(), leaver)) {
log.warning("No body to table mapping to clear?",
"leaver", leaver.who(), "table", table);
}
// either update or delete the table depending on whether or not we just removed the last
// player
if (table.isEmpty()) {