while (!stopAwait) {
try {
// wait for a quite long time but we will be interrupted if flag changes anyway
- Thread.sleep(10000);
+ Thread.sleep(10_000);
} catch (InterruptedException e) {
// continue and check the flag
}
}
public Timeouts() {
- this(60000L);
+ this(60_000L);
}
/**
* @see org.apache.commons.mail.Email#setSocketConnectionTimeout(int)
* @see org.apache.commons.mail.Email#setSocketTimeout(int)
*/
- private static final int SOCKET_TIMEOUT = 30000;
+ private static final int SOCKET_TIMEOUT = 30_000;
/**
* Email Header Field: "List-ID".
* Limit on the number of results to return. Defaults to {@link #DEFAULT_LIMIT}.
*/
public int getLimit() {
- return showFullResult ? 999999 : limit;
+ return showFullResult ? 999_999 : limit;
}
/**
*/
public class ProgressLogger {
- public static final long DEFAULT_PERIOD_MS = 60000L;
+ public static final long DEFAULT_PERIOD_MS = 60_000L;
private final Timer timer;
private final LoggerTimerTask task;
public void deleteByWidgetIds(DbSession session, List<Long> widgetIdsWithPropertiesToDelete) {
executeLargeInputs(
- widgetIdsWithPropertiesToDelete,
- input -> {
- mapper(session).deleteByWidgetIds(input);
- return Collections.emptyList();
- });
+ widgetIdsWithPropertiesToDelete,
+ input -> {
+ mapper(session).deleteByWidgetIds(input);
+ return Collections.emptyList();
+ });
}
private static WidgetPropertyMapper mapper(DbSession session) {
}
public Set<String> getTags() {
- return tags == null ? new HashSet<String>() : new TreeSet<>(Arrays.asList(StringUtils.split(tags, ',')));
+ return tags == null ? new HashSet<>() : new TreeSet<>(Arrays.asList(StringUtils.split(tags, ',')));
}
public Set<String> getSystemTags() {
- return systemTags == null ? new HashSet<String>() : new TreeSet<>(Arrays.asList(StringUtils.split(systemTags, ',')));
+ return systemTags == null ? new HashSet<>() : new TreeSet<>(Arrays.asList(StringUtils.split(systemTags, ',')));
}
private String getTagsField() {
public Map<String, Integer> countUsersByGroups(DbSession session, Collection<Long> groupIds) {
Map<String, Integer> result = Maps.newHashMap();
executeLargeInputs(
- groupIds,
- input -> {
- List<GroupUserCount> userCounts = mapper(session).countUsersByGroup(input);
- for (GroupUserCount count : userCounts) {
- result.put(count.groupName(), count.userCount());
- }
- return userCounts;
- });
+ groupIds,
+ input -> {
+ List<GroupUserCount> userCounts = mapper(session).countUsersByGroup(input);
+ for (GroupUserCount count : userCounts) {
+ result.put(count.groupName(), count.userCount());
+ }
+ return userCounts;
+ });
return result;
}
public Multimap<String, String> selectGroupsByLogins(DbSession session, Collection<String> logins) {
Multimap<String, String> result = ArrayListMultimap.create();
executeLargeInputs(
- logins,
- input -> {
- List<LoginGroup> groupMemberships = mapper(session).selectGroupsByLogins(input);
- for (LoginGroup membership : groupMemberships) {
- result.put(membership.login(), membership.groupName());
- }
- return groupMemberships;
- });
+ logins,
+ input -> {
+ List<LoginGroup> groupMemberships = mapper(session).selectGroupsByLogins(input);
+ for (LoginGroup membership : groupMemberships) {
+ result.put(membership.login(), membership.groupName());
+ }
+ return groupMemberships;
+ });
return result;
}
public class FileCache {
/** Maximum loop count when creating temp directories. */
- private static final int TEMP_DIR_ATTEMPTS = 10000;
+ private static final int TEMP_DIR_ATTEMPTS = 10_000;
private final File dir;
private final File tmpDir;
*/
public class WorkDuration implements Serializable {
- static final int DAY_POSITION_IN_LONG = 10000;
+ static final int DAY_POSITION_IN_LONG = 10_000;
static final int HOUR_POSITION_IN_LONG = 100;
static final int MINUTE_POSITION_IN_LONG = 1;