Example #1
0
 /// <summary>
 /// Registers a service instance with a custom interface name.
 /// </summary>
 /// <param name="service">Service instance.</param>
 /// <param name="serviceName">Service interface name.</param>
 public void RegisterService(IRpcServiceStub service, string serviceName)
 {
     this.log.InfoFormat(
         "Registered service stub '{0}' with name '{1}'",
         service.GetType().AssemblyQualifiedName,
         serviceName);
     this.objectManager.RegisterService(service, serviceName);
 }
Example #2
0
        public void RegisterService(IRpcServiceStub service, string serviceName)
        {
            if (service == null)
            {
                throw new ArgumentNullException("service");
            }

            if (serviceName == null)
            {
                throw new ArgumentNullException("serviceName");
            }

            if (!this.services.TryAdd(serviceName, service))
            {
                throw new ArgumentException("An element with the same key already exists.", "serviceName");
            }
        }
Example #3
0
        public void RegisterService(IRpcServiceStub service, string serviceName)
        {
            if (service == null)
            {
                throw new ArgumentNullException("service");
            }

            if (serviceName == null)
            {
                throw new ArgumentNullException("serviceName");
            }

            if (this.services.ContainsKey(serviceName))
            {
                throw new DuplicateNameException("Service with the same name alrady registered.");
            }

            this.services[serviceName] = this.RegisterInstance(service);
        }
Example #4
0
        public ulong RegisterInstance(IRpcServiceStub instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }

            ulong objectId;

            lock (this.lastObjectIdLock)
            {
                objectId = ++this.lastObjectId;
            }

            this.instances[objectId] = instance;
            if (this.lastObjectId == 0)
            {
                throw new Exception("Object identifier space seems to run out.");
            }

            return(objectId);
        }