Class DataCarrier<T>
java.lang.Object
org.apache.skywalking.oap.server.library.datacarrier.DataCarrier<T>
DataCarrier main class. use this instance to set Producer/Consumer Model.
-
Constructor Summary
ConstructorsConstructorDescriptionDataCarrier(int channelSize, int bufferSize) DataCarrier(int channelSize, int bufferSize, BufferStrategy strategy) DataCarrier(String name, int channelSize, int bufferSize) DataCarrier(String name, String envPrefix, int channelSize, int bufferSize) DataCarrier(String name, String envPrefix, int channelSize, int bufferSize, BufferStrategy strategy) -
Method Summary
Modifier and TypeMethodDescriptionset consumeDriver to this Carrier.consume(Class<? extends IConsumer<T>> consumerClass, int num, long consumeCycle, Properties properties) set consumeDriver to this Carrier.consume(ConsumerPool consumerPool, IConsumer<T> consumer) Set a consumer pool to manage the channels of this DataCarrier.set consumeDriver to this Carrier.set consumeDriver to this Carrier.booleanproduce data to buffer, using the givenBufferStrategy.setPartitioner(IDataPartitioner<T> dataPartitioner) set a new IDataPartitioner.voidshutdown all consumer threads, if consumer threads are running.
-
Constructor Details
-
DataCarrier
public DataCarrier(int channelSize, int bufferSize) -
DataCarrier
-
DataCarrier
-
DataCarrier
public DataCarrier(String name, String envPrefix, int channelSize, int bufferSize, BufferStrategy strategy) -
DataCarrier
-
-
Method Details
-
setPartitioner
set a new IDataPartitioner. It will cover the current one or default one.(Default isSimpleRollingPartitioner- Parameters:
dataPartitioner- to partition data into different channel by some rules.- Returns:
- DataCarrier instance for chain
-
produce
produce data to buffer, using the givenBufferStrategy.- Returns:
- false means produce data failure. The data will not be consumed.
-
consume
public DataCarrier consume(Class<? extends IConsumer<T>> consumerClass, int num, long consumeCycle, Properties properties) set consumeDriver to this Carrier. consumer begin to run whenproduce(T)begin to work.- Parameters:
consumerClass- class of consumernum- number of consumer threadsproperties- for initializing consumer.
-
consume
set consumeDriver to this Carrier. consumer begin to run whenproduce(T)begin to work with 20 millis consume cycle.- Parameters:
consumerClass- class of consumernum- number of consumer threads
-
consume
set consumeDriver to this Carrier. consumer begin to run whenproduce(T)begin to work.- Parameters:
consumer- single instance of consumer, all consumer threads will all use this instance.num- number of consumer threads
-
consume
set consumeDriver to this Carrier. consumer begin to run whenproduce(T)begin to work with 20 millis consume cycle.- Parameters:
consumer- single instance of consumer, all consumer threads will all use this instance.num- number of consumer threads
-
consume
Set a consumer pool to manage the channels of this DataCarrier. Then consumerPool could use its own consuming model to adjust the consumer thread and throughput. -
shutdownConsumers
public void shutdownConsumers()shutdown all consumer threads, if consumer threads are running. NoticeBufferStrategy: ifBufferStrategy==BufferStrategy.BLOCKING, shutdown consumeDriver maybe cause blocking when producing. Better way to change consumeDriver are useconsume(java.lang.Class<? extends org.apache.skywalking.oap.server.library.datacarrier.consumer.IConsumer<T>>, int, long, java.util.Properties)
-