Skip to content
Permalink
Browse files
Small changes related to configs
  • Loading branch information
dspavlov committed May 20, 2019
1 parent 0aee19b commit fe4d5190b23625ca89e8fd945d65201639da761d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 24 deletions.
@@ -72,12 +72,6 @@ public Ignite startIgnite() {
protected String ignitionStart() {
System.out.println("Starting Ignite Server Node, " + Version.VERSION);

/* try {
Thread.sleep(30*1000);
} catch (InterruptedException e) {
e.printStackTrace();
}*/

final IgniteConfiguration cfg = getIgniteConfiguration();

this.ignite = Ignition.start(cfg);
@@ -90,11 +84,7 @@ protected String ignitionStart() {
@AutoProfiling
protected String activate() {
System.out.println("Activating Ignite Server Node, " + Version.VERSION);
/* try {
Thread.sleep(30*1000);
} catch (InterruptedException e) {
e.printStackTrace();
}*/

ignite.cluster().active(true);

System.out.println("Activate Completed");
@@ -140,13 +130,13 @@ protected Ignite init() {
}

public Future<Ignite> getIgniteFuture() {
final FutureTask<Ignite> futureTask = new FutureTask<>(this::init);
final FutureTask<Ignite> futTask = new FutureTask<>(this::init);

if (igniteFutureRef.compareAndSet(null, futureTask)) {
final Thread thread = new Thread(futureTask, "ignite-1-init-thread");
if (igniteFutureRef.compareAndSet(null, futTask)) {
final Thread thread = new Thread(futTask, "ignite-1-init-thread");
thread.start();

return futureTask;
return futTask;
}
else
return igniteFutureRef.get();
@@ -121,8 +121,10 @@ public static DataRegionConfiguration getDataRegionConfiguration() {

static DataStorageConfiguration getDataStorageConfiguration(DataRegionConfiguration regConf) {
return new DataStorageConfiguration()
// .setWalCompactionEnabled(true)
.setWalMode(WALMode.LOG_ONLY)
.setWalHistorySize(1)
// .setMaxWalArchiveSize(4L * 1024 * 1024 * 1024)
.setCheckpointFrequency(5 * 60 * 1000)
.setWriteThrottlingEnabled(true)
.setDefaultDataRegionConfiguration(regConf);
@@ -96,11 +96,8 @@ public static void stop(Ignite ignite) {
/** */
@NotNull
public static <K, V> CacheConfiguration<K, V> getCacheV3Config(String name) {
CacheConfiguration<K, V> ccfg = new CacheConfiguration<>(name);

ccfg.setAffinity(new RendezvousAffinityFunction(false, 8));

return ccfg;
return new CacheConfiguration<K, V>(name)
.setAffinity(new RendezvousAffinityFunction(false, 8));
}

/** */
@@ -21,6 +21,7 @@
import com.google.inject.Guice;
import com.google.inject.Injector;
import java.io.IOException;
import javax.annotation.Nullable;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
@@ -32,12 +33,15 @@
import org.apache.ignite.ci.tcbot.issue.IssueDetector;
import org.apache.ignite.ci.teamcity.pure.TeamcityRecorder;
import org.apache.ignite.ci.teamcity.restcached.ITcServerProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
*/
public class CtxListener implements ServletContextListener {
/** Javax.Injector property code for servlet context. */
public static final String INJECTOR = "injector";
@Nullable private static volatile Logger logger;

public static Injector getInjector(ServletContext ctx) {
return (Injector)ctx.getAttribute(INJECTOR);
@@ -70,6 +74,8 @@ private void initLoggerBridge() {
rootLog.removeHandler(handlers[i]);

org.slf4j.bridge.SLF4JBridgeHandler.install();

logger = LoggerFactory.getLogger(CtxListener.class);
}

/** {@inheritDoc} */
@@ -79,7 +85,6 @@ private void initLoggerBridge() {
Injector injector = getInjector(ctx);

try {

injector.getInstance(IssueDetector.class).stop();
injector.getInstance(TcUpdatePool.class).stop();
injector.getInstance(BuildObserver.class).stop();
@@ -88,19 +93,29 @@ private void initLoggerBridge() {
}
catch (Exception e) {
e.printStackTrace();

if (logger != null)
logger.error("Exception during shutdown: " + e.getMessage(), e);
}

try {
injector.getInstance(TeamcityRecorder.class).stop();
} catch (IOException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();

if (logger != null)
logger.error("Exception during shutdown: " + e.getMessage(), e);
}

try {
TcHelperDb.stop(injector.getInstance(Ignite.class));
} catch (Exception e) {
}
catch (Exception e) {
e.printStackTrace();

if (logger != null)
logger.error("Exception during shutdown: " + e.getMessage(), e);
}
}
}

0 comments on commit fe4d519

Please sign in to comment.