ApplicationQueuingAttribute.MaxListenerThreads Propriété

Définition

Obtient ou définit le nombre de threads utilisés pour récupérer des messages de la file d'attente et pour activer le composant correspondant.

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

Valeur de propriété

Nombre maximal de threads à utiliser pour traiter les messages qui arrivent dans la file d'attente. La valeur par défaut est zéro.

Exemples

L’exemple de code suivant obtient et définit la valeur de la propriété d’un ApplicationQueuingMaxListenerThreads attribut.

// 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)

Remarques

La plage valide pour cette propriété est comprise entre 0 et 1 000. La valeur par défaut est zéro. Pour une application nouvellement créée, le paramètre est dérivé de l’algorithme actuellement utilisé pour déterminer le nombre par défaut de threads d’écouteurs : 16 fois le nombre de processeurs dans le serveur.

Pour plus d’informations, consultez QcListenerMaxThreads collection Applications.

S’applique à