From f6979bc63fce5643f4001e726d8384305fdf24d4 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Thu, 13 Oct 2016 12:08:29 -0400 Subject: [PATCH] NIFI-2500 made container queue configurable --- .../standard/HandleHttpRequest.java | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpRequest.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpRequest.java index 9f8edfcea61d..c1acc85029a7 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpRequest.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpRequest.java @@ -219,19 +219,20 @@ public class HandleHttpRequest extends AbstractProcessor { .allowableValues(CLIENT_NONE, CLIENT_WANT, CLIENT_NEED) .defaultValue(CLIENT_NONE.getValue()) .build(); + public static final PropertyDescriptor CONTAINER_QUEUE_SIZE = new PropertyDescriptor.Builder() + .name("container-queue-size").displayName("Container Queue Size") + .description("The size of the queue for Http Request Containers").required(true) + .addValidator(StandardValidators.POSITIVE_INTEGER_VALIDATOR).defaultValue("50").build(); public static final Relationship REL_SUCCESS = new Relationship.Builder() .name("success") .description("All content that is received is routed to the 'success' relationship") .build(); - private volatile Server server; - private AtomicBoolean initialized = new AtomicBoolean(false); - private final BlockingQueue containerQueue = new LinkedBlockingQueue<>(50); + private static final List propertyDescriptors; - @Override - protected List getSupportedPropertyDescriptors() { - final List descriptors = new ArrayList<>(); + static { + List descriptors = new ArrayList<>(); descriptors.add(PORT); descriptors.add(HOSTNAME); descriptors.add(SSL_CONTEXT); @@ -246,8 +247,17 @@ protected List getSupportedPropertyDescriptors() { descriptors.add(ALLOW_OPTIONS); descriptors.add(ADDITIONAL_METHODS); descriptors.add(CLIENT_AUTH); + descriptors.add(CONTAINER_QUEUE_SIZE); + propertyDescriptors = Collections.unmodifiableList(descriptors); + } - return descriptors; + private volatile Server server; + private AtomicBoolean initialized = new AtomicBoolean(false); + private volatile BlockingQueue containerQueue; + + @Override + protected List getSupportedPropertyDescriptors() { + return propertyDescriptors; } @Override @@ -264,7 +274,7 @@ private synchronized void initializeServer(final ProcessContext context) throws if(initialized.get()){ return; } - + this.containerQueue = new LinkedBlockingQueue<>(context.getProperty(CONTAINER_QUEUE_SIZE).asInteger()); final String host = context.getProperty(HOSTNAME).getValue(); final int port = context.getProperty(PORT).asInteger(); final SSLContextService sslService = context.getProperty(SSL_CONTEXT).asControllerService(SSLContextService.class);