@Override public void run() { server.serve(); } }
public void stop() { if (_server != null) _server.stop(); }
@Override public void stop() { if (server != null && server.isServing()) { server.stop(); } if (servingExecutor != null) { servingExecutor.shutdown(); try { if (!servingExecutor.awaitTermination(5, TimeUnit.SECONDS)) { servingExecutor.shutdownNow(); } } catch (InterruptedException e) { throw new FlumeException("Interrupted while waiting for server to be " + "shutdown."); } } sourceCounter.stop(); super.stop(); }
public void serve() { try { // locate our thrift transport plugin ITransportPlugin transportPlugin = AuthUtils.GetTransportPlugin(_type, _storm_conf, _login_conf); // server _server = transportPlugin.getServer(_processor); // start accepting requests _server.serve(); } catch (Exception ex) { LOG.error("ThriftServer is being stopped due to: " + ex, ex); if (_server != null) _server.stop(); Runtime.getRuntime().halt(1); // shutdown server process since we could not handle Thrift requests any more } } }
tServer.setServerEventHandler(tServerEventHandler); HMSHandler.LOG.info("Started the new metaserver on port [" + port + "]..."); tServer.serve();
/** * Is ThriftServer listening to requests? * * @return */ public boolean isServing() { if (_server == null) return false; return _server.isServing(); }
server.setServerEventHandler(new TServerEventHandler() { @Override public ServerContext createContext(TProtocol input, TProtocol output) {
@Override public void run() { do { try { Thread.sleep(1000); } catch (InterruptedException e) { LOG.warn("Signalling thread was interrupted: " + e.getMessage()); } } while (!server.isServing()); startLock.lock(); try { startedServing.set(true); startCondition.signalAll(); } finally { startLock.unlock(); } } };
/** * Add Thrift event handler to underlying thrift threadpool server * @param eventHandler */ public void setThriftEventHandler(TServerEventHandler eventHandler) throws IllegalStateException { if (thriftServer == null) { throw new IllegalStateException("Server is not initialized or stopped"); } thriftServer.setServerEventHandler(eventHandler); }
@Override public void run() { try { server.serve(); } catch (Throwable t) { if (t instanceof InterruptedException) { // This is likely a shutdown LOG.info("Caught " + t.getClass().getSimpleName() + ". Shutting down."); } else { LOG.error("Exception caught by " + this.getClass().getSimpleName() + ". Exiting.", t); } System.exit(-1); } }
@Override protected void stopServer() { server.stop(); server = null; LOG.info("Thrift server has stopped"); }
@Override public void start() { Startup startupThread = new Startup(); startupThread.start(); try { Thread.sleep(3000); } catch (InterruptedException e) {} if (!server.isServing()) { throw new IllegalStateException("Failed initialization of ScribeSource"); } sourceCounter.start(); super.start(); }
/** * Add Thrift event handler to underlying thrift threadpool server * @param eventHandler */ public void setThriftEventHandler(TServerEventHandler eventHandler) throws IllegalStateException { if (thriftServer == null) { throw new IllegalStateException("Server is not initialized or stopped"); } thriftServer.setServerEventHandler(eventHandler); }
@Override public void run() { server.serve(); } });
public void stop() { server.stop(); }
while (!server.isServing()) { try { if (System.currentTimeMillis() - timeAfterStart >= 10000) {
@Override public void run() { server.serve(); } });
/** * Stop thrift. */ public void stopThrift() { if (zkClient != null) { zkClient.close(); } if (server != null) { server.stop(); } ThriftExecutor.shutdown(); LOG.info("Kaa Node Server Stopped."); }