Changeset 2745
- Timestamp:
- 7/2/2012 2:02:49 AM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/EraserService/Eraser.Manager/RemoteExecutor.cs
r2742 r2745 28 28 using System.Runtime.Remoting.Channels; 29 29 using System.Runtime.Remoting.Channels.Ipc; 30 using System.Runtime.Serialization.Formatters; 30 31 using System.Security.Principal; 31 //using System.Security.AccessControl;32 32 33 33 namespace Eraser.Manager … … 69 69 70 70 71 // Expose an object for remote calls. 72 RemotingConfiguration.RegisterWellKnownServiceType( 73 typeof(DirectExecutor), ServerName, 74 System.Runtime.Remoting.WellKnownObjectMode.Singleton); 71 //Expose the DirectExecutor object for remote calls. 72 RemotingServices.Marshal(this, ServerName); 75 73 74 //Expose a factory for Task objects. 75 RemotingConfiguration.RegisterActivatedServiceType(typeof(Task)); 76 76 } 77 77 … … 83 83 84 84 /// <summary> 85 /// The RemoteExecutor Serverclass is the client half required for remote execution85 /// The RemoteExecutorClient class is the client half required for remote execution 86 86 /// of tasks, sending requests to the server running on the local computer. 87 87 /// </summary> 88 /// <remarks>If a RemoteExecutorClient object has been constructed, all Task objects can 89 /// only be used with RemoteExecutorServer. 90 /// 91 /// TODO: For this restriction to be lifted, every Executor needs to have a factory method 92 /// to get the Task type for each executor. 93 /// See http://msdn.microsoft.com/en-us/library/ff650208.aspx 94 /// </remarks> 88 95 public class RemoteExecutorClient : Executor 89 96 { 90 97 public RemoteExecutorClient() 91 98 { 92 // Create the channel.99 //Create the channel. 93 100 IpcChannel channel = new IpcChannel(); 94 101 95 // Register the channel.102 //Register the channel. 96 103 ChannelServices.RegisterChannel(channel, true); 97 104 98 // Register as client for remote object. 99 WellKnownClientTypeEntry remoteType = new WellKnownClientTypeEntry( 100 typeof(RemoteExecutorServer), 101 "ipc://localhost:9090/" + RemoteExecutorServer.ServerName); 102 RemotingConfiguration.RegisterWellKnownClientType(remoteType); 103 105 //Register the Client-activated Task class. 106 RemotingConfiguration.RegisterActivatedClientType(typeof(Task), 107 "ipc://localhost:9090"); 104 108 Run(); 105 109 } … … 119 123 try 120 124 { 125 //TODO: is there a better way to verify that we can connect to our Remote instance? 121 126 //Create an instance of the remote object. 122 DirectExecutor client = (DirectExecutor)Activator.GetObject(typeof(DirectExecutor), 127 Task task2 = new Task(); 128 Client = (DirectExecutor)Activator.GetObject(typeof(DirectExecutor), 123 129 "ipc://localhost:9090/" + RemoteExecutorServer.ServerName); 124 125 //Try to connect to the server instance.126 //TODO: is there a better way?127 int x = client.Tasks.Count;128 Client = client;129 130 IsConnected = true; 130 131 } … … 153 154 Client.QueueRestartTasks(); 154 155 } 155 156 156 157 internal override bool IsTaskQueued(Task task) 157 158 {
Note: See TracChangeset
for help on using the changeset viewer.
