Java Code Examples for com.alibaba.otter.canal.instance.core.CanalInstance#getEventStore()
The following examples show how to use
com.alibaba.otter.canal.instance.core.CanalInstance#getEventStore() .
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: StoreCollector.java From canal-1.1.3 with Apache License 2.0 | 5 votes |
@Override public void register(CanalInstance instance) { final String destination = instance.getDestination(); StoreMetricsHolder holder = new StoreMetricsHolder(); CanalEventStore store = instance.getEventStore(); if (!(store instanceof MemoryEventStoreWithBuffer)) { throw new IllegalArgumentException("EventStore must be MemoryEventStoreWithBuffer"); } MemoryEventStoreWithBuffer memStore = (MemoryEventStoreWithBuffer) store; holder.batchMode = memStore.getBatchMode(); holder.putSeq = memStore.getPutSequence(); holder.ackSeq = memStore.getAckSequence(); holder.destLabelValues = Collections.singletonList(destination); holder.size = memStore.getBufferSize(); holder.storeLabelValues = Arrays.asList(destination, holder.batchMode.name(), Integer.toString(holder.size)); holder.putExecTime = memStore.getPutExecTime(); holder.getExecTime = memStore.getGetExecTime(); holder.ackExecTime = memStore.getAckExecTime(); holder.putTableRows = memStore.getPutTableRows(); holder.getTableRows = memStore.getGetTableRows(); holder.ackTableRows = memStore.getAckTableRows(); Preconditions.checkNotNull(holder.batchMode); Preconditions.checkNotNull(holder.putSeq); Preconditions.checkNotNull(holder.ackSeq); if (holder.batchMode.isMemSize()) { holder.putMemSize = memStore.getPutMemSize(); holder.ackMemSize = memStore.getAckMemSize(); Preconditions.checkNotNull(holder.putMemSize); Preconditions.checkNotNull(holder.ackMemSize); } StoreMetricsHolder old = instances.putIfAbsent(destination, holder); if (old != null) { logger.warn("Remote stale StoreCollector for instance {}.", destination); } }
Example 2
Source File: StoreCollector.java From canal with Apache License 2.0 | 5 votes |
@Override public void register(CanalInstance instance) { final String destination = instance.getDestination(); StoreMetricsHolder holder = new StoreMetricsHolder(); CanalEventStore store = instance.getEventStore(); if (!(store instanceof MemoryEventStoreWithBuffer)) { throw new IllegalArgumentException("EventStore must be MemoryEventStoreWithBuffer"); } MemoryEventStoreWithBuffer memStore = (MemoryEventStoreWithBuffer) store; holder.batchMode = memStore.getBatchMode(); holder.putSeq = memStore.getPutSequence(); holder.ackSeq = memStore.getAckSequence(); holder.destLabelValues = Collections.singletonList(destination); holder.size = memStore.getBufferSize(); holder.storeLabelValues = Arrays.asList(destination, holder.batchMode.name(), Integer.toString(holder.size)); holder.putExecTime = memStore.getPutExecTime(); holder.getExecTime = memStore.getGetExecTime(); holder.ackExecTime = memStore.getAckExecTime(); holder.putTableRows = memStore.getPutTableRows(); holder.getTableRows = memStore.getGetTableRows(); holder.ackTableRows = memStore.getAckTableRows(); Preconditions.checkNotNull(holder.batchMode); Preconditions.checkNotNull(holder.putSeq); Preconditions.checkNotNull(holder.ackSeq); if (holder.batchMode.isMemSize()) { holder.putMemSize = memStore.getPutMemSize(); holder.ackMemSize = memStore.getAckMemSize(); Preconditions.checkNotNull(holder.putMemSize); Preconditions.checkNotNull(holder.ackMemSize); } StoreMetricsHolder old = instances.putIfAbsent(destination, holder); if (old != null) { logger.warn("Remote stale StoreCollector for instance {}.", destination); } }