Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace drain with poll for queue for GameThread #4880

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// SPDX-License-Identifier: Apache-2.0
package org.terasology.engine.core;

import com.google.common.collect.Lists;

Check warning on line 5 in engine/src/main/java/org/terasology/engine/core/GameThread.java

View check run for this annotation

Terasology Jenkins.io / CheckStyle

UnusedImportsCheck

NORMAL: Unused import - com.google.common.collect.Lists.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks for unused import statements. Checkstyle uses a simple but very reliable algorithm to report on unused import statements. An import statement is considered unused if: </p><ul><li> It is not referenced in the file. The algorithm does not support wild-card imports like <code>import java.io.*;</code>. Most IDE's provide very sophisticated checks for imports that handle wild-card imports. </li><li> It is a duplicate of another import. This is when a class is imported more than once. </li><li> The class imported is from the <code>java.lang</code> package. For example importing <code>java.lang.String</code>. </li><li> The class imported is from the same package. </li><li><b>Optionally:</b> it is referenced in Javadoc comments. This check is on by default, but it is considered bad practice to introduce a compile time dependency for documentation purposes only. As an example, the import <code>java.util.Date</code> would be considered referenced with the Javadoc comment <code>{@link Date}</code>. The alternative to avoid introducing a compile time dependency would be to write the Javadoc comment as <code>{@link java.util.Date}</code>. </li></ul><p> The main limitation of this check is handling the case where an imported type has the same name as a declaration, such as a member variable. </p><p> For example, in the following case the import <code>java.awt.Component</code> will not be flagged as unused: </p><pre><code> import java.awt.Component; class FooBar { private Object Component; // a bad practice in my opinion ... } </code></pre>
import com.google.common.collect.Queues;

import java.util.List;

Check warning on line 8 in engine/src/main/java/org/terasology/engine/core/GameThread.java

View check run for this annotation

Terasology Jenkins.io / CheckStyle

UnusedImportsCheck

NORMAL: Unused import - java.util.List.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks for unused import statements. Checkstyle uses a simple but very reliable algorithm to report on unused import statements. An import statement is considered unused if: </p><ul><li> It is not referenced in the file. The algorithm does not support wild-card imports like <code>import java.io.*;</code>. Most IDE's provide very sophisticated checks for imports that handle wild-card imports. </li><li> It is a duplicate of another import. This is when a class is imported more than once. </li><li> The class imported is from the <code>java.lang</code> package. For example importing <code>java.lang.String</code>. </li><li> The class imported is from the same package. </li><li><b>Optionally:</b> it is referenced in Javadoc comments. This check is on by default, but it is considered bad practice to introduce a compile time dependency for documentation purposes only. As an example, the import <code>java.util.Date</code> would be considered referenced with the Javadoc comment <code>{@link Date}</code>. The alternative to avoid introducing a compile time dependency would be to write the Javadoc comment as <code>{@link java.util.Date}</code>. </li></ul><p> The main limitation of this check is handling the case where an imported type has the same name as a declaration, such as a member variable. </p><p> For example, in the following case the import <code>java.awt.Component</code> will not be flagged as unused: </p><pre><code> import java.awt.Component; class FooBar { private Object Component; // a bad practice in my opinion ... } </code></pre>
import java.util.concurrent.BlockingDeque;
import java.util.concurrent.Semaphore;

Expand Down Expand Up @@ -70,9 +70,10 @@
*/
public static void processWaitingProcesses() {
if (Thread.currentThread() == gameThread) {
List<Runnable> processes = Lists.newArrayList();
pendingRunnables.drainTo(processes);
processes.forEach(Runnable::run);
Runnable inst;
while((inst = pendingRunnables.poll()) != null) {

Check warning on line 74 in engine/src/main/java/org/terasology/engine/core/GameThread.java

View check run for this annotation

Terasology Jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: 'while' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>
inst.run();
}
}
}

Expand Down
Loading