Buggy code:
public class Stats implements OgnAircraftBeaconForwarder , OgnReceiverBeaconForwarder { private static Logger LOG = LoggerFactory . getLogger ( Stats . class ) ; private static final String VERSION = "0.0.1" ; private static final float MIN_RANGE = 50.0F ; private static final float MAX_RANGE = 300.0F ; private static ConcurrentMap < String , ReceiverBeacon > activeReceiversCache = new ConcurrentHashMap < > ( ) ; private static ConcurrentMap < String , AtomicInteger > dailyRecCounters = new ConcurrentHashMap < > ( ) ; private static ConcurrentMap < String , Object [ ] > dailyAltCache = new ConcurrentHashMap < > ( ) ; private static StatsService service ; private static ClassPathXmlApplicationContext ctx ; private static Object syncMonitor = new Integer ( 1 ) ; private static volatile boolean initialized = false ; private static Future < ? > receiversCountFuture ; private static ScheduledExecutorService scheduler ; private final ReentrantReadWriteLock fLock = new ReentrantReadWriteLock ( ) ; private final Lock fReadLock = fLock . readLock ( ) ; private final Lock fWriteLock = fLock . writeLock ( ) ; @ Service @ ManagedResource ( objectName = "org.ogn.gateway.plugin.stats:name=Stats" , description = "OGN<seq2seq4repair_space>gateway<seq2seq4repair_space>statistics<seq2seq4repair_space>collector<seq2seq4repair_space>plugin" ) public static class StatsMBean { @ ManagedAttribute public long getReceiversCacheSize ( ) { } @ ManagedAttribute public Map < String , AtomicInteger > getDailyRecCounters ( ) { } @ ManagedAttribute public long getAlitudesCacheSize ( ) { } @ ManagedAttribute public Map < String , Object [ ] > getDailyAltCache ( ) { } @ Scheduled ( cron = "1<seq2seq4repair_space>0<seq2seq4repair_space>0<seq2seq4repair_space>*<seq2seq4repair_space>*<seq2seq4repair_space>?" ) public void cleanDailyCaches ( ) { } } @ Override public String getName ( ) { } @ Override public String getVersion ( ) { } @ Override public String getDescription ( ) { } @ Override public void init ( ) { synchronized ( Stats . syncMonitor ) { if ( ! ( Stats . initialized ) ) { try { Stats . ctx = new ClassPathXmlApplicationContext ( "classpath:stats-application-context.xml" ) ; Stats . ctx . getEnvironment ( ) . setDefaultProfiles ( "PRO" ) ; Stats . service = Stats . ctx . getBean ( StatsService . class ) ; Stats . initialized = true ; } catch ( Exception ex ) { Stats . LOG . error ( "context<seq2seq4repair_space>initialization<seq2seq4repair_space>failed" , ex ) ; } Stats . scheduler = Executors . newScheduledThreadPool ( 1 ) ; Stats . receiversCountFuture = Stats . scheduler . scheduleAtFixedRate ( new Runnable ( ) { @ Override public void run ( ) { try { long date = TimeDateUtils . removeTime ( System . currentTimeMillis ( ) ) ; Stats . LOG . debug ( "current<seq2seq4repair_space>activeReceiversCache<seq2seq4repair_space>size:<seq2seq4repair_space>{}" , Stats . activeReceiversCache . size ( ) ) ; Stats . service . insertOrUpdateActiveReceiversCount ( date , Stats . activeReceiversCache . size ( ) ) ; Stats . LOG . debug ( "current<seq2seq4repair_space>daily<seq2seq4repair_space>receiver<seq2seq4repair_space>counter's<seq2seq4repair_space>cache<seq2seq4repair_space>size:<seq2seq4repair_space>{}" , Stats . dailyRecCounters . size ( ) ) ; Stats . service . insertOrUpdateReceivedBeaconsCounters ( date , Stats . dailyRecCounters ) ; Stats . LOG . debug ( "current<seq2seq4repair_space>daily<seq2seq4repair_space>receiver<seq2seq4repair_space>max-alt<seq2seq4repair_space>cache<seq2seq4repair_space>size:<seq2seq4repair_space>{}" , Stats . dailyAltCache . size ( ) ) ; for ( Map . Entry < String , Object [ ] > entry : Stats . dailyAltCache . entrySet ( ) ) { fReadLock . lock ( ) ; Object [ ] maxAltAircraft = entry . getValue ( ) ; <START_BUG> Stats . service . insertOrUpdateReceivedBeaconsMaxAlt ( date , entry . getKey ( ) , ( ( String ) ( maxAltAircraft [ 0 ] ) ) , ( ( String ) ( maxAltAircraft [ 1 ] ) ) , ( ( float ) ( maxAltAircraft [ 2 ] ) ) ) ; <END_BUG> fReadLock . unlock ( ) ; } Stats . activeReceiversCache . clear ( ) ; } catch ( Exception ex ) { Stats . LOG . error ( "exception<seq2seq4repair_space>caught" , ex ) ; } } } , 6 , 12 , TimeUnit . MINUTES ) ; } } } @ Override public void stop ( ) { } @ Override public void onBeacon ( AircraftBeacon beacon , AircraftDescriptor descriptor ) { } @ Override public void onBeacon ( ReceiverBeacon beacon ) { } }

Fix:
Stats . service . insertOrUpdateReceivedBeaconsMaxAlt ( ( ( long ) ( maxAltAircraft [ 3 ] ) ) , entry . getKey ( ) , ( ( String ) ( maxAltAircraft [ 0 ] ) ) , ( ( String ) ( maxAltAircraft [ 1 ] ) ) , ( ( float ) ( maxAltAircraft [ 2 ] ) ) ) ;