com.alibaba.middleware.ushura.poller.GenericPoller Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of eas-sdk Show documentation
Show all versions of eas-sdk Show documentation
SDK for PAI-EAS online inference services
package com.alibaba.middleware.ushura.poller;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @author Hanson on 15/12/28.
*/
public class GenericPoller implements Poller{
private AtomicInteger index = new AtomicInteger(0);
private List items = new ArrayList();
public GenericPoller(List items){
this.items = items;
}
public T next() {
return items.get(Math.abs(index.getAndIncrement() % items.size()));
}
public Poller refresh(List items) {
return new GenericPoller(items);
}
}