/** * Is ThriftServer listening to requests? * * @return */ public boolean isServing() { if (_server == null) return false; return _server.isServing(); }
@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(); } } };
@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(); }
@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(); }
while (!server.isServing()) { try { if (System.currentTimeMillis() - timeAfterStart >= 10000) {
public final boolean isServing() { final TServer thriftServer = this.thriftServer; return thriftServer != null && thriftServer.isServing(); } }
public final boolean isServing() { final TServer thriftServer = this.thriftServer; return thriftServer != null && thriftServer.isServing(); } }
/** * Returns if the server is still running * * @return true if server is running */ public boolean isServerAlive() { return server != null && server.isServing(); }
public final boolean isServing() { final TServer thriftServer = this.thriftServer; return thriftServer != null && thriftServer.isServing(); }
public synchronized boolean isRunning() { return status == Status.STARTED && thriftServer != null && thriftServer.isServing(); }
@Override public void stop() throws Exception { if (server!=null && server.isServing()){ setStatus(ServerStatus.STOPING); server.stop(); } }
@Override public void stop() throws Exception { if (server!=null && server.isServing()){ setStatus(ServerStatus.STOPING); server.stop(); } }
public void stop() throws Exception { if (server!=null && server.isServing()){ setStatus(IServer.ServerStatus.STOPING); server.stop(); } GFacThreadPoolExecutor.getCachedThreadPool().shutdownNow(); }
@BeforeClass public static void setup() throws Exception { Properties prop = new Properties(); prop.setProperty("useMockInstance", "true"); prop.put("tokenClass", PasswordToken.class.getName()); proxy = Proxy.createProxyServer(HostAndPort.fromParts("localhost", port), new TCompactProtocol.Factory(), prop).server; while (!proxy.isServing()) { Thread.sleep(500); } tpc = new TestProxyClient("localhost", port); userpass = tpc.proxy().login("root", Collections.singletonMap("password", "")); }
@BeforeClass public static void setup() throws Exception { Properties prop = new Properties(); prop.setProperty("useMockInstance", "true"); prop.put("tokenClass", PasswordToken.class.getName()); proxy = Proxy.createProxyServer(HostAndPort.fromParts("localhost", port), new TCompactProtocol.Factory(), prop).server; while (!proxy.isServing()) { Thread.sleep(500); } tpc = new TestProxyClient("localhost", port); userpass = tpc.proxy().login("root", Collections.singletonMap("password", "")); }
@BeforeClass public static void setup() throws Exception { Properties prop = new Properties(); prop.setProperty("useMockInstance", "true"); prop.put("tokenClass", PasswordToken.class.getName()); proxy = Proxy.createProxyServer(HostAndPort.fromParts("localhost", port), new TCompactProtocol.Factory(), prop).server; while (!proxy.isServing()) { Thread.sleep(500); } tpc = new TestProxyClient("localhost", port); userpass = tpc.proxy().login("root", Collections.singletonMap("password", "")); }
@Override public boolean waitForReady(int timeoutMs) { return CommonUtils.waitFor(this + " to start", input -> mThriftServer != null && mThriftServer.isServing() && mWebServer != null && mWebServer.getServer().isRunning(), WaitForOptions.defaults().setTimeoutMs(timeoutMs).setThrowOnTimeout(false)); }