use of com.bakdata.conquery.io.mina.ChunkReader in project conquery by bakdata.
the class ManagerNode method start.
@Override
public void start() throws Exception {
acceptor = new NioSocketAcceptor();
ObjectMapper om = Jackson.copyMapperAndInjectables(Jackson.BINARY_MAPPER);
config.configureObjectMapper(om);
BinaryJacksonCoder coder = new BinaryJacksonCoder(datasetRegistry, validator, om);
acceptor.getFilterChain().addLast("codec", new CQProtocolCodecFilter(new ChunkWriter(coder), new ChunkReader(coder, om)));
acceptor.setHandler(this);
acceptor.getSessionConfig().setAll(config.getCluster().getMina());
acceptor.bind(new InetSocketAddress(config.getCluster().getPort()));
log.info("Started ManagerNode @ {}", acceptor.getLocalAddress());
}
use of com.bakdata.conquery.io.mina.ChunkReader in project conquery by bakdata.
the class ShardNode method start.
@Override
public void start() throws Exception {
for (Worker value : workers.getWorkers().values()) {
value.getJobManager().addSlowJob(new SimpleJob("Update Bucket Manager", value.getBucketManager()::fullUpdate));
}
ObjectMapper om = Jackson.copyMapperAndInjectables(Jackson.BINARY_MAPPER);
config.configureObjectMapper(om);
BinaryJacksonCoder coder = new BinaryJacksonCoder(workers, validator, om);
connector.getFilterChain().addLast("codec", new CQProtocolCodecFilter(new ChunkWriter(coder), new ChunkReader(coder, om)));
connector.setHandler(this);
connector.getSessionConfig().setAll(config.getCluster().getMina());
InetSocketAddress address = new InetSocketAddress(config.getCluster().getManagerURL().getHostAddress(), config.getCluster().getPort());
while (true) {
try {
log.info("Trying to connect to {}", address);
// Try opening a connection (Note: This fails immediately instead of waiting a minute to try and connect)
ConnectFuture future = connector.connect(address);
future.awaitUninterruptibly();
if (future.isConnected()) {
break;
}
future.cancel();
// Sleep thirty seconds then retry.
TimeUnit.SECONDS.sleep(30);
} catch (RuntimeIoException e) {
log.warn("Failed to connect to " + address, e);
}
}
}
Aggregations