use of com.alipay.sofa.ark.exception.ArkRuntimeException in project sofa-ark by alipay.
the class ZookeeperConfigActivator method registryResource.
protected void registryResource(String path, CreateMode createMode) {
try {
LOGGER.info("Registry context path: {} with mode: {}.", path, createMode);
zkClient.create().creatingParentContainersIfNeeded().withMode(createMode).forPath(path);
} catch (KeeperException.NodeExistsException nodeExistsException) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("Context path has exists in zookeeper, path=" + path);
}
} catch (Exception e) {
throw new ArkRuntimeException("Failed to register resource to zookeeper registry!", e);
}
}
use of com.alipay.sofa.ark.exception.ArkRuntimeException in project sofa-ark by alipay.
the class StandardTelnetServerImpl method run.
@Override
public void run() {
AssertUtils.isTrue(port > 0, "Telnet port should be positive integer.");
try {
LOGGER.info("Listening on port: " + port);
CommonThreadPool workerPool = new CommonThreadPool().setCorePoolSize(WORKER_THREAD_POOL_SIZE).setDaemon(true).setThreadPoolName(Constants.TELNET_SERVER_WORKER_THREAD_POOL_NAME);
ThreadPoolManager.registerThreadPool(Constants.TELNET_SERVER_WORKER_THREAD_POOL_NAME, workerPool);
nettyTelnetServer = new NettyTelnetServer(port, workerPool.getExecutor());
nettyTelnetServer.open();
} catch (InterruptedException e) {
LOGGER.error("Unable to open netty telnet server.", e);
throw new ArkRuntimeException(e);
}
}
use of com.alipay.sofa.ark.exception.ArkRuntimeException in project sofa-ark by alipay.
the class StandardTelnetServerImpl method shutdown.
@Override
public void shutdown() {
if (shutdown.compareAndSet(false, true)) {
try {
if (nettyTelnetServer != null) {
nettyTelnetServer.close();
nettyTelnetServer = null;
}
} catch (Throwable t) {
LOGGER.error("An error occurs when shutdown telnet server.", t);
throw new ArkRuntimeException(t);
}
}
}
use of com.alipay.sofa.ark.exception.ArkRuntimeException in project sofa-ark by alipay.
the class PluginDeployServiceImpl method unDeploy.
@Override
public void unDeploy() throws ArkRuntimeException {
List<Plugin> pluginsInOrder = pluginManagerService.getPluginsInOrder();
Collections.reverse(pluginsInOrder);
for (Plugin plugin : pluginsInOrder) {
try {
unDeployPlugin(plugin);
} catch (ArkRuntimeException e) {
LOGGER.error(String.format("UnDeploy plugin: %s meet error", plugin.getPluginName()), e);
throw e;
}
}
}
use of com.alipay.sofa.ark.exception.ArkRuntimeException in project sofa-ark by alipay.
the class ExtensionServiceTest method testExtensionServiceNotInstance.
@Test
public void testExtensionServiceNotInstance() {
PluginManagerService pluginManagerService = ArkServiceContainerHolder.getContainer().getService(PluginManagerService.class);
PluginModel pluginModel = new PluginModel().setPluginClassLoader(this.getClass().getClassLoader()).setPluginName("mock-plugin");
pluginManagerService.registerPlugin(pluginModel);
try {
ArkServiceLoader.loadExtensionFromArkPlugin(ServiceA.class, "", "mock-plugin");
} catch (ArkRuntimeException ex) {
Assert.assertTrue(ex.getMessage().contains("not type of"));
}
}
Aggregations