@Override public void upgradeHTTP2(Request request, SettingsFrame settings, Promise<HTTP2ClientConnection> promise, ClientHTTPHandler upgradeHandler, ClientHTTPHandler http2ResponseHandler) { throw new CommonRuntimeException("The current connection version is http2, it does not need to upgrading."); }
@Override public void upgradeWebSocket(Request request, WebSocketPolicy policy, Promise<WebSocketConnection> promise, ClientHTTPHandler upgradeHandler, IncomingFrames incomingFrames) { throw new CommonRuntimeException("The current connection version is http2, it can not upgrade WebSocket."); }
@Override public void upgradeHTTP2(Request request, SettingsFrame settings, Promise<HTTP2ClientConnection> promise, ClientHTTPHandler upgradeHandler, ClientHTTPHandler http2ResponseHandler) { throw new CommonRuntimeException("The current connection version is http2, it does not need to upgrading."); }
@Override public void upgradeWebSocket(Request request, WebSocketPolicy policy, Promise<WebSocketConnection> promise, ClientHTTPHandler upgradeHandler, IncomingFrames incomingFrames) { throw new CommonRuntimeException("The current connection version is http2, it can not upgrade WebSocket."); }
private static Class<?> getClass(String name) { try { return Class.forName(name, false, classLoader); } catch (ClassNotFoundException e) { throw new CommonRuntimeException(e); } }
private static URI toURI(String name) { try { return new URI(name); } catch (URISyntaxException e) { throw new CommonRuntimeException(e); } }
private static URI toURI(String name) { try { return new URI(name); } catch (URISyntaxException e) { throw new CommonRuntimeException(e); } }
private static Class<?> getClass(String name) { try { return Class.forName(name, false, classLoader); } catch (ClassNotFoundException e) { throw new CommonRuntimeException(e); } }
public DefaultDom() { try { db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); } catch (ParserConfigurationException e) { throw new CommonRuntimeException(e); } }
public DefaultDom() { try { db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); } catch (ParserConfigurationException e) { throw new CommonRuntimeException(e); } }
@Override public Document getDocument(String file) { try (InputStream is = DefaultDom.class.getResourceAsStream("/" + file)) { if (is == null) { throw new CommonRuntimeException("the configuration file: " + file + " is not found"); } Document doc = db.parse(is); return doc; } catch (Exception e) { throw new CommonRuntimeException(e); } }
private void shutdown() { try { shutdown = true; workQueue.put(new ShutdownCommand()); } catch (InterruptedException e) { throw new CommonRuntimeException(e); } }
private void shutdown() { try { shutdown = true; workQueue.put(new ShutdownCommand()); } catch (InterruptedException e) { throw new CommonRuntimeException(e); } }
public void invoke(Object obj, JsonReader reader) { try { propertyAccess.setValue(obj, getValue(reader)); } catch (Throwable e) { throw new CommonRuntimeException(e); } }
public static JsonObject toJsonObject(String json) { try (JsonReader reader = new JsonStringReader(json)) { return GeneralJSONObjectStateMacine.toJsonObject(reader); } catch (IOException e) { throw new CommonRuntimeException(e); } }
public void invoke(Object obj, JsonReader reader) { try { propertyAccess.setValue(obj, getValue(reader)); } catch (Throwable e) { throw new CommonRuntimeException(e); } }
@SuppressWarnings("unchecked") public static <T> T toObject(String json, Class<T> clazz) { try (JsonReader reader = new JsonStringReader(json)) { return (T) ParserStateMachine.toObject(reader, clazz, clazz); } catch (IOException e) { throw new CommonRuntimeException(e); } }
public static JsonArray toJsonArray(String json) { try (JsonReader reader = new JsonStringReader(json)) { return GeneralJSONObjectStateMacine.toJsonArray(reader); } catch (IOException e) { throw new CommonRuntimeException(e); } }
public static <T> T callInManagedBlock(final Supplier<T> supplier) { final SupplierManagedBlock<T> managedBlock = new SupplierManagedBlock<>(supplier); try { ForkJoinPool.managedBlock(managedBlock); } catch (InterruptedException e) { throw new CommonRuntimeException(e); } return managedBlock.getResult(); }
public static void main(String[] args) { $.httpServer().router().get("/error") .handler(ctx -> { throw new CommonRuntimeException("perhaps some errors happen"); }).listen("localhost", 8080); } }