ApplicationQueuingAttribute.MaxListenerThreads Свойство

Определение

Возвращает или задает число потоков, используемых для извлечения сообщений из очереди и включения соответствующего компонента.

public:
 property int MaxListenerThreads { int get(); void set(int value); };
public int MaxListenerThreads { get; set; }
member this.MaxListenerThreads : int with get, set
Public Property MaxListenerThreads As Integer

Значение свойства

Наибольшее число потоков, используемых для обработки сообщений, поступающих в очередь. По умолчанию используется значение ноль.

Примеры

В следующем примере кода возвращается и задается значение ApplicationQueuing свойства атрибута MaxListenerThreads .

// This example code requires that an ApplicationQueuing attribute be
// applied to the assembly, as shown below:
// [assembly: ApplicationQueuing]

// Get the ApplicationQueuingAttribute applied to the assembly.
ApplicationQueuingAttribute attribute =
    (ApplicationQueuingAttribute)Attribute.GetCustomAttribute(
    System.Reflection.Assembly.GetExecutingAssembly(),
    typeof(ApplicationQueuingAttribute),
    false);

// Display the current value of the attribute's MaxListenerThreads
// property.
Console.WriteLine(
    "ApplicationQueuingAttribute.MaxListenerThreads: {0}",
    attribute.MaxListenerThreads);

// Set the MaxListenerThreads property value of the attribute.
attribute.MaxListenerThreads = 1;

// Display the new value of the attribute's MaxListenerThreads
// property.
Console.WriteLine(
    "ApplicationQueuingAttribute.MaxListenerThreads: {0}",
    attribute.MaxListenerThreads);
' This example code requires that an ApplicationQueuing attribute be
' applied to the assembly, as shown below:
' [assembly: ApplicationQueuing]
' Get the ApplicationQueuingAttribute applied to the assembly.
Dim attribute As ApplicationQueuingAttribute = CType(attribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), GetType(ApplicationQueuingAttribute), False), ApplicationQueuingAttribute)

' Display the current value of the attribute's MaxListenerThreads
' property.
MsgBox("ApplicationQueuingAttribute.MaxListenerThreads: " & attribute.MaxListenerThreads)

' Set the MaxListenerThreads property value of the attribute.
attribute.MaxListenerThreads = 1

' Display the new value of the attribute's MaxListenerThreads
' property.
MsgBox("ApplicationQueuingAttribute.MaxListenerThreads: " & attribute.MaxListenerThreads)

Комментарии

Допустимый диапазон для этого свойства — от 0 до 1000. По умолчанию используется значение ноль. Для вновь созданного приложения этот параметр является производным от алгоритма, используемого в настоящее время для определения количества потоков прослушивателя по умолчанию: в 16 раз больше числа ЦП на сервере.

Дополнительные сведения см. в разделе QcListenerMaxThreadsКоллекция приложений.

Применяется к