= cold cleanup

* using lambda if possible (we are already building in Java8)
  * using diamond when new generic instance
  * remove used improt
This commit is contained in:
zavakid
2020-09-17 10:48:15 +08:00
parent df60eda679
commit e7658879bc
133 changed files with 990 additions and 1558 deletions

View File

@@ -31,7 +31,7 @@ public class EntryCollector extends Collector implements InstanceRegistry {
private static final String TRANSACTION = "canal_instance_transactions";
private static final String DELAY_HELP = "Traffic delay of canal instance in milliseconds";
private static final String TRANSACTION_HELP = "Transactions counter of canal instance";
private final ConcurrentMap<String, EntryMetricsHolder> instances = new ConcurrentHashMap<String, EntryMetricsHolder>();
private final ConcurrentMap<String, EntryMetricsHolder> instances = new ConcurrentHashMap<>();
private EntryCollector() {}
@@ -45,7 +45,7 @@ public class EntryCollector extends Collector implements InstanceRegistry {
@Override
public List<MetricFamilySamples> collect() {
List<MetricFamilySamples> mfs = new ArrayList<MetricFamilySamples>();
List<MetricFamilySamples> mfs = new ArrayList<>();
GaugeMetricFamily delay = new GaugeMetricFamily(DELAY,
DELAY_HELP, DEST_LABELS_LIST);
CounterMetricFamily transactions = new CounterMetricFamily(TRANSACTION,

View File

@@ -28,7 +28,7 @@ public class MetaCollector extends Collector implements InstanceRegistry {
private static final String INSTANCE_HELP = "Canal instance";
private static final String SUBSCRIPTION = "canal_instance_subscriptions";
private static final String SUBSCRIPTION_HELP = "Canal instance subscriptions";
private final ConcurrentMap<String, MetaMetricsHolder> instances = new ConcurrentHashMap<String, MetaMetricsHolder>();
private final ConcurrentMap<String, MetaMetricsHolder> instances = new ConcurrentHashMap<>();
private MetaCollector() {}
@@ -42,7 +42,7 @@ public class MetaCollector extends Collector implements InstanceRegistry {
@Override
public List<MetricFamilySamples> collect() {
List<MetricFamilySamples> mfs = new ArrayList<MetricFamilySamples>();
List<MetricFamilySamples> mfs = new ArrayList<>();
GaugeMetricFamily instanceInfo = new GaugeMetricFamily(INSTANCE,
INSTANCE_HELP, INFO_LABELS_LIST);
GaugeMetricFamily subsInfo = new GaugeMetricFamily(SUBSCRIPTION,

View File

@@ -29,7 +29,7 @@ public class SinkCollector extends Collector implements InstanceRegistry {
private static final long NANO_PER_MILLI = 1000 * 1000L;
private static final String SINK_BLOCKING_TIME = "canal_instance_sink_blocking_time";
private static final String SINK_BLOCK_TIME_HELP = "Total sink blocking time in milliseconds";
private final ConcurrentMap<String, SinkMetricsHolder> instances = new ConcurrentHashMap<String, SinkMetricsHolder>();
private final ConcurrentMap<String, SinkMetricsHolder> instances = new ConcurrentHashMap<>();
private SinkCollector(){
}
@@ -45,7 +45,7 @@ public class SinkCollector extends Collector implements InstanceRegistry {
@Override
public List<MetricFamilySamples> collect() {
List<MetricFamilySamples> mfs = new ArrayList<MetricFamilySamples>();
List<MetricFamilySamples> mfs = new ArrayList<>();
CounterMetricFamily blockingCounter = new CounterMetricFamily(SINK_BLOCKING_TIME,
SINK_BLOCK_TIME_HELP,
DEST_LABELS_LIST);

View File

@@ -51,7 +51,7 @@ public class StoreCollector extends Collector implements InstanceRegistry {
private static final String PUT_ROWS_HELP = "Put table rows of canal instance";
private static final String GET_ROWS_HELP = "Got table rows of canal instance";
private static final String ACK_ROWS_HELP = "Acked table rows of canal instance";
private final ConcurrentMap<String, StoreMetricsHolder> instances = new ConcurrentHashMap<String, StoreMetricsHolder>();
private final ConcurrentMap<String, StoreMetricsHolder> instances = new ConcurrentHashMap<>();
private final List<String> storeLabelsList = Arrays.asList(DEST, "batchMode", "size");
private StoreCollector() {}
@@ -66,7 +66,7 @@ public class StoreCollector extends Collector implements InstanceRegistry {
@Override
public List<MetricFamilySamples> collect() {
List<MetricFamilySamples> mfs = new ArrayList<MetricFamilySamples>();
List<MetricFamilySamples> mfs = new ArrayList<>();
CounterMetricFamily put = new CounterMetricFamily(PRODUCE,
PRODUCE_HELP, DEST_LABELS_LIST);
CounterMetricFamily ack = new CounterMetricFamily(CONSUME,