public void RegisterService(IXmppService service)
        {
            if (service == null) throw new ArgumentNullException("service");
            try
            {
                locker.EnterWriteLock();
                services.Add(service.Jid, service);
            }
            finally
            {
                locker.ExitWriteLock();
            }

            log.DebugFormat("Register XMPP service '{0}' on '{1}'", service.Name, service.Jid);

            try
            {
                service.OnRegister(serviceProvider);
            }
            catch (Exception error)
            {
                log.ErrorFormat("Error on register service '{0}' and it has will unloaded. {1}", service.Name, error);
                UnregisterService(service.Jid);                
                throw;
            }
        }
예제 #2
0
        public void RegisterService(IXmppService service)
        {
            if (service == null)
            {
                throw new ArgumentNullException("service");
            }
            try
            {
                locker.EnterWriteLock();
                services.Add(service.Jid, service);
            }
            finally
            {
                locker.ExitWriteLock();
            }

            log.DebugFormat("Register XMPP service '{0}' on '{1}'", service.Name, service.Jid);

            try
            {
                service.OnRegister(serviceProvider);
            }
            catch (Exception error)
            {
                log.ErrorFormat("Error on register service '{0}' and it has will unloaded. {1}", service.Name, error);
                UnregisterService(service.Jid);
                throw;
            }
        }
예제 #3
0
        public void RegisterService(IXmppService service)
        {
            if (service == null)
            {
                throw new ArgumentNullException("service");
            }

            services.TryAdd(service.Jid, service);

            log.DebugFormat("Register XMPP service '{0}' on '{1}'", service.Name, service.Jid);

            try
            {
                service.OnRegister(serviceProvider);
            }
            catch (Exception error)
            {
                log.ErrorFormat("Error on register service '{0}' and it will be unloaded. {1}", service.Name, error);
                UnregisterService(service.Jid);
                throw;
            }
        }