List<QuotaSettings> settings = new ArrayList<>(); if (throttle.hasReqNum()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, regionServer, ThrottleType.REQUEST_NUMBER, throttle.getReqNum())); settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, regionServer, ThrottleType.REQUEST_SIZE, throttle.getReqSize())); settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, regionServer, ThrottleType.WRITE_NUMBER, throttle.getWriteNum())); settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, regionServer, ThrottleType.WRITE_SIZE, throttle.getWriteSize())); settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, regionServer, ThrottleType.READ_NUMBER, throttle.getReadNum())); settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, regionServer, ThrottleType.READ_SIZE, throttle.getReadSize())); settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, regionServer, ThrottleType.REQUEST_CAPACITY_UNIT, throttle.getReqCapacityUnit())); settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, regionServer, ThrottleType.READ_CAPACITY_UNIT, throttle.getReadCapacityUnit())); settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, regionServer, ThrottleType.WRITE_CAPACITY_UNIT, throttle.getWriteCapacityUnit()));
protected static List<QuotaSettings> fromThrottle(final String userName, final TableName tableName, final String namespace, final QuotaProtos.Throttle throttle) { List<QuotaSettings> settings = new ArrayList<>(); if (throttle.hasReqNum()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, ThrottleType.REQUEST_NUMBER, throttle.getReqNum())); } if (throttle.hasReqSize()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, ThrottleType.REQUEST_SIZE, throttle.getReqSize())); } if (throttle.hasWriteNum()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, ThrottleType.WRITE_NUMBER, throttle.getWriteNum())); } if (throttle.hasWriteSize()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, ThrottleType.WRITE_SIZE, throttle.getWriteSize())); } if (throttle.hasReadNum()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, ThrottleType.READ_NUMBER, throttle.getReadNum())); } if (throttle.hasReadSize()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, ThrottleType.READ_SIZE, throttle.getReadSize())); } return settings; }
private static List<QuotaSettings> fromThrottle(final String userName, final TableName tableName, final String namespace, final QuotaProtos.Throttle throttle) { List<QuotaSettings> settings = new ArrayList<QuotaSettings>(); if (throttle.hasReqNum()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, ThrottleType.REQUEST_NUMBER, throttle.getReqNum())); } if (throttle.hasReqSize()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, ThrottleType.REQUEST_SIZE, throttle.getReqSize())); } if (throttle.hasWriteNum()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, ThrottleType.WRITE_NUMBER, throttle.getWriteNum())); } if (throttle.hasWriteSize()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, ThrottleType.WRITE_SIZE, throttle.getWriteSize())); } if (throttle.hasReadNum()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, ThrottleType.READ_NUMBER, throttle.getReadNum())); } if (throttle.hasReadSize()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, ThrottleType.READ_SIZE, throttle.getReadSize())); } return settings; }
protected static List<QuotaSettings> fromThrottle(final String userName, final TableName tableName, final String namespace, final QuotaProtos.Throttle throttle) { List<QuotaSettings> settings = new ArrayList<>(); if (throttle.hasReqNum()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, ThrottleType.REQUEST_NUMBER, throttle.getReqNum())); } if (throttle.hasReqSize()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, ThrottleType.REQUEST_SIZE, throttle.getReqSize())); } if (throttle.hasWriteNum()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, ThrottleType.WRITE_NUMBER, throttle.getWriteNum())); } if (throttle.hasWriteSize()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, ThrottleType.WRITE_SIZE, throttle.getWriteSize())); } if (throttle.hasReadNum()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, ThrottleType.READ_NUMBER, throttle.getReadNum())); } if (throttle.hasReadSize()) { settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, ThrottleType.READ_SIZE, throttle.getReadSize())); } return settings; }