Exemplo n.º 1
0
        public IEnumerable <IModelTermProvider> Interrogate()
        {
            if (!File.Exists(PackagePath))
            {
                throw new FileNotFoundException("The file: " + Path.GetFileName(PackagePath) + " was not found in " + Path.GetDirectoryName(PackagePath) + ".");
            }

            string         domainName = Path.GetFileNameWithoutExtension(PackagePath);
            AppDomainSetup setupInfo  = new AppDomainSetup();

            setupInfo.ApplicationName = domainName;
            setupInfo.ApplicationBase = AppDomainBase;
            _appDomain = AppDomain.CreateDomain(domainName, AppDomain.CurrentDomain.Evidence, setupInfo);

            Type proxyType = typeof(PackageInterrogationProxy);

            _interrogationProxy = (PackageInterrogationProxy)_appDomain.CreateInstanceFrom(proxyType.Assembly.Location, proxyType.FullName).Unwrap();

            return(_interrogationProxy.Interrogate(PackagePath).Select(
                       termProvider => {
                System.Runtime.Remoting.Lifetime.ILease leaseObj = System.Runtime.Remoting.RemotingServices.GetLifetimeService((ProxyModelTermProvider)termProvider) as System.Runtime.Remoting.Lifetime.ILease;
                if (leaseObj != null)
                {
                    Sponsors.Add(new LifetimeSponsor(leaseObj));
                }

                return termProvider;
            }
                       ));
        }
Exemplo n.º 2
0
        public override System.Object InitializeLifetimeService()
        {
            long initialLeaseTime, sponsorshipTimeout, renewOnCallTime;

            initialLeaseTime   = SupportClass.AppSettings.Get("Lucene.Net.Remoting.Lifetime.initialLeaseTime", -1);
            sponsorshipTimeout = SupportClass.AppSettings.Get("Lucene.Net.Remoting.Lifetime.sponsorshipTimeout", -1);
            renewOnCallTime    = SupportClass.AppSettings.Get("Lucene.Net.Remoting.Lifetime.renewOnCallTime", -1);

            if ((initialLeaseTime == -1) || (sponsorshipTimeout == -1) || (renewOnCallTime == -1))
            {
                return(null);
            }
            else
            {
                System.Runtime.Remoting.Lifetime.ILease lease =
                    (System.Runtime.Remoting.Lifetime.ILease)base.InitializeLifetimeService();
                if (lease.CurrentState == System.Runtime.Remoting.Lifetime.LeaseState.Initial)
                {
                    lease.InitialLeaseTime   = System.TimeSpan.FromMinutes(initialLeaseTime);
                    lease.SponsorshipTimeout = System.TimeSpan.FromMinutes(sponsorshipTimeout);
                    lease.RenewOnCallTime    = System.TimeSpan.FromSeconds(renewOnCallTime);
                }
                return(lease);
            }
        }
 /// <summary>
 /// Renews the lease only if the remote proxy is loaded.
 /// </summary>
 /// <param name="lease">The <see cref="System.Runtime.Remoting.Lifetime.ILease"/> requesting renewal.</param>
 /// <returns>The new expiration time of the lease.</returns>
 public TimeSpan Renewal(System.Runtime.Remoting.Lifetime.ILease lease)
 {
     if (_SponsorHelper.IsLoaded)
     {
         return(lease.RenewOnCallTime);
     }
     return(TimeSpan.Zero);
 }
Exemplo n.º 4
0
 public override object InitializeLifetimeService()
 {
     System.Runtime.Remoting.Lifetime.ILease lease = base.InitializeLifetimeService() as System.Runtime.Remoting.Lifetime.ILease;
     if (lease != null)
     {
         lease.InitialLeaseTime = TimeSpan.Zero;
     }
     return(lease);
 }
Exemplo n.º 5
0
 public override object InitializeLifetimeService()
 {
     System.Runtime.Remoting.Lifetime.ILease lease = (System.Runtime.Remoting.Lifetime.ILease)base.InitializeLifetimeService();
     if (lease.CurrentState == System.Runtime.Remoting.Lifetime.LeaseState.Initial)
     {
         lease.InitialLeaseTime = TimeSpan.FromMinutes(30);
         lease.RenewOnCallTime  = TimeSpan.FromMinutes(30);
     }
     return(null);
 }
