code: public void registerDestructionCallback(String name, Runnable callback) {
  		synchronized (getSessionMutex()) {
  			if (isSessionCompleted()) {
  				throw new IllegalStateException(
  						"Session id=" + getWebSocketSessionId() + " already completed");
  			}
  			setAttribute(DESTRUCTION_CALLBACK_NAME_PREFIX + name, callback);
  		}
  	}
docs: Register a callback to execute on destruction of the specified attribute. The
  callback is executed when the session is closed.
  @param name the name of the attribute to register the callback for
  @param callback the destruction callback to be executed