예제 #1
0
        public Server(IPAddress serverIp)
        {
            Workers     = new List <WorkerInfo>();
            Clients     = new List <Uri>();
            TaskService = new ServerTaskService(this);
            ClientRegistrationService = new ClientRegistrationService(this);
            WorkerRegistrationService = new WorkerRegistrationService(this);
            ConnectionControl         = new ServerConnectionControl(this);
            TaskLibraryManager        = new TaskLibraryManager();
            TaskLibraryManager.Load();
            bool hostCreated = false;

            while (!hostCreated)
            {
                try
                {
                    ServerUri           = RemoteConnection.CreateUri(serverIp, Port++);
                    CheckConnectionHost = RemoteConnection.CreateHost(UriTemplates.CreateCheckConnectionUri(ServerUri), typeof(ICheckConnection), typeof(CheckConnection));
                    hostCreated         = true;
                }
                catch
                {
                }
            }
            TaskServiceHost        = RemoteConnection.CreateHost(UriTemplates.CreateTasksUri(ServerUri), typeof(IServerTaskService), TaskService);
            ClientRegistrationHost = RemoteConnection.CreateHost(UriTemplates.CreateClientRegistrationUri(ServerUri), typeof(IClientRegistrationService), ClientRegistrationService);
            WorkerRegistrationHost = RemoteConnection.CreateHost(UriTemplates.CreateWorkerRegistrationUri(ServerUri), typeof(IWorkerRegistrationService), WorkerRegistrationService);
            TaskLibraryHost        = RemoteConnection.CreateHost(UriTemplates.CreateLibrariesUri(ServerUri), typeof(IDistributedTaskLibraryService), typeof(DistributedTaskLibraryService));
            CheckConnectionHost    = RemoteConnection.CreateHost(UriTemplates.CreateCheckConnectionUri(ServerUri), typeof(ICheckConnection), typeof(CheckConnection));
            CheckConnectionHost.Open();
            WorkerRegistrationHost.Open();
            TaskLibraryHost.Open();
        }
예제 #2
0
 public WorkerTaskService(Uri localUri)
 {
     ResourceManager = new DistributedResourceManager(localUri);
     TaskManager     = new TaskLibraryManager();
     TaskManager.Load();
     LocalUri = localUri;
 }