Esempio n. 1
0
        public void Connect(object credentials)
        {
            ChannelFactory <IMBeanServerContract> factory = new ChannelFactory <IMBeanServerContract>(
                _configurationName,
                new EndpointAddress(_serviceUrl));

            _proxy        = factory.CreateChannel();
            _connectionId = Guid.NewGuid();
            _connection   = new ServiceModelMBeanServerConnection(_proxy);
        }
Esempio n. 2
0
        public void Close()
        {
            ICommunicationObject co = (ICommunicationObject)_proxy;

            if (co != null)
            {
                try
                {
                    if (co.State != CommunicationState.Faulted)
                    {
                        co.Close();
                    }
                    else
                    {
                        co.Abort();
                    }
                }
                catch (CommunicationException)
                {
                    co.Abort();
                }
                catch (TimeoutException)
                {
                    co.Abort();
                }
                catch (Exception)
                {
                    co.Abort();
                    throw;
                }
                finally
                {
                    _proxy      = null;
                    _connection = null;
                }
            }
        }
 public void Close()
 {
     ICommunicationObject co = (ICommunicationObject) _proxy;
      if (co != null)
      {
     try
     {
        if (co.State != CommunicationState.Faulted)
        {
           co.Close();
        }
        else
        {
           co.Abort();
        }
     }
     catch (CommunicationException)
     {
        co.Abort();
     }
     catch (TimeoutException)
     {
        co.Abort();
     }
     catch (Exception)
     {
        co.Abort();
        throw;
     }
     finally
     {
        _proxy = null;
        _connection = null;
     }
      }
 }
 public void Connect(object credentials)
 {
     ChannelFactory<IMBeanServerContract> factory = new ChannelFactory<IMBeanServerContract>(
     _configurationName,
     new EndpointAddress(_serviceUrl));
      _proxy = factory.CreateChannel();
      _connectionId = Guid.NewGuid();
      _connection = new ServiceModelMBeanServerConnection(_proxy);
 }