Experimental! Implement ISponsor in ScriptInstance

arthursv
Melanie 2009-08-07 21:30:21 +01:00
parent d10f157183
commit ad0d2fea20
1 changed files with 7 additions and 12 deletions

View File

@ -53,7 +53,7 @@ using OpenSim.Region.ScriptEngine.Interfaces;
namespace OpenSim.Region.ScriptEngine.Shared.Instance
{
public class ScriptInstance : IScriptInstance
public class ScriptInstance : MarshalByRefObject, IScriptInstance, ISponsor
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -96,7 +96,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
private string m_CurrentState = String.Empty;
private UUID m_RegionID = UUID.Zero;
private ScriptSponsor m_ScriptSponsor;
private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
m_LineMap;
@ -261,9 +260,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
Path.GetFileNameWithoutExtension(assembly),
"SecondLife.Script");
m_ScriptSponsor = new ScriptSponsor();
ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
lease.Register(m_ScriptSponsor);
lease.Register(this);
}
catch (Exception)
{
@ -365,14 +363,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
}
}
~ScriptInstance()
{
m_Script.Close();
m_ScriptSponsor.Close();
ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
lease.Unregister(m_ScriptSponsor);
}
public void Init()
{
if (!m_startOnInit) return;
@ -1016,5 +1006,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{
return true;
}
public TimeSpan Renewal(ILease lease)
{
return lease.InitialLeaseTime;
}
}
}