/** * Performs the work of the client update thread. Creates a {@code ServerSocket} and waits for the * server to connect to it. */ @Override public void run() { EntryLogger.setSource(this.serverId, "RI"); boolean addedListener = false; try { if (system instanceof InternalDistributedSystem) { ((InternalDistributedSystem) system).addDisconnectListener(this); addedListener = true; } if (!waitForCache()) { logger.warn("{}: no cache (exiting)", this); return; } processMessages(); } catch (CancelException ignore) { // just bail } finally { if (addedListener) { ((InternalDistributedSystem) system).removeDisconnectListener(this); } this.close(); EntryLogger.clearSource(); } }