/** * Close down socket */ @Override protected void afterTermination() { super.afterTermination(); acceptor.stop(); }
public ConnectionCleaner(HL7Service service) { super("ConnectionCleaner", service.getExecutorService()); this.service = service; }
/** * Returns true if the thread should continue to run, false otherwise (ie if * stop() has been called). * * @deprecated Use {@link #isRunning()}. Deprecated as of version 0.6. */ protected boolean keepRunning() { return isRunning(); }
/** * Registers the given application to handle messages corresponding to ALL * message types and trigger events. */ public synchronized void registerApplication(ReceivingApplication<? extends Message> application) { registerApplication(new AppRoutingDataImpl("*", "*", "*", "*"), application); }
/** * Prepare server by initializing the server socket * * @see ca.uhn.hl7v2.app.HL7Service#afterStartup() */ @Override protected void afterStartup() { try { super.afterStartup(); log.info("Starting SimpleServer running on port {}", port); SocketFactory ss = this.hapiContext.getSocketFactory(); acceptor = new AcceptorThread(port, tls, getExecutorService(), queue, ss); acceptor.start(); } catch (Exception e) { log.error("Failed starting SimpleServer on port", port); throw new RuntimeException(e); } }
/** * Called by subclasses when a new Connection is made. Registers the * ApplicationRouter with the given Connection and stores it. * * @param c existing connection */ public synchronized void newConnection(ActiveConnection c) { c.getResponder().setApplicationRouter(applicationRouter); c.activate(); connections.add(c); // keep track of connections notifyListeners(c); }
public void handle() { try { Thread.sleep(500); synchronized (service) { Iterator<Connection> it = service.getRemoteConnections() .iterator(); while (it.hasNext()) { Connection conn = it.next(); if (!conn.isOpen()) { log.debug( "Removing connection from {} from connection list", conn.getRemoteAddress().getHostAddress()); it.remove(); service.notifyListeners(conn); } } } } catch (InterruptedException e) { // don't care } }
/** * Registers the given application to handle messages corresponding to ALL * message types and trigger events. */ public synchronized void registerApplication(ReceivingApplication<? extends Message> application) { registerApplication(new AppRoutingDataImpl("*", "*", "*", "*"), application); }
/** * Prepare server by initializing the server socket * * @see ca.uhn.hl7v2.app.HL7Service#afterStartup() */ @Override protected void afterStartup() { try { super.afterStartup(); log.info("Starting SimpleServer running on port {}", port); SocketFactory ss = this.hapiContext.getSocketFactory(); acceptor = new AcceptorThread(port, tls, getExecutorService(), queue, ss); acceptor.start(); } catch (Exception e) { log.error("Failed starting SimpleServer on port", port); throw new RuntimeException(e); } }
/** * Called by subclasses when a new Connection is made. Registers the * ApplicationRouter with the given Connection and stores it. * * @param c existing connection */ public synchronized void newConnection(ActiveConnection c) { c.getResponder().setApplicationRouter(applicationRouter); c.activate(); connections.add(c); // keep track of connections notifyListeners(c); }
public void handle() { try { Thread.sleep(500); synchronized (service) { Iterator<Connection> it = service.getRemoteConnections() .iterator(); while (it.hasNext()) { Connection conn = it.next(); if (!conn.isOpen()) { log.debug( "Removing connection from {} from connection list", conn.getRemoteAddress().getHostAddress()); it.remove(); service.notifyListeners(conn); } } } } catch (InterruptedException e) { // don't care } }
/** * Close down socket */ @Override protected void afterTermination() { super.afterTermination(); acceptor.stop(); }
registerApplication(type, event, new AppWrapper(app)); } catch (ClassCastException cce) { throw new HL7Exception("The specified class, " + className
/** * Launches two threads that concurrently listen on the inboundPort and * outboundPort. * * @see ca.uhn.hl7v2.app.HL7Service#afterStartup() */ @Override protected void afterStartup() { try { super.afterStartup(); inboundAcceptor = createAcceptThread(inboundPort); outboundAcceptor = createAcceptThread(outboundPort); inboundAcceptor.start(); outboundAcceptor.start(); log.info("TwoPortService running on ports {} and {}", inboundPort, outboundPort); } catch (IOException e) { log.error("Could not run TwoPortService on ports {} and {}", inboundPort, outboundPort); throw new RuntimeException(e); } }
/** * Returns true if the thread should continue to run, false otherwise (ie if * stop() has been called). * * @deprecated Use {@link #isRunning()}. Deprecated as of version 0.6. */ protected boolean keepRunning() { return isRunning(); }
public ConnectionCleaner(HL7Service service) { super("ConnectionCleaner", service.getExecutorService()); this.service = service; }
/** * Terminate the two acceptor threads * * @see ca.uhn.hl7v2.app.HL7Service#afterTermination() */ @Override protected void afterTermination() { super.afterTermination(); inboundAcceptor.stop(); outboundAcceptor.stop(); }
registerApplication(type, event, new AppWrapper(app)); } catch (ClassCastException cce) { throw new HL7Exception("The specified class, " + className
/** * Launches two threads that concurrently listen on the inboundPort and * outboundPort. * * @see ca.uhn.hl7v2.app.HL7Service#afterStartup() */ @Override protected void afterStartup() { try { super.afterStartup(); inboundAcceptor = createAcceptThread(inboundPort); outboundAcceptor = createAcceptThread(outboundPort); inboundAcceptor.start(); outboundAcceptor.start(); log.info("TwoPortService running on ports {} and {}", inboundPort, outboundPort); } catch (IOException e) { log.error("Could not run TwoPortService on ports {} and {}", inboundPort, outboundPort); throw new RuntimeException(e); } }
/** * Terminate the two acceptor threads * * @see ca.uhn.hl7v2.app.HL7Service#afterTermination() */ @Override protected void afterTermination() { super.afterTermination(); inboundAcceptor.stop(); outboundAcceptor.stop(); }