File tree Expand file tree Collapse file tree 1 file changed +13
-14
lines changed
src/main/java/com/github/jrrdev/mantisbtsync/core/common/readers Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change 2323 */
2424package com .github .jrrdev .mantisbtsync .core .common .readers ;
2525
26+ import java .util .Arrays ;
27+ import java .util .LinkedList ;
28+ import java .util .Queue ;
29+
2630import org .apache .axis .client .Stub ;
2731import org .apache .axis .transport .http .HTTPConstants ;
2832import org .springframework .batch .item .ItemReader ;
@@ -52,14 +56,14 @@ public class AxisAuthItemsArrayReader<T> extends
5256 private Stub clientStub ;
5357
5458 /**
55- * Index of the last read item .
59+ * Results array got from the WS .
5660 */
57- private int i = - 1 ;
61+ private final Queue < T > items = new LinkedList < T >() ;
5862
5963 /**
60- * Results array got from the WS.
64+ * Boolean indicating if the WS call have already been made or not .
6165 */
62- private T [] items ;
66+ private boolean isCallPerformed = false ;
6367
6468
6569 /**
@@ -104,17 +108,12 @@ public T read() throws Exception {
104108 authManager .getAuthCookie ());
105109 }
106110
107- if (i < 0 ) {
108- items = invokeDelegateMethod ();
109- i = -1 ;
111+ if (!isCallPerformed ) {
112+ final T [] itemsArray = invokeDelegateMethod ();
113+ isCallPerformed = true ;
114+ items .addAll (Arrays .asList (itemsArray ));
110115 }
111116
112- i ++;
113- if (items != null && i < items .length ) {
114- return items [i ];
115- } else {
116- items = null ;
117- return null ;
118- }
117+ return items .poll ();
119118 }
120119}
You can’t perform that action at this time.
0 commit comments