use of com.alibaba.maxgraph.compiler.api.exception.MaxGraphException in project GraphScope by alibaba.
the class StoreService method start.
public void start() throws IOException {
logger.info("starting StoreService...");
List<Integer> partitionIds = this.metaService.getPartitionsByStoreId(this.storeId);
this.idToPartition = new HashMap<>(partitionIds.size());
for (int partitionId : partitionIds) {
try {
GraphPartition partition = makeGraphPartition(this.configs, partitionId);
this.idToPartition.put(partitionId, partition);
} catch (IOException e) {
throw new MaxGraphException(e);
}
}
initMetrics();
this.shouldStop = false;
this.writeExecutor = new ThreadPoolExecutor(writeThreadCount, writeThreadCount, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), ThreadFactoryUtils.daemonThreadFactoryWithLogExceptionHandler("store-write", logger));
this.ingestExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1), ThreadFactoryUtils.daemonThreadFactoryWithLogExceptionHandler("store-ingest", logger));
this.garbageCollectExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), ThreadFactoryUtils.daemonThreadFactoryWithLogExceptionHandler("store-garbage-collect", logger));
logger.info("StoreService started. storeId [" + this.storeId + "]");
}
use of com.alibaba.maxgraph.compiler.api.exception.MaxGraphException in project GraphScope by alibaba.
the class KafkaLogService method init.
@Override
public void init() {
AdminClient admin = getAdmin();
NewTopic newTopic = new NewTopic(this.topic, this.queueCount, this.replicationFactor);
Map<String, String> configs = new HashMap<>();
configs.put("retention.ms", "-1");
configs.put("retention.bytes", "-1");
configs.put("max.message.bytes", String.valueOf(this.maxMessageMb * 1024 * 1024));
newTopic.configs(configs);
try {
admin.createTopics(Collections.singleton(newTopic)).all().get();
} catch (InterruptedException | ExecutionException e) {
throw new MaxGraphException("create topics [" + this.topic + "] failed", e);
}
}
use of com.alibaba.maxgraph.compiler.api.exception.MaxGraphException in project GraphScope by alibaba.
the class ReadOnlyGraphServer method start.
@Override
public void start() {
this.loadSettings();
logger.info(GremlinServer.getHeader());
this.settings.port = GremlinConfig.GREMLIN_PORT.get(this.configs);
this.settings.host = "0.0.0.0";
if (settings.gremlinPool == 0) {
settings.gremlinPool = Runtime.getRuntime().availableProcessors();
}
if (StringUtils.equals(settings.channelizer, WsAndHttpChannelizer.class.getName())) {
settings.channelizer = MaxGraphWsAndHttpSocketChannelizer.class.getName();
} else {
throw new IllegalArgumentException("Not support for channelizer=>" + settings.channelizer);
}
settings.writeBufferHighWaterMark = GremlinConfig.SERVER_WRITE_BUFFER_HIGH_WATER.get(this.configs);
settings.writeBufferLowWaterMark = GremlinConfig.SERVER_WRITE_BUFFER_LOW_WATER.get(this.configs);
this.server = new GremlinServer(settings);
ServerGremlinExecutor serverGremlinExecutor = Utils.getFieldValue(GremlinServer.class, this.server, "serverGremlinExecutor");
serverGremlinExecutor.getGraphManager().putGraph("graph", graph);
serverGremlinExecutor.getGraphManager().putTraversalSource("g", graph.traversal());
GremlinExecutor gremlinExecutor = Utils.getFieldValue(ServerGremlinExecutor.class, serverGremlinExecutor, "gremlinExecutor");
Bindings globalBindings = Utils.getFieldValue(GremlinExecutor.class, gremlinExecutor, "globalBindings");
globalBindings.put("graph", graph);
globalBindings.put("g", graph.traversal());
ProcessorLoader processorLoader = new ReadOnlyMaxGraphProcessorLoader(this.configs, this.graph, this.schemaFetcher, this.rpcAddressFetcher);
try {
processorLoader.loadProcessor(settings);
} catch (Exception e) {
throw new MaxGraphException(e);
}
try {
this.server.start().exceptionally(t -> {
logger.error("Gremlin Server was unable to start and will now begin" + " shutdown: {}", t.getMessage());
this.server.stop().join();
return null;
}).join();
} catch (Exception e) {
throw new RuntimeException(e);
}
logger.info("Gremlin Server started....");
}
use of com.alibaba.maxgraph.compiler.api.exception.MaxGraphException in project GraphScope by alibaba.
the class NodeLauncher method start.
public void start() {
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
try {
this.node.close();
} catch (Exception e) {
logger.error("failed to stop node", e);
}
}));
Runtime.getRuntime().addShutdownHook(new Thread(() -> keepAliveLatch.countDown()));
try {
this.node.start();
} catch (Exception e) {
logger.error("start node failed", e);
throw new MaxGraphException(e);
}
this.keepAliveThread.start();
}
Aggregations