Skip to content

Commit e058c47

Browse files
authored
Merge pull request kubernetes-client#797 from yue9944882/chore/instantiate-informer-via-listerwatcher
Constructs informer by setting lister-watcher from InformerFactory
2 parents fa8c2dd + 84796e5 commit e058c47

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

util/src/main/java/io/kubernetes/client/informer/SharedInformerFactory.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,24 @@ public synchronized <ApiType, ApiListType> SharedIndexInformer<ApiType> sharedIn
9999
long resyncPeriodInMillis) {
100100
ListerWatcher<ApiType, ApiListType> listerWatcher =
101101
listerWatcherFor(callGenerator, apiTypeClass, apiListTypeClass);
102+
return sharedIndexInformerFor(listerWatcher, apiTypeClass, resyncPeriodInMillis);
103+
}
104+
105+
/**
106+
* Constructs and returns a shared index informer by specifying lister-watcher. And the informer
107+
* cache will be overwritten on multiple call w/ the the same apiTypeClass.
108+
*
109+
* @param <ApiType> the type parameter
110+
* @param <ApiListType> the type parameter
111+
* @param listerWatcher the lister watcher
112+
* @param apiTypeClass the api type class
113+
* @param resyncPeriodInMillis the resync period in millis
114+
* @return the shared index informer
115+
*/
116+
public synchronized <ApiType, ApiListType> SharedIndexInformer<ApiType> sharedIndexInformerFor(
117+
ListerWatcher<ApiType, ApiListType> listerWatcher,
118+
Class<ApiType> apiTypeClass,
119+
long resyncPeriodInMillis) {
102120
SharedIndexInformer<ApiType> informer =
103121
new DefaultSharedIndexInformer<ApiType, ApiListType>(
104122
apiTypeClass, listerWatcher, resyncPeriodInMillis);

0 commit comments

Comments
 (0)