code: private void removeFromWebContainer() {
          if (!Thread.holdsLock(terminated)) {
              throw new IllegalStateException();
          }
          synchronized (addRemoveLock) {
              //we'll either succeed or fail at the removal, but either
              //way we want to guarantee the tracker is closed.
              closeTracker();
              if (getDeployedModuleInfo() != null) {
                  //uninstall can only fail if the webcontainer has gone away..
                  //so we do not need to check if it returns true/false
                  //as in both cases, we wish to unregister, and declare we are
                  //undeployed.
                  installer.uninstallFromWebContainer(this);
                  unregister();
                  setState(State.UNDEPLOYED);
              }
          }
      }
docs: ONLY INVOKE WHILE HOLDING THE terminated lock