@Override public void notifyResult(AuctionItem item) { if (registeredUsers.containsKey(item.getCreator_id())) { RMIClientIntf creator = registeredUsers.get(item.getCreator_id()); try { creator.callBack("Your Auction has produced the following results :\n "); creator.callBack(item.getResult()); } catch (RemoteException e) { System.out.println("Creator no longer online\n"); } } else { System.out.println("Creator id does not exist\n"); } // Normally an auction with no creator registered should not exist but since this is a // simplified implementation // We allow bids on auctions with no creator (usually the initialised ones) for testing // purposes. if (item.numberOfBids() != 0) { System.out.println("Notifying bidders"); Iterator<Bid> it = item.getBidders(); while (it.hasNext()) { Bid bidder = it.next(); if (registeredUsers.containsKey(bidder.getUserId())) { RMIClientIntf client = registeredUsers.get(bidder.getUserId()); try { client.callBack(item.getResult()); } catch (RemoteException e) { System.out.println("Bidder with id " + bidder.getUserId() + " no longer online\n"); } } else { System.out.println("User id does not exist\n"); } } } }