Beispiel #1
0
 public virtual void InitializeRemotingObject(object obj)
 {
     if (obj == null)
     {
         throw new ArgumentNullException(nameof(obj));
     }
     this.remotingObject       = obj;
     this.remotingObjectScheme = new RemotingObjectScheme(this.remotingObjectConfiguration, obj.GetType());
 }
Beispiel #2
0
        public bool Close()
        {
            if (closed)
            {
                return(false);
            }
            closed = true;

            Connection.Close();

            lock (requestsMutex)
            {
                foreach (var pair in requests)
                {
                    pair.Value.SetError(new RemotingException($"{this.GetType().Name} was closed prematurely!"));
                }

                requests.Clear();
            }

            try
            {
                OnClose();
            }
            catch (Exception e)
            {
                logger.Error($"Unhandled exception on {this.GetType().Name}.{nameof(OnClose)}: {e}");
            }


            this.remotingObject       = null;
            this.remotingObjectScheme = null;

            this.logger.Debug($"Closed!");

            return(true);
        }
Beispiel #3
0
 public virtual void DeleteRemotingObject()
 {
     this.remotingObject       = null;
     this.remotingObjectScheme = null;
 }