com.groupbyinc.flux.cluster.service.TaskBatcher.class Maven / Gradle / Ivy
???? 4? /com/groupbyinc/flux/cluster/service/TaskBatcher java/lang/Object TaskBatcher.java ;com/groupbyinc/flux/cluster/service/TaskBatcher$BatchedTask BatchedTask java/util/Map$Entry
java/util/Map Entry %java/lang/invoke/MethodHandles$Lookup java/lang/invoke/MethodHandles Lookup logger !Lorg/apache/logging/log4j/Logger; threadExecutor LLcom/groupbyinc/flux/common/util/concurrent/PrioritizedEsThreadPoolExecutor; tasksPerBatchingKey Ljava/util/Map; {Ljava/util/Map;>; $assertionsDisabled Z p(Lorg/apache/logging/log4j/Logger;Lcom/groupbyinc/flux/common/util/concurrent/PrioritizedEsThreadPoolExecutor;)V ()V
java/util/HashMap !
" $ & ( this 1Lcom/groupbyinc/flux/cluster/service/TaskBatcher; submitTasks >(Ljava/util/List;Lcom/groupbyinc/flux/common/unit/TimeValue;)V Gcom/groupbyinc/flux/common/util/concurrent/EsRejectedExecutionException . %Lcom/groupbyinc/flux/common/Nullable; java/util/List 1 isEmpty ()Z 3 4 2 5 get (I)Ljava/lang/Object; 7 8 2 9 ; stream ()Ljava/util/stream/Stream; = > 2 ? "java/lang/invoke/LambdaMetafactory A metafactory ?(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; C D
B E F (Ljava/lang/Object;)Z H lambda$submitTasks$0 }(Lcom/groupbyinc/flux/cluster/service/TaskBatcher$BatchedTask;Lcom/groupbyinc/flux/cluster/service/TaskBatcher$BatchedTask;)Z J K
L M @(Lcom/groupbyinc/flux/cluster/service/TaskBatcher$BatchedTask;)Z O test ](Lcom/groupbyinc/flux/cluster/service/TaskBatcher$BatchedTask;)Ljava/util/function/Predicate; Q R S java/util/stream/Stream U allMatch !(Ljava/util/function/Predicate;)Z W X V Y java/lang/AssertionError [ java/lang/StringBuilder ]
^ ?tasks submitted in a batch should share the same batching key: ` append -(Ljava/lang/String;)Ljava/lang/StringBuilder; b c
^ d -(Ljava/lang/Object;)Ljava/lang/StringBuilder; b f
^ g toString ()Ljava/lang/String; i j
^ k (Ljava/lang/Object;)V m
\ n &(Ljava/lang/Object;)Ljava/lang/Object; p getTask ()Ljava/lang/Object; r s
t u Q(Lcom/groupbyinc/flux/cluster/service/TaskBatcher$BatchedTask;)Ljava/lang/Object; w apply ()Ljava/util/function/Function; y z { java/util/function/Function } identity z ~ ? 8(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; ? lambda$submitTasks$1 ?(Lcom/groupbyinc/flux/cluster/service/TaskBatcher$BatchedTask;Lcom/groupbyinc/flux/cluster/service/TaskBatcher$BatchedTask;)Lcom/groupbyinc/flux/cluster/service/TaskBatcher$BatchedTask; ? ?
? ? ? %()Ljava/util/function/BinaryOperator; y ? ? s java/util/IdentityHashMap ?
? ? ()Ljava/util/IdentityHashMap; ? ()Ljava/util/function/Supplier; 7 ? ? java/util/stream/Collectors ? toMap ?(Ljava/util/function/Function;Ljava/util/function/Function;Ljava/util/function/BinaryOperator;Ljava/util/function/Supplier;)Ljava/util/stream/Collector; ? ?
? ? collect 0(Ljava/util/stream/Collector;)Ljava/lang/Object; ? ? V ? batchingKey Ljava/lang/Object; ? ? ? lambda$submitTasks$2 =(Ljava/util/List;Ljava/lang/Object;)Ljava/util/LinkedHashSet; ? ?
? ? -(Ljava/lang/Object;)Ljava/util/LinkedHashSet; ? /(Ljava/util/List;)Ljava/util/function/Function; y ? ? computeIfAbsent C(Ljava/lang/Object;Ljava/util/function/Function;)Ljava/lang/Object; ? ? ? java/util/LinkedHashSet ? iterator ()Ljava/util/Iterator; ? ?
? ? )com/groupbyinc/flux/common/unit/TimeValue ? java/util/Iterator ? hasNext ? 4 ? ? next ? s ? ? 7 p ? java/lang/IllegalStateException ? task [ ? java/util/Collections ?
singletonList $(Ljava/lang/Object;)Ljava/util/List; ? ?
? ?
describeTasks $(Ljava/util/List;)Ljava/lang/String; ? ?
? ] with source [ ? source Ljava/lang/String; ? ? ? ] is already queued ? (Ljava/lang/String;)V ?
? ? addAll (Ljava/util/Collection;)Z ? ?
? ? java/lang/Throwable ? lambda$submitTasks$3 ? -
? ? run ?(Lcom/groupbyinc/flux/cluster/service/TaskBatcher;Ljava/util/List;Lcom/groupbyinc/flux/common/unit/TimeValue;)Ljava/lang/Runnable; ? ? ? Jcom/groupbyinc/flux/common/util/concurrent/PrioritizedEsThreadPoolExecutor ? execute V(Ljava/lang/Runnable;Lcom/groupbyinc/flux/common/unit/TimeValue;Ljava/lang/Runnable;)V ? ?
? ? (Ljava/lang/Runnable;)V ? ?
? ?
duplicateTask =Lcom/groupbyinc/flux/cluster/service/TaskBatcher$BatchedTask; existing
existingTasks XLjava/util/LinkedHashSet; Ljava/util/LinkedHashSet; tasks PLjava/util/List<+Lcom/groupbyinc/flux/cluster/service/TaskBatcher$BatchedTask;>; Ljava/util/List; timeout +Lcom/groupbyinc/flux/common/unit/TimeValue; firstTask
tasksIdentity `Ljava/util/Map; onTimeoutInternal java/util/ArrayList
2 ? processed +Ljava/util/concurrent/atomic/AtomicBoolean;
)java/util/concurrent/atomic/AtomicBoolean
getAndSet (Z)Z
task [{}] timed out after [{}] org/apache/logging/log4j/Logger debug 9(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V add H
5
9 lambda$onTimeoutInternal$4 R(Ljava/lang/Object;Lcom/groupbyinc/flux/cluster/service/TaskBatcher$BatchedTask;)Z !
"# 2(Ljava/lang/Object;)Ljava/util/function/Predicate; Q% & removeAll( ?
?)
? 5 remove, p - onTimeout/ -
0 task toRemove TLjava/util/ArrayList; Ljava/util/ArrayList; runIfNotProcessed @(Lcom/groupbyinc/flux/cluster/service/TaskBatcher$BatchedTask;)V 7 4
8 will process {}: trace '(Ljava/lang/String;Ljava/lang/Object;)V<=> 2 lambda$runIfNotProcessed$5 $(Ljava/lang/String;)Ljava/util/List;AB
CDB { skipping {}, already processedH entrySet ()Ljava/util/Set;JK L
java/util/SetNO ? lambda$runIfNotProcessed$6 f(Lcom/groupbyinc/flux/cluster/service/TaskBatcher$BatchedTask;Ljava/util/Map$Entry;)Ljava/lang/String;QR
ST )(Ljava/util/Map$Entry;)Ljava/lang/String;V \(Lcom/groupbyinc/flux/cluster/service/TaskBatcher$BatchedTask;)Ljava/util/function/Function; yX Y map 8(Ljava/util/function/Function;)Ljava/util/stream/Stream;[\ V] lambda$runIfNotProcessed$7 8(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;_`
ab` ? reduce 9(Ljava/util/function/BinaryOperator;)Ljava/util/Optional;fg Vh j java/util/Optionall orElsen p
mo java/lang/Stringq 7(Ljava/lang/Object;Ljava/util/List;Ljava/lang/String;)V ?s
t pending tasksSummary toExecute OLjava/util/List; processTasksBySource rLjava/util/Map;>;
updateTask , } s1 s2 getValue? s
?
r 5 getKey? s
? [? ]? entry Ljava/util/Map$Entry; s t -
? size ()I?? 2? (I)V ?
?? k cannot add duplicate task: ? a b java/lang/Class? desiredAssertionStatus? 4
?? Signature Code LocalVariableTable LineNumberTable LocalVariableTypeTable
StackMapTable
Exceptions ~(Ljava/util/List<+Lcom/groupbyinc/flux/cluster/service/TaskBatcher$BatchedTask;>;Lcom/groupbyinc/flux/common/unit/TimeValue;)V "RuntimeVisibleParameterAnnotations w(Ljava/lang/Object;Ljava/util/List<+Lcom/groupbyinc/flux/cluster/service/TaskBatcher$BatchedTask;>;Ljava/lang/String;)V BootstrapMethods
SourceFile InnerClasses! ? ? h *? *? "Y? #? %*+? '*,? )? ? * + ? 3 1 4 5 6 , - ? ? 1+? 6 ? ?+? : ? N?