com.kolibrifx.plovercrest.server.PlovercrestEngineBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plovercrest-server Show documentation
Show all versions of plovercrest-server Show documentation
Plovercrest server library.
The newest version!
/*
* Copyright (c) 2010-2017, KolibriFX AS. Licensed under the Apache License, version 2.0.
*/
package com.kolibrifx.plovercrest.server;
import com.kolibrifx.plovercrest.server.internal.EventDispatcher;
import com.kolibrifx.plovercrest.server.internal.ThreadedEventDispatcher;
import com.kolibrifx.plovercrest.server.internal.engine.LeastRecentlyUsedCache;
public class PlovercrestEngineBuilder {
private final String dataPath;
private EventDispatcher dispatcher = null;
private LeastRecentlyUsedCache cache =
new LeastRecentlyUsedCache<>(PlovercrestEngine.DEFAULT_TABLE_CACHE_SIZE);
public PlovercrestEngineBuilder(final String dataPath) {
this.dataPath = dataPath;
}
/**
* Note: the {@link PlovercrestEngine} will take ownership of the given dispatcher.
*/
public PlovercrestEngineBuilder dispatcher(final EventDispatcher dispatcher) {
this.dispatcher = dispatcher;
return this;
}
public PlovercrestEngineBuilder cache(final LeastRecentlyUsedCache cache) {
this.cache = cache;
return this;
}
public PlovercrestEngine build() {
return new PlovercrestEngine(dataPath, dispatcher == null ? new ThreadedEventDispatcher() : dispatcher, cache);
}
}