@Override public IMonitoringRecord deserializeNextRecord() throws ConnectorDataTransmissionException, ConnectorEndOfDataException { try { return this.recordQueue.take(); } catch (final InterruptedException ex) { throw new ConnectorDataTransmissionException("Connector has been interrupted", ex); } }
/** * Implements the deserializeNextRecord interface. Fetches deserialized data from the recordQeue * which is filled by the connection listener threads. * * @throws ConnectorDataTransmissionException * if the record reading is interrupted * @throws ConnectorEndOfDataException * if end of all data streams are reached * @return one IMonitoringRecord per call */ @Override public IMonitoringRecord deserializeNextRecord() throws ConnectorDataTransmissionException, ConnectorEndOfDataException { try { return this.recordQueue.take(); } catch (final InterruptedException e) { if (this.recordQueue.isEmpty()) { throw new ConnectorEndOfDataException("End of all streams reached", e); } else { throw new ConnectorDataTransmissionException(e.getMessage(), e); } } }
@Override public void close() throws ConnectorDataTransmissionException { try { super.close(); this.broker.stop(); // Cannot be avoided as the broker throws Exception. } catch (final Exception e) { // NOCS, NOPMD throw new ConnectorDataTransmissionException(e.getMessage(), e); } } }
/** * Initialize a service connector and trigger a failure on error. */ protected void initialize() { try { LOGGER.info("Initialize connector {}", this.connector.getClass().toString()); this.connector.initialize(); } catch (final ConnectorDataTransmissionException e) { Assert.fail("Connector initialization failed: " + e.getMessage()); } }
LOGGER.debug("Receive record {}", i); try { final OperationExecutionRecord record = (OperationExecutionRecord) this.connector.deserializeNextRecord(); Assert.assertEquals("Tin is not equal", ConfigurationParameters.TEST_TIN, record.getTin()); Assert.assertEquals("Tout is not equal", ConfigurationParameters.TEST_TOUT, record.getTout()); this.recordCount++; } catch (final ConnectorDataTransmissionException e) { Assert.fail("Error receiving data: " + e.getMessage()); } catch (final ConnectorEndOfDataException e) { Assert.fail("Connector has not terminated: " + e.getMessage());
@Override public void initialize() throws ConnectorDataTransmissionException { this.broker = new BrokerService(); this.broker.setUseJmx(true); try { this.broker.addConnector("tcp://localhost:" + this.port); this.broker.start(); super.initialize(); // Cannot be avoided as the broker throws Exception. } catch (final Exception e) { // NOCS, NOPMD throw new ConnectorDataTransmissionException(e.getMessage(), e); } }
/** * Safely end bridge loop. This routine should only be called from the shutdown hook thread in the main part of a * server. In other cases it will result in strange runtime errors. * * @throws ConnectorDataTransmissionException * An error occurred during data transmission and in this particular case while closing the data * transmission. */ public void shutdown() throws ConnectorDataTransmissionException { this.active = false; this.respawn = false; this.service.close(); this.kiekerMonitoringController.terminateMonitoring(); }
@Override public void run() { try { CLIServerMain.this.shutdown(); } catch (final ConnectorDataTransmissionException e) { CLIServerMain.getLogger().error("Graceful shutdown failed."); CLIServerMain.getLogger().error("Cause {}", e.getMessage()); } } });
/** * Create the test lookup entity map. * * @return a lookup entity map * @throws ConnectorDataTransmissionException * if record lookup fails */ protected final ConcurrentMap<Integer, LookupEntity> createLookupEntityMap() throws ConnectorDataTransmissionException { final ConcurrentMap<Integer, Class<? extends IMonitoringRecord>> map = new ConcurrentHashMap<>(); map.put(ConfigurationParameters.TEST_RECORD_ID, OperationExecutionRecord.class); return ServiceConnectorFactory.createLookupEntityMap(map); }
/** * Implements the deserializeNextRecord interface. Fetches deserialized data from the recordQeue * which is filled by the connection listener threads. * * @throws ConnectorDataTransmissionException * if the record reading is interrupted * @throws ConnectorEndOfDataException * if end of all data streams are reached * @return one IMonitoringRecord per call */ @Override public IMonitoringRecord deserializeNextRecord() throws ConnectorDataTransmissionException, ConnectorEndOfDataException { try { return this.recordQueue.take(); } catch (final InterruptedException e) { if (this.recordQueue.isEmpty()) { throw new ConnectorEndOfDataException("End of all streams reached", e); } else { throw new ConnectorDataTransmissionException(e.getMessage(), e); } } }
@Override public IMonitoringRecord deserializeNextRecord() throws ConnectorDataTransmissionException, ConnectorEndOfDataException { try { return this.recordQueue.take(); } catch (final InterruptedException ex) { throw new ConnectorDataTransmissionException("Connector has been interrupted", ex); } }
@Override public void close() throws ConnectorDataTransmissionException { try { super.close(); this.broker.stop(); // Cannot be avoided as the broker throws Exception. } catch (final Exception e) { // NOCS, NOPMD throw new ConnectorDataTransmissionException(e.getMessage(), e); } } }
/** * Safely end bridge loop. This routine should only be called from the shutdown hook thread in the main part of a * server. In other cases it will result in strange runtime errors. * * @throws ConnectorDataTransmissionException * An error occurred during data transmission and in this particular case while closing the data * transmission. */ public void shutdown() throws ConnectorDataTransmissionException { this.active = false; this.respawn = false; this.service.close(); this.kiekerMonitoringController.terminateMonitoring(); }
@Override public void run() { try { CLIServerMain.this.shutdown(); } catch (final ConnectorDataTransmissionException e) { CLIServerMain.getLog().error("Graceful shutdown failed."); CLIServerMain.getLog().error("Cause " + e.getMessage()); } } });
@Override public void close() throws ConnectorDataTransmissionException { try { this.server.stop(); this.server.join(); } catch (final Exception ex) { // NOPMD NOCS (Jetty does that) throw new ConnectorDataTransmissionException("Could not stop server", ex); } }
@Override public void close() throws ConnectorDataTransmissionException { try { this.server.stop(); this.server.join(); } catch (final Exception ex) { // NOPMD NOCS (Jetty does that) throw new ConnectorDataTransmissionException("Could not stop server", ex); } }
/** * Closes the data stream and socket. * * @throws ConnectorDataTransmissionException * if an IOException occurs during the close operation */ @Override public void close() throws ConnectorDataTransmissionException { try { this.in.close(); this.socket.close(); } catch (final IOException e) { throw new ConnectorDataTransmissionException("Error occured during socket close.", e); } }
/** * Closes the data stream and socket. * * @throws ConnectorDataTransmissionException * if an IOException occurs during the close operation */ @Override public void close() throws ConnectorDataTransmissionException { try { this.in.close(); this.socket.close(); } catch (final IOException e) { throw new ConnectorDataTransmissionException("Error occured during socket close.", e); } }
/** * Close the JMS connection. * * @throws ConnectorDataTransmissionException * if any JMSException occurs */ @Override public void close() throws ConnectorDataTransmissionException { try { this.connection.stop(); } catch (final JMSException e) { throw new ConnectorDataTransmissionException(e.getMessage(), e); } }
/** * Close the JMS connection. * * @throws ConnectorDataTransmissionException * if any JMSException occurs */ @Override public void close() throws ConnectorDataTransmissionException { try { this.connection.stop(); } catch (final JMSException e) { throw new ConnectorDataTransmissionException(e.getMessage(), e); } }