*/
public final class Profiling implements ServerExtension {
- /**
- *
- */
public static final String CONFIG_PROFILING_LEVEL = "sonar.log.profilingLevel";
private static final Logger LOGGER = LoggerFactory.getLogger(Profiling.class);
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.core.profiling;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
package org.sonar.server.platform;
+import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableSet;
import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.sonar.api.config.Settings;
import org.sonar.core.profiling.Profiling;
import org.sonar.core.profiling.Profiling.Level;
import org.sonar.core.profiling.StopWatch;
*/
public class ProfilingFilter implements Filter {
+ private static final Logger LOG = LoggerFactory.getLogger(ProfilingFilter.class);
+
private static final String CONFIG_SEPARATOR = ",";
private static final String URL_SEPARATOR = "/";
// Nothing
}
-
+ @VisibleForTesting
Profiling getProfiling() {
try {
return (Profiling) Platform.component(Profiling.class);
} catch(Exception initException) {
- return null;
+ LOG.error("Could not initialize platform profiling", initException);
+ return new Profiling(new Settings());
}
}
}
public class SearchIndex {
+ private static final String BULK_EXECUTE_FAILED = "Execution of bulk operation failed";
+ private static final String BULK_INTERRUPTED = "Interrupted during bulk operation";
+
private static final String PROFILE_DOMAIN = "es";
private static final Logger LOG = LoggerFactory.getLogger(SearchIndex.class);
}
}
} catch (InterruptedException e) {
- LOG.error("Interrupted during bulk operation", e);
+ LOG.error(BULK_INTERRUPTED, e);
} catch (ExecutionException e) {
- LOG.error("Execution of bulk operation failed", e);
+ LOG.error(BULK_EXECUTE_FAILED, e);
} finally {
watch.stop("bulk index of %d documents with type '%s' into index '%s'", ids.length, type, index);
}
}
}
} catch (InterruptedException e) {
- LOG.error("Interrupted during bulk operation", e);
+ LOG.error(BULK_INTERRUPTED, e);
} catch (ExecutionException e) {
- LOG.error("Execution of bulk operation failed", e);
+ LOG.error(BULK_EXECUTE_FAILED, e);
} finally {
watch.stop("bulk delete of %d documents with type '%s' from index '%s'", ids.length, type, index);
}
public class SearchNode implements Startable {
private static final Logger LOG = LoggerFactory.getLogger(SearchIndex.class);
+
+ private static final String HTTP_ENABLED = "http.enabled";
private static final String INSTANCE_NAME = "sonarqube";
static final String DATA_DIR = "data/es";
int httpPort = settings.getInt("sonar.es.http.port");
if (httpPort > 0) {
LOG.warn("Elasticsearch HTTP console enabled on port {}. Only for debugging purpose.", httpPort);
- esSettings.put("http.enabled", true);
+ esSettings.put(HTTP_ENABLED, true);
esSettings.put("http.host", "127.0.0.1");
esSettings.put("http.port", httpPort);
} else {
- esSettings.put("http.enabled", false);
+ esSettings.put(HTTP_ENABLED, false);
}
}
import org.sonar.core.i18n.RuleI18nManager;
import javax.annotation.Nullable;
-import java.util.List;
+
import java.util.Locale;
import java.util.Map;