code: private void removeInstance() {
          // unregister client
          ClientRegistry ref = registry.get();
          if (ref != null) {
              ref.removeClient(this);
          } else {
              log.warn("Client registry reference was not accessable, removal failed");
              // TODO: attempt to lookup the registry via the global.clientRegistry
          }
      }
docs: Removes this instance from the client registry.