com.anaptecs.jeaf.workload.annotations.PipelineConfig Maven / Gradle / Ivy
/**
* Copyright 2004 - 2020 anaptecs GmbH, Burgstr. 96, 72764 Reutlingen, Germany
*
* All rights reserved.
*/
package com.anaptecs.jeaf.workload.annotations;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* Annotation can be used to configure a pipeline for JEAF's Workload Management.
*
* @author JEAF Development Team
*/
@Retention(RUNTIME)
@Target(TYPE)
@Documented
public @interface PipelineConfig {
/**
* Name of the pipeline. If no name is provided then the simple name of the declaring class will be used.
*/
String name() default "";
/**
* Description of the pipeline. A description may especially helps in combination with management tools that allow to
* adjust pipeline configuration at runtime.
*/
String description() default "";
/**
* The core thread size defines the standard size of the thread pool. The size of the thread will only be extended to
* the maximum size in case the the queue reaches its maximum size.
*
* For further details please refer to {@link ThreadPoolExecutor}
*/
int coreThreads();
/**
* Maximum amount of threads that will be used by the pipeline. In standard working mode the pipeline will not use
* more threads then defined by {@link #coreThreads()}. Only when the queue reaches its limit max threads will be
* used. By default maxThreads will have the same size as {@link #coreThreads()}.
*/
int maxThreads() default -1;
/**
* Valid values as defined by Java must be within {@link Thread#MIN_PRIORITY} and {@link Thread#MAX_PRIORITY}. By
* default {@link Thread#NORM_PRIORITY} will be used.
*/
int threadPriority() default Thread.NORM_PRIORITY;
/**
* Maximum time until threads that exceed the minimum pool size are kept alive if they are not used. Default is 60
* seconds
*/
int maxThreadKeepAlive() default 60000;
/**
* Implementation type of the queue that is used to implement the workload pipeline.
*/
QueueType queueType() default QueueType.FIFO;
/**
* Maximum size of the queue that is used for requests in case that all threads of the pipeline are currently
* occupied.
*
* By default the size is 0 which means the request will be rejected immediately.
*/
int maxQueueDepth() default 50;
/**
* Maximum latency in the defined {@link #timeUnit} that is accepted due to queuing of requests. If the defined
* maximum time is exceeded then the request will be rejected. This value is similar to a connection wait timeout for
* JDBC connections.
*
* By default maxLatency
is disabled.
*/
int maxLatency() default -1;
/**
* Time unit that is used for all time values. Default is {@link TimeUnit#MILLISECONDS}
*
* By default timeUnit
is set to TimeUnit.MILLISECONDS.
*/
TimeUnit timeUnit() default TimeUnit.MILLISECONDS;
/**
* Parameter define if this workload management definition is the default pipeline. The default pipeline will be used
* if no other more specific pipeline could be found for a certain request type.
*/
boolean defaultPipeline() default false;
}