2
2
3
3
import io .kubernetes .client .informer .ResourceEventHandler ;
4
4
import io .kubernetes .client .informer .exception .BadNotificationException ;
5
- import java .util .concurrent .ArrayBlockingQueue ;
6
5
import java .util .concurrent .BlockingQueue ;
6
+ import java .util .concurrent .LinkedBlockingQueue ;
7
7
import org .joda .time .DateTime ;
8
8
import org .slf4j .Logger ;
9
9
import org .slf4j .LoggerFactory ;
10
10
11
11
/**
12
12
* ProcessorListener implements Runnable interface. It's supposed to run in background and actually
13
- * executes its event handler on notification. Note that it allows 1000 pending notifications at
14
- * maximum.
13
+ * executes its event handler on notification.
15
14
*/
16
15
public class ProcessorListener <ApiType > implements Runnable {
17
16
18
17
private static final Logger log = LoggerFactory .getLogger (ProcessorListener .class );
19
18
20
- private static final int DEFAULT_QUEUE_CAPACITY = 1000 ;
21
-
22
19
// resyncPeriod is how frequently the listener wants a full resync from the shared informer. This
23
20
// value may differ from requestedResyncPeriod if the shared informer adjusts it to align with the
24
21
// informer's overall resync check period.
@@ -33,7 +30,7 @@ public ProcessorListener(ResourceEventHandler<ApiType> handler, long resyncPerio
33
30
this .resyncPeriod = resyncPeriod ;
34
31
this .handler = handler ;
35
32
36
- this .queue = new ArrayBlockingQueue <>(DEFAULT_QUEUE_CAPACITY );
33
+ this .queue = new LinkedBlockingQueue <>();
37
34
38
35
determineNextResync (DateTime .now ());
39
36
}
@@ -90,9 +87,7 @@ public void add(Notification<ApiType> obj) {
90
87
if (obj == null ) {
91
88
return ;
92
89
}
93
- if (!this .queue .offer (obj )) {
94
- log .warn ("notification queue full!" );
95
- }
90
+ this .queue .add (obj );
96
91
}
97
92
98
93
public void determineNextResync (DateTime now ) {
0 commit comments