@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 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 { 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); } }
/** * Create the connection to a remote service providing records. * * @throws ConnectorDataTransmissionException * if the given host or IP cannot be found, or an IOException occurs */ @Override public void initialize() throws ConnectorDataTransmissionException { try { this.socket = new Socket(this.hostname, this.port); this.in = new DataInputStream(this.socket.getInputStream()); } catch (final UnknownHostException e) { throw new ConnectorDataTransmissionException("The given host " + this.hostname + " could not be found.", e); } catch (final IOException e) { throw new ConnectorDataTransmissionException(e.getMessage(), 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 server connection. * * @throws ConnectorDataTransmissionException * if the closing fails */ @Override public void close() throws ConnectorDataTransmissionException { try { this.in.close(); this.serverSocket.close(); } catch (final IOException e) { throw new ConnectorDataTransmissionException(e.getMessage(), e); } }
/** * Close the server connection. * * @throws ConnectorDataTransmissionException * if the closing fails */ @Override public void close() throws ConnectorDataTransmissionException { try { this.in.close(); this.serverSocket.close(); } catch (final IOException e) { throw new ConnectorDataTransmissionException(e.getMessage(), e); } }
/** * Create the connection to a remote service providing records. * * @throws ConnectorDataTransmissionException * if the given host or IP cannot be found, or an IOException occurs */ @Override public void initialize() throws ConnectorDataTransmissionException { try { this.socket = new Socket(this.hostname, this.port); this.in = new DataInputStream(this.socket.getInputStream()); } catch (final UnknownHostException e) { throw new ConnectorDataTransmissionException("The given host " + this.hostname + " could not be found.", e); } catch (final IOException e) { throw new ConnectorDataTransmissionException(e.getMessage(), e); } }
/** * Initializes a server socket and data stream for a single connection. * * @throws ConnectorDataTransmissionException * it the socket could not be established */ @Override public void initialize() throws ConnectorDataTransmissionException { try { this.serverSocket = new ServerSocket(this.port); this.in = new DataInputStream(this.serverSocket.accept().getInputStream()); } catch (final IOException e) { throw new ConnectorDataTransmissionException(e.getMessage(), e); } }
/** * Initializes a server socket and data stream for a single connection. * * @throws ConnectorDataTransmissionException * it the socket could not be established */ @Override public void initialize() throws ConnectorDataTransmissionException { try { this.serverSocket = new ServerSocket(this.port); this.in = new DataInputStream(this.serverSocket.accept().getInputStream()); } catch (final IOException e) { throw new ConnectorDataTransmissionException(e.getMessage(), e); } }
@Override public void initialize() throws ConnectorDataTransmissionException { try { this.server = new Server(this.port); final Servlet servlet = new MonitoringReceiverServlet(this.recordQueue); final ServletHolder servletHolder = new ServletHolder(servlet); final ServletContextHandler contextHandler = new ServletContextHandler(ServletContextHandler.SESSIONS); contextHandler.setContextPath(this.context); contextHandler.addServlet(servletHolder, this.restURL); this.server.setHandler(contextHandler); this.server.start(); } catch (final Exception ex) { // NOPMD NOCS (Jetty does that) throw new ConnectorDataTransmissionException("Could not start server", ex); } }
@Override public void initialize() throws ConnectorDataTransmissionException { try { this.server = new Server(this.port); final Servlet servlet = new MonitoringReceiverServlet(this.recordQueue); final ServletHolder servletHolder = new ServletHolder(servlet); final ServletContextHandler contextHandler = new ServletContextHandler(ServletContextHandler.SESSIONS); contextHandler.setContextPath(this.context); contextHandler.addServlet(servletHolder, this.restURL); this.server.setHandler(contextHandler); this.server.start(); } catch (final Exception ex) { // NOPMD NOCS (Jetty does that) throw new ConnectorDataTransmissionException("Could not start server", 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); } } }
@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); } } }
/** * 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); } }
@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); } }
@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); } }