Java Code Examples for com.alibaba.otter.canal.instance.core.CanalInstance#isStart()
The following examples show how to use
com.alibaba.otter.canal.instance.core.CanalInstance#isStart() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CanalServerWithEmbedded.java From canal-1.1.3 with Apache License 2.0 | 6 votes |
public void stop() { super.stop(); for (Map.Entry<String, CanalInstance> entry : canalInstances.entrySet()) { try { CanalInstance instance = entry.getValue(); if (instance.isStart()) { try { String destination = entry.getKey(); MDC.put("destination", destination); entry.getValue().stop(); logger.info("stop CanalInstances[{}] successfully", destination); } finally { MDC.remove("destination"); } } } catch (Exception e) { logger.error(String.format("stop CanalInstance[%s] has an error", entry.getKey()), e); } } metrics.terminate(); }
Example 2
Source File: CanalServerWithEmbedded.java From canal-1.1.3 with Apache License 2.0 | 6 votes |
public void start(final String destination) { final CanalInstance canalInstance = canalInstances.get(destination); if (!canalInstance.isStart()) { try { MDC.put("destination", destination); if (metrics.isRunning()) { metrics.register(canalInstance); } // 启动canal instance canalInstance.start(); logger.info("start CanalInstances[{}] successfully", destination); } finally { MDC.remove("destination"); } } }
Example 3
Source File: CanalServerWithEmbedded.java From canal-1.1.3 with Apache License 2.0 | 6 votes |
public void stop(String destination) { CanalInstance canalInstance = canalInstances.remove(destination); if (canalInstance != null) { if (canalInstance.isStart()) { try { MDC.put("destination", destination); canalInstance.stop(); if (metrics.isRunning()) { metrics.unregister(canalInstance); } logger.info("stop CanalInstances[{}] successfully", destination); } finally { MDC.remove("destination"); } } } }
Example 4
Source File: CanalServerWithEmbedded.java From canal with Apache License 2.0 | 6 votes |
public void stop() { super.stop(); for (Map.Entry<String, CanalInstance> entry : canalInstances.entrySet()) { try { CanalInstance instance = entry.getValue(); if (instance.isStart()) { try { String destination = entry.getKey(); MDC.put("destination", destination); entry.getValue().stop(); logger.info("stop CanalInstances[{}] successfully", destination); } finally { MDC.remove("destination"); } } } catch (Exception e) { logger.error(String.format("stop CanalInstance[%s] has an error", entry.getKey()), e); } } metrics.terminate(); }
Example 5
Source File: CanalServerWithEmbedded.java From canal with Apache License 2.0 | 6 votes |
public void stop(String destination) { CanalInstance canalInstance = canalInstances.remove(destination); if (canalInstance != null) { if (canalInstance.isStart()) { try { MDC.put("destination", destination); canalInstance.stop(); if (metrics.isRunning()) { metrics.unregister(canalInstance); } logger.info("stop CanalInstances[{}] successfully", destination); } finally { MDC.remove("destination"); } } } }
Example 6
Source File: PrometheusService.java From canal-1.1.3 with Apache License 2.0 | 5 votes |
@Override public void register(CanalInstance instance) { if (instance.isStart()) { logger.warn("Cannot register metrics for destination {} that is running.", instance.getDestination()); return; } try { instanceExports.register(instance); } catch (Throwable t) { logger.warn("Unable to register instance exports for {}.", instance.getDestination(), t); } logger.info("Register metrics for destination {}.", instance.getDestination()); }
Example 7
Source File: PrometheusService.java From canal-1.1.3 with Apache License 2.0 | 5 votes |
@Override public void unregister(CanalInstance instance) { if (instance.isStart()) { logger.warn("Try unregister metrics after destination {} is stopped.", instance.getDestination()); } try { instanceExports.unregister(instance); } catch (Throwable t) { logger.warn("Unable to unregister instance exports for {}.", instance.getDestination(), t); } logger.info("Unregister metrics for destination {}.", instance.getDestination()); }
Example 8
Source File: CanalServerWithEmbedded.java From canal with Apache License 2.0 | 5 votes |
public void start(final String destination) { final CanalInstance canalInstance = canalInstances.get(destination); if (!canalInstance.isStart()) { try { MDC.put("destination", destination); if (metrics.isRunning()) { metrics.register(canalInstance); } canalInstance.start(); logger.info("start CanalInstances[{}] successfully", destination); } finally { MDC.remove("destination"); } } }
Example 9
Source File: PrometheusService.java From canal with Apache License 2.0 | 5 votes |
@Override public void register(CanalInstance instance) { if (instance.isStart()) { logger.warn("Cannot register metrics for destination {} that is running.", instance.getDestination()); return; } try { instanceExports.register(instance); } catch (Throwable t) { logger.warn("Unable to register instance exports for {}.", instance.getDestination(), t); } logger.info("Register metrics for destination {}.", instance.getDestination()); }
Example 10
Source File: PrometheusService.java From canal with Apache License 2.0 | 5 votes |
@Override public void unregister(CanalInstance instance) { if (instance.isStart()) { logger.warn("Try unregister metrics after destination {} is stopped.", instance.getDestination()); } try { instanceExports.unregister(instance); } catch (Throwable t) { logger.warn("Unable to unregister instance exports for {}.", instance.getDestination(), t); } logger.info("Unregister metrics for destination {}.", instance.getDestination()); }