Changeset 790 for trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs
- Timestamp:
- 11/20/08 15:41:25 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs
r782 r790 32 32 using System.Security.Policy; 33 33 using System.Security; 34 using HeuristicLab.Hive.Client.Communication; 35 using BO = HeuristicLab.Hive.Contracts.BusinessObjects; 34 36 35 37 … … 58 60 } 59 61 60 public void Start() { 61 Heartbeat beat = new Heartbeat(); 62 beat.Interval = 5000; 63 beat.StartHeartbeat(); 62 public void Start() { 63 Heartbeat beat = new Heartbeat { Interval = 5000 }; 64 beat.StartHeartbeat(); 65 66 BO.Client clientInfo = new BO.Client { ClientId = Guid.NewGuid() }; 67 68 ClientCommunicatorClient clientCommunicator = ServiceLocator.GetClientCommunicator(); 69 clientCommunicator.LoginCompleted += new EventHandler<LoginCompletedEventArgs>(ClientCommunicator_LoginCompleted); 70 clientCommunicator.LoginAsync(clientInfo); 64 71 65 72 MessageQueue queue = MessageQueue.GetInstance(); 66 queue.AddMessage(MessageContainer.MessageType.FetchJob); 73 queue.AddMessage(MessageContainer.MessageType.FetchJob); 67 74 while (true) { 68 75 MessageContainer container = queue.GetMessage(); 69 76 Debug.WriteLine("Main loop received this message: " + container.Message.ToString()); 70 Logging.GetInstance().Info(this.ToString(), container.Message.ToString()); 77 Logging.GetInstance().Info(this.ToString(), container.Message.ToString()); 71 78 DetermineAction(container); 72 79 } 80 } 81 82 void ClientCommunicator_LoginCompleted(object sender, LoginCompletedEventArgs e) { 83 if (e.Result.Success) { 84 Logging.GetInstance().Info(this.ToString(), "Login completed to Hive Server @ " + DateTime.Now); 85 Status.LoginTime = DateTime.Now; 86 Status.LoggedIn = true; 87 } else 88 Logging.GetInstance().Error(this.ToString(), e.Result.StatusMessage); 73 89 } 74 90 … … 77 93 if (sandboxed) { 78 94 pset = new PermissionSet(PermissionState.None); 79 pset.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution)); 95 pset.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution)); 80 96 } else { 81 97 pset = new PermissionSet(PermissionState.Unrestricted); … … 85 101 //Temp Fix! 86 102 setup.PrivateBinPath = "plugins"; 87 return System.AppDomain.CreateDomain("appD", AppDomain.CurrentDomain.Evidence, setup, pset, CreateStrongName(Assembly.GetExecutingAssembly())); 103 return System.AppDomain.CreateDomain("appD", AppDomain.CurrentDomain.Evidence, setup, pset, CreateStrongName(Assembly.GetExecutingAssembly())); 88 104 89 105 } … … 97 113 Debug.WriteLine("-- Job Aborted Message received"); 98 114 break; 99 100 115 116 101 117 case MessageContainer.MessageType.RequestSnapshot: 102 118 engines[container.JobId].RequestSnapshot(); … … 105 121 engines[container.JobId].GetSnapshot(); 106 122 break; 107 108 123 124 109 125 case MessageContainer.MessageType.FetchJob: 110 126 bool sandboxed = true; 111 127 112 128 IJob job = CreateNewJob(); 113 114 AppDomain appDomain = CreateNewAppDomain( true);129 130 AppDomain appDomain = CreateNewAppDomain(false); 115 131 appDomains.Add(job.JobId, appDomain); 116 132 117 133 Executor engine = (Executor)appDomain.CreateInstanceAndUnwrap(typeof(Executor).Assembly.GetName().Name, typeof(Executor).FullName); 118 134 engine.Job = job; … … 132 148 } 133 149 } 134 150 135 151 /// <summary> 136 152 /// Simulator Class for new Jobs. will be replaced with fetching Jobs from the Interface
Note: See TracChangeset
for help on using the changeset viewer.