Exemple #1
0
        // GetNextPort
        // per node, a hash of used port numbers with a next port number
        // record starting port number
        // while the port number is used
        // get next port number from the configured range for the instance, with rollover
        // if the port number is equal to the starting port number
        // raise all ports used
        // else
        // return the port number

        // Request an instance url
        public string RequestInstance(string instanceName)
        {
            lock (_syncHandle)
            {
                var entry = _instances[instanceName];
                if (entry != null)
                {
                    // TODO: More sophisticated handling of server state?
                    // The assumption here is that if it is in the list of instances, it's a valid instance
                    entry.LastRequested = DateTime.Now;
                    return(entry.InstanceUri);
                }

                var hostName   = GetNextHost();
                var portNumber = GetNextPort(hostName);

                entry = new InstanceEntry {
                    InstanceName = instanceName, HostName = hostName, PortNumber = portNumber
                };
                entry.InstanceUri = DataphorServiceUtility.BuildInstanceURI(hostName, portNumber, instanceName);
                entry.ProcessId   = DeployInstance(entry);
                _instances.Add(instanceName, entry);

                return(entry.InstanceUri);
            }
        }
Exemple #2
0
 private int DeployInstance(InstanceEntry entry)
 {
     throw new NotImplementedException();
 }
Exemple #3
0
 private void DestroyInstance(InstanceEntry entry)
 {
     throw new NotImplementedException();
 }