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;
            }
        }
Beispiel #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;
            }
        }
Beispiel #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;
            }
        }