public class CustomDataProvider extends DataProvider {
public void invoke(ThrottlingDataContext dataContext) throws ThrottlingException {
long dataSize = dataContext.getDataLong(ThrottlingDataEntryConstants.TENANT_CAPACITY);
if (dataSize % 2 == 0) {
MultitenancyPackage multiPackage = new MultitenancyPackage();
multiPackage.setName("test1");
multiPackage.setBandwidthLimit(50);
dataContext.addDataObject(ThrottlingDataEntryConstants.PACKAGE, multiPackage);
} else {
MultitenancyPackage multiPackage = new MultitenancyPackage();
multiPackage.setName("test2");
dataContext.addDataObject(ThrottlingDataEntryConstants.PACKAGE, multiPackage);
multiPackage.setBandwidthLimit(50);
}
}