Exemple #1
0
            public void Dispose()
            {
                _shutdownEvent.Set();
                _thread.Join();

                _shutdownEvent.Dispose();
                _executeCommandEvent.Dispose();

                BindingInterfaces.FreeBindingInterface(BindingInterface);
            }
Exemple #2
0
        public IInstance CreateInstance(Package package)
        {
            if (_instances.Count >= _maxConcurrentInstances)
            {
                throw new ConcurrentInstancesExceededException();
            }

            // AllocateBindingInterface() throws InvalidOperationException if theres no interfaces but this should never happen
            // provided the configuration prevents max concurrent instances to exceed available binding interfaces
            var bindingInterface = BindingInterfaces.AllocateBindingInterface();

            var id = DateTime.UtcNow.Ticks.ToString("x16");

            var instance = new Instance(this, id, package, _logger, bindingInterface, _settings);

            _instances.Add(id, instance);
            return(instance);
        }