/** * Handles the given raw data for a registry record. * * @param buffer * Byte buffer containing the raw data for the record */ protected void handleRegistryRecord(final ByteBuffer buffer) { this.registryRecordHandler.enqueueRegistryRecord(buffer); }
@Override public void run() { while (true) { try { final ByteBuffer nextRecord = this.queue.take(); this.readRegistryRecord(nextRecord); } catch (final InterruptedException e) { LOGGER.error("Registry record handler was interrupted", e); } } }
private void readRegistryRecord(final ByteBuffer buffer) { try { final long registryId = buffer.getLong(); final ReaderRegistry<String> stringRegistry = this.getStringRegistry(registryId); RegistryRecord.registerRecordInRegistry(buffer, stringRegistry); } catch (final BufferUnderflowException e) { LOGGER.error("Buffer underflow while reading registry record", e); } }
@Override public boolean init() { final boolean superInitSucceeded = super.init(); if (!superInitSucceeded) { return false; } // Set up record handlers this.registryRecordHandler = new RegistryRecordHandler(this.stringRegistryLookup); this.regularRecordHandler = new RegularRecordHandler(this, this.stringRegistryLookup); // Set up threads this.registryRecordHandlerThread = new Thread(this.registryRecordHandler); this.registryRecordHandlerThread.setDaemon(true); this.regularRecordHandlerThread = new Thread(this.regularRecordHandler); this.regularRecordHandlerThread.setDaemon(true); return true; }
private void readRegistryRecord(final ByteBuffer buffer) { try { final long registryId = buffer.getLong(); final ILookup<String> stringRegistry = this.getStringRegistry(registryId); RegistryRecord.registerRecordInRegistry(buffer, stringRegistry); } catch (final BufferUnderflowException e) { LOG.error("Buffer underflow while reading registry record", e); } }
@Override public boolean init() { final boolean superInitSucceeded = super.init(); if (!superInitSucceeded) { return false; } // Set up record handlers this.registryRecordHandler = new RegistryRecordHandler(this.stringRegistryLookup); this.regularRecordHandler = new RegularRecordHandler(this, this.stringRegistryLookup); // Set up threads this.registryRecordHandlerThread = new Thread(this.registryRecordHandler); this.registryRecordHandlerThread.setDaemon(true); this.regularRecordHandlerThread = new Thread(this.regularRecordHandler); this.regularRecordHandlerThread.setDaemon(true); return true; }
@Override public void run() { while (true) { try { final ByteBuffer nextRecord = this.queue.take(); this.readRegistryRecord(nextRecord); } catch (final InterruptedException e) { LOG.error("Registry record handler was interrupted", e); } } }
/** * Handles the given raw data for a registry record. * * @param buffer * Byte buffer containing the raw data for the record */ protected void handleRegistryRecord(final ByteBuffer buffer) { this.registryRecordHandler.enqueueRegistryRecord(buffer); }