Exemplo n.º 6
0
 public override object InitializeLifetimeService()
 {
     System.Runtime.Remoting.Lifetime.ILease lease = (System.Runtime.Remoting.Lifetime.ILease)base.InitializeLifetimeService();
     if (lease.CurrentState == System.Runtime.Remoting.Lifetime.LeaseState.Initial)
     {
         lease.InitialLeaseTime   = TimeSpan.FromMinutes(1);
         lease.SponsorshipTimeout = TimeSpan.FromMinutes(2);
         lease.RenewOnCallTime    = TimeSpan.FromSeconds(2);
     }
     return(lease);
 }
Exemplo n.º 7
0
        public UserscriptHost(
            byte[] AssemblySerial,
            byte[] AssemblySymbolStoreSerial)
        {
            BeginZait = Bib3.Glob.StopwatchZaitMiliSictInt();

            this.AssemblySerial            = AssemblySerial;
            this.AssemblySymbolStoreSerial = AssemblySymbolStoreSerial;

            if (null == AssemblySerial)
            {
                return;
            }

            if (false)
            {
                //	Weege Probleme mit Debuge (Visual Studio Debugger überspringt Method in Dll) verzict auf AppDomain

                ScriptAppDomain = AppDomain.CreateDomain("UserScript.Instance[" + Ident.ToString() + "]");

                AssemblyLoaded = ScriptAppDomain.Load(AssemblySerial, AssemblySymbolStoreSerial);
            }
            else
            {
                AssemblyLoaded = System.Reflection.Assembly.Load(AssemblySerial, AssemblySymbolStoreSerial);
            }

            var MengeType = AssemblyLoaded.GetTypes();

            ScriptInterfaceType =
                MengeType
                .FirstOrDefaultNullable(PrädikaatTypeIstScriptInterface);

            if (null == ScriptInterfaceType)
            {
                return;
            }

            if (false)
            {
                //	Weege Probleme mit Debuge (Visual Studio Debugger überspringt Method in Dll) verzict auf AppDomain

                ScriptInterfaceWrapped = ScriptAppDomain.CreateInstance(AssemblyLoaded.FullName, ScriptInterfaceType.FullName);

                ScriptInterfaceLease = (System.Runtime.Remoting.Lifetime.ILease)ScriptInterfaceWrapped.InitializeLifetimeService();

                ScriptInterface = (IUserscript)ScriptInterfaceWrapped.Unwrap();
            }
            else
            {
                ScriptInterface = (IUserscript)Activator.CreateInstance(ScriptInterfaceType);
            }
        }
Exemplo n.º 8
0
        public override object InitializeLifetimeService()
        {
            System.Runtime.Remoting.Lifetime.ILease aLease
                = (System.Runtime.Remoting.Lifetime.ILease)base.InitializeLifetimeService();
            if (aLease.CurrentState == System.Runtime.Remoting.Lifetime.LeaseState.Initial)
            {
                // 不过期

                aLease.InitialLeaseTime   = TimeSpan.FromHours(1000);
                aLease.RenewOnCallTime    = TimeSpan.FromHours(1000);
                aLease.SponsorshipTimeout = TimeSpan.FromHours(1000);
            }
            return(aLease);
        }
Exemplo n.º 9
0
        public Lpp.Dns.DataMart.Model.IModelProcessor GetProcessor(Guid processorID)
        {
            log.Debug("Begin GetProcessor for ProcessorID: " + processorID.ToString("D"));

            Lpp.Dns.DataMart.Model.IModelProcessor processor = _loadProxy.GetProcessor(processorID);

            log.Debug("End GetProcessor for ProcessorID: " + processorID.ToString("D"));

            System.Runtime.Remoting.Lifetime.ILease leaseObj = System.Runtime.Remoting.RemotingServices.GetLifetimeService((MarshalByRefObject)processor) as System.Runtime.Remoting.Lifetime.ILease;
            if (leaseObj != null)
            {
                Sponsors.Add(new LifetimeSponsor(leaseObj));
            }

            return(processor);
        }
Exemplo n.º 10
0
 public static System.Reactive.Linq.IQbservable <TSource> Remotable <TSource>(this System.Reactive.Linq.IQbservable <TSource> source, System.Runtime.Remoting.Lifetime.ILease lease)
 {
     throw null;
 }