/** * Creates a new instance of Server * * @param parser parser to be used * @param llp LowerLayerProtocol * @param executorService executor used for starting threads */ public HL7Service(Parser parser, LowerLayerProtocol llp, ExecutorService executorService) { super("HL7 Server", executorService); this.connections = new ArrayList<Connection>(); this.listeners = new ArrayList<ConnectionListener>(); this.parser = parser; this.llp = llp; this.applicationRouter = new ApplicationRouterImpl(parser); this.cleaner = new ConnectionCleaner(this); // 960101 assert !this.cleaner.isRunning(); }
/** * Creates a new instance of Server * * @param parser parser to be used * @param llp LowerLayerProtocol * @param executorService executor used for starting threads */ public HL7Service(Parser parser, LowerLayerProtocol llp, ExecutorService executorService) { super("HL7 Server", executorService); this.connections = new ArrayList<Connection>(); this.listeners = new ArrayList<ConnectionListener>(); this.parser = parser; this.llp = llp; this.applicationRouter = new ApplicationRouterImpl(parser); this.cleaner = new ConnectionCleaner(this); // 960101 assert !this.cleaner.isRunning(); }
/** * Called after the thread has left its main loop. This implementation stops * the connection cleaner thread and closes any open connections. Override * to clean up additional resources from the running thread, e.g. closing * {@link java.net.ServerSocket}s. */ @Override protected void afterTermination() { super.afterTermination(); cleaner.stopAndWait(); for (Connection c : connections) { c.close(); } }
/** * Called after the thread has left its main loop. This implementation stops * the connection cleaner thread and closes any open connections. Override * to clean up additional resources from the running thread, e.g. closing * {@link java.net.ServerSocket}s. */ @Override protected void afterTermination() { super.afterTermination(); cleaner.stopAndWait(); for (Connection c : connections) { c.close(); } }
/** * Called after startup before the thread enters its main loop. This * implementation launches a cleaner thread that removes stale connections * from the connection list. Override to initialize resources for the * running thread, e.g. opening {@link java.net.ServerSocket}s etc. */ @Override protected void afterStartup() { // Fix for bug 960101: Don't start the cleaner thread until the // server is started. cleaner.start(); }
/** * Called after startup before the thread enters its main loop. This * implementation launches a cleaner thread that removes stale connections * from the connection list. Override to initialize resources for the * running thread, e.g. opening {@link java.net.ServerSocket}s etc. */ @Override protected void afterStartup() { // Fix for bug 960101: Don't start the cleaner thread until the // server is started. cleaner.start(); }