static RemoteStatListenerImpl create(int listenerId, InternalDistributedMember recipient, long resourceId, String statName, HostStatSampler sampler) { RemoteStatListenerImpl result = null; Statistics stats = sampler.getStatisticsManager().findStatistics(resourceId); StatisticDescriptorImpl stat = (StatisticDescriptorImpl)stats.nameToDescriptor(statName); switch (stat.getTypeCode()) { case StatisticDescriptorImpl.BYTE: case StatisticDescriptorImpl.SHORT: case StatisticDescriptorImpl.INT: case StatisticDescriptorImpl.LONG: result = new LongStatListenerImpl(); break; case StatisticDescriptorImpl.FLOAT: result = new FloatStatListenerImpl(); break; case StatisticDescriptorImpl.DOUBLE: result = new DoubleStatListenerImpl(); break; default: throw new RuntimeException(LocalizedStrings.GemFireStatSampler_ILLEGAL_FIELD_TYPE_0_FOR_STATISTIC.toLocalizedString(stats.getType())); } result.stats = stats; result.stat = stat; result.listenerId = listenerId; result.recipient = recipient; return result; }
static RemoteStatListenerImpl create(int listenerId, InternalDistributedMember recipient, long resourceId, String statName, HostStatSampler sampler) { RemoteStatListenerImpl result = null; Statistics stats = sampler.getStatisticsManager().findStatistics(resourceId); StatisticDescriptorImpl stat = (StatisticDescriptorImpl)stats.nameToDescriptor(statName); switch (stat.getTypeCode()) { case StatisticDescriptorImpl.BYTE: case StatisticDescriptorImpl.SHORT: case StatisticDescriptorImpl.INT: case StatisticDescriptorImpl.LONG: result = new LongStatListenerImpl(); break; case StatisticDescriptorImpl.FLOAT: result = new FloatStatListenerImpl(); break; case StatisticDescriptorImpl.DOUBLE: result = new DoubleStatListenerImpl(); break; default: throw new RuntimeException(LocalizedStrings.GemFireStatSampler_ILLEGAL_FIELD_TYPE_0_FOR_STATISTIC.toLocalizedString(stats.getType())); } result.stats = stats; result.stat = stat; result.listenerId = listenerId; result.recipient = recipient; return result; }