use of org.apache.hyracks.control.nc.partitions.PartitionManager in project asterixdb by apache.
the class NodeControllerService method start.
@Override
public void start() throws Exception {
LOGGER.log(Level.INFO, "Starting NodeControllerService");
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Setting uncaught exception handler " + getLifeCycleComponentManager());
}
Thread.currentThread().setUncaughtExceptionHandler(getLifeCycleComponentManager());
Runtime.getRuntime().addShutdownHook(new NCShutdownHook(this));
ipc = new IPCSystem(new InetSocketAddress(ncConfig.getClusterListenAddress(), ncConfig.getClusterListenPort()), new NodeControllerIPCI(this), new CCNCFunctions.SerializerDeserializer());
ipc.start();
partitionManager = new PartitionManager(this);
netManager = new NetworkManager(ncConfig.getDataListenAddress(), ncConfig.getDataListenPort(), partitionManager, ncConfig.getNetThreadCount(), ncConfig.getNetBufferCount(), ncConfig.getDataPublicAddress(), ncConfig.getDataPublicPort(), FullFrameChannelInterfaceFactory.INSTANCE);
netManager.start();
startApplication();
init();
datasetNetworkManager.start();
if (messagingNetManager != null) {
messagingNetManager.start();
}
IIPCHandle ccIPCHandle = ipc.getHandle(new InetSocketAddress(ncConfig.getClusterAddress(), ncConfig.getClusterPort()), ncConfig.getClusterConnectRetries());
this.ccs = new ClusterControllerRemoteProxy(ccIPCHandle);
HeartbeatSchema.GarbageCollectorInfo[] gcInfos = new HeartbeatSchema.GarbageCollectorInfo[gcMXBeans.size()];
for (int i = 0; i < gcInfos.length; ++i) {
gcInfos[i] = new HeartbeatSchema.GarbageCollectorInfo(gcMXBeans.get(i).getName());
}
HeartbeatSchema hbSchema = new HeartbeatSchema(gcInfos);
// Use "public" versions of network addresses and ports
NetworkAddress datasetAddress = datasetNetworkManager.getPublicNetworkAddress();
NetworkAddress netAddress = netManager.getPublicNetworkAddress();
NetworkAddress meesagingPort = messagingNetManager != null ? messagingNetManager.getPublicNetworkAddress() : null;
int allCores = osMXBean.getAvailableProcessors();
ccs.registerNode(new NodeRegistration(ipc.getSocketAddress(), id, ncConfig, netAddress, datasetAddress, osMXBean.getName(), osMXBean.getArch(), osMXBean.getVersion(), allCores, runtimeMXBean.getVmName(), runtimeMXBean.getVmVersion(), runtimeMXBean.getVmVendor(), runtimeMXBean.getClassPath(), runtimeMXBean.getLibraryPath(), runtimeMXBean.getBootClassPath(), runtimeMXBean.getInputArguments(), runtimeMXBean.getSystemProperties(), hbSchema, meesagingPort, application.getCapacity(), PidHelper.getPid()));
synchronized (this) {
while (registrationPending) {
wait();
}
}
if (registrationException != null) {
throw registrationException;
}
serviceCtx.setDistributedState(nodeParameters.getDistributedState());
workQueue.start();
heartbeatTask = new HeartbeatTask(ccs);
// Use reflection to set the priority of the timer thread.
Field threadField = timer.getClass().getDeclaredField("thread");
threadField.setAccessible(true);
// The internal timer thread of the Timer object.
Thread timerThread = (Thread) threadField.get(timer);
timerThread.setPriority(Thread.MAX_PRIORITY);
// Schedule heartbeat generator.
timer.schedule(heartbeatTask, 0, nodeParameters.getHeartbeatPeriod());
if (nodeParameters.getProfileDumpPeriod() > 0) {
// Schedule profile dump generator.
timer.schedule(new ProfileDumpTask(ccs), 0, nodeParameters.getProfileDumpPeriod());
}
LOGGER.log(Level.INFO, "Started NodeControllerService");
application.startupCompleted();
}
Aggregations