src/main/java/javapns/notification/transmission/NotificationThreads.java
NotificationThreads
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public class NotificationThreads extends ThreadGroup implements PushQueue {
private static final long DEFAULT_DELAY_BETWEEN_THREADS = 500; // the number of milliseconds to wait between each thread startup
private static final String JAVAPNS_NOTIFICATION_THREADS = "javapns notification threads (";
private static final String THREADS = " threads)";
Method start
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
public synchronized NotificationThreads start() {
if (started) {
return this;
}
started = true;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method makeGroups
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
private static List<List<?>> makeGroups(final List<?> objects, final int threads) {
final List<List<?>> groups = new ArrayList<>(threads);
final int total = objects.size();
int devicesPerThread = total / threads;
if (total % threads > 0) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"