Browse Source

fix quality flaws

tags/5.5-M11
Sébastien Lesaint 8 years ago
parent
commit
eec3233505

+ 13
- 13
server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java View File

@@ -129,19 +129,6 @@ public class CeServer implements Monitored {
}
}

private void stopAwait() {
stopAwait = true;
Thread t = awaitThread.get();
if (t != null) {
t.interrupt();
try {
t.join(1000);
} catch (InterruptedException e) {
// Ignored
}
}
}

private class CeMainThread extends Thread {
private static final int CHECK_FOR_STOP_DELAY = 50;
private volatile boolean stop = false;
@@ -227,6 +214,19 @@ public class CeServer implements Monitored {
// interrupt current thread in case its waiting for WebServer
interrupt();
}

private void stopAwait() {
stopAwait = true;
Thread t = awaitThread.get();
if (t != null) {
t.interrupt();
try {
t.join(1000);
} catch (InterruptedException e) {
// Ignored
}
}
}
}

}

+ 0
- 3
server/sonar-ce/src/test/java/org/sonar/ce/app/CeServerTest.java View File

@@ -28,7 +28,6 @@ import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
import org.junit.rules.Timeout;
import org.mockito.Mockito;
import org.sonar.ce.ComputeEngine;
@@ -44,8 +43,6 @@ public class CeServerTest {
public Timeout timeout = Timeout.seconds(50);
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Rule
public TemporaryFolder temp = new TemporaryFolder();

private CeServer underTest = null;
private Thread waitingThread = null;

+ 5
- 3
server/sonar-process/src/main/java/org/sonar/process/AllProcessesCommands.java View File

@@ -52,8 +52,10 @@ import static org.sonar.process.ProcessCommands.MAX_PROCESSES;
* <ul>
* <li>First byte contains {@link #EMPTY} until process is UP and writes {@link #UP}</li>
* <li>Second byte contains {@link #EMPTY} until any process requests current one to stop by writing value {@link #STOP}</li>
* <li>Third byte contains {@link #EMPTY} until any process requests current one to restart by writing value {@link #RESTART}. Process acknowledges restart by writing back {@link #EMPTY}</li>
* <li>Fourth byte will always contain {@link #EMPTY} unless process declares that it is operational by writing {@link #OPERATIONAL}. This does not imply that is done starting.</li>
* <li>Third byte contains {@link #EMPTY} until any process requests current one to restart by writing value {@link #RESTART}.
* Process acknowledges restart by writing back {@link #EMPTY}</li>
* <li>Fourth byte will always contain {@link #EMPTY} unless process declares that it is operational by writing {@link #OPERATIONAL}.
* This does not imply that is done starting.</li>
* <li>The next 8 bytes contains a long (value of {@link System#currentTimeMillis()}) which represents the date of the last ping</li>
* </ul>
* </p>
@@ -76,7 +78,7 @@ public class AllProcessesCommands {
private static final byte UP = (byte) 0x01;
private static final byte EMPTY = (byte) 0x00;

//VisibleForTesting
// VisibleForTesting
final MappedByteBuffer mappedByteBuffer;
private final RandomAccessFile sharedMemory;


+ 1
- 1
server/sonar-server/src/main/java/org/sonar/ce/taskprocessor/ReportTaskProcessorDeclaration.java View File

@@ -39,6 +39,6 @@ public class ReportTaskProcessorDeclaration implements CeTaskProcessor {

@Override
public CeTaskResult process(CeTask task) {
throw new UnsupportedOperationException("process must not be called in WebServer");
throw new UnsupportedOperationException("process must not be called in WebServer");
}
}

+ 1
- 1
server/sonar-server/src/main/java/org/sonar/server/computation/qualitygate/EvaluationResultTextConverterImpl.java View File

@@ -75,7 +75,7 @@ public final class EvaluationResultTextConverterImpl implements EvaluationResult
stringBuilder.append(metric);

if (alertPeriod != null && !condition.getMetric().getKey().startsWith(VARIATION_METRIC_PREFIX)) {
String variation = i18n.message(Locale.ENGLISH, VARIATION, VARIATION).toLowerCase();
String variation = i18n.message(Locale.ENGLISH, VARIATION, VARIATION).toLowerCase(Locale.ENGLISH);
stringBuilder.append(" ").append(variation);
}


+ 3
- 4
server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImpl.java View File

@@ -22,13 +22,12 @@ package org.sonar.server.computation.taskprocessor;
import com.google.common.base.Optional;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
import org.sonar.ce.taskprocessor.CeTaskProcessor;
import org.sonar.core.util.logs.Profiler;
import org.sonar.db.ce.CeActivityDto;
import org.sonar.ce.log.CeLogging;
import org.sonar.ce.queue.CeQueue;
import org.sonar.ce.queue.CeTask;
import org.sonar.ce.queue.CeTaskResult;
import org.sonar.ce.taskprocessor.CeTaskProcessor;
import org.sonar.core.util.logs.Profiler;
import org.sonar.db.ce.CeActivityDto;
import org.sonar.server.computation.queue.InternalCeQueue;

import static java.lang.String.format;

+ 0
- 3
server/sonar-server/src/test/java/org/sonar/server/platform/ws/RestartActionTest.java View File

@@ -22,7 +22,6 @@ package org.sonar.server.platform.ws;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
import org.sonar.api.config.Settings;
import org.sonar.api.utils.log.LogTester;
import org.sonar.api.utils.log.LoggerLevel;
@@ -44,8 +43,6 @@ public class RestartActionTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Rule
public TemporaryFolder temp = new TemporaryFolder();
@Rule
public LogTester logTester = new LogTester();

private Settings settings = new Settings();

Loading…
Cancel
Save