public function cleanup()
    {
        $this->cleaned = true;
        $this->remoteMethods = [];
        $this->localMethods = [];
        $this->persistentCallbacks = [];
        $this->callbacks = [];
    }