javax.websocket.OnError Java Examples
The following examples show how to use
javax.websocket.OnError.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SnakeAnnotation.java From tomcatsrc with Apache License 2.0 | 7 votes |
@OnError public void onError(Throwable t) throws Throwable { // Most likely cause is a user closing their browser. Check to see if // the root cause is EOF and if it is ignore it. // Protect against infinite loops. int count = 0; Throwable root = t; while (root.getCause() != null && count < 20) { root = root.getCause(); count ++; } if (root instanceof EOFException) { // Assume this is triggered by the user closing their browser and // ignore it. } else { throw t; } }
Example #2
Source File: EventDriverMetrics.java From dropwizard-websockets with MIT License | 6 votes |
public EventDriverMetrics(final Class<?> endpointClass, MetricRegistry metrics) { final Class<?> klass = endpointClass; Metered metered = klass.getAnnotation(Metered.class); Timed timed = klass.getAnnotation(Timed.class); ExceptionMetered em = klass.getAnnotation(ExceptionMetered.class); this.onTextMeter = metered != null ? Optional.of(metrics.meter(MetricRegistry.name(metered.name(), klass.getName(), OnMessage.class.getSimpleName()))) : Optional.empty(); this.countOpened = metered != null ? Optional.of(metrics.counter(MetricRegistry.name(metered.name(), klass.getName(), OPEN_CONNECTIONS))) : Optional.empty(); this.timer = timed != null ? Optional.of(metrics.timer(MetricRegistry.name(timed.name(), klass.getName()))) : Optional.empty(); this.exceptionMetered = em != null ? Optional.of(metrics.meter(MetricRegistry.name(em.name(), klass.getName(), OnError.class.getSimpleName()))) : Optional.empty(); }
Example #3
Source File: SnakeAnnotation.java From Tomcat8-Source-Read with MIT License | 6 votes |
@OnError public void onError(Throwable t) throws Throwable { // Most likely cause is a user closing their browser. Check to see if // the root cause is EOF and if it is ignore it. // Protect against infinite loops. int count = 0; Throwable root = t; while (root.getCause() != null && count < 20) { root = root.getCause(); count ++; } if (root instanceof EOFException) { // Assume this is triggered by the user closing their browser and // ignore it. } else { throw t; } }
Example #4
Source File: SnakeAnnotation.java From tomcatsrc with Apache License 2.0 | 6 votes |
@OnError public void onError(Throwable t) throws Throwable { // Most likely cause is a user closing their browser. Check to see if // the root cause is EOF and if it is ignore it. // Protect against infinite loops. int count = 0; Throwable root = t; while (root.getCause() != null && count < 20) { root = root.getCause(); count ++; } if (root instanceof EOFException) { // Assume this is triggered by the user closing their browser and // ignore it. } else { throw t; } }
Example #5
Source File: ConnectionAcceptEndpoint.java From jReto with MIT License | 6 votes |
@OnError public void onError(Session session, Throwable t) { LOGGER.log(Level.WARNING, "Error occured {0}", t); try { this.requestingSession .close( new CloseReason( CloseReason.CloseCodes.CLOSED_ABNORMALLY, "An exception occured: "+t.toString() ) ); } catch (IOException ex) { Logger.getLogger(ConnectionAcceptEndpoint.class.getName()).log(Level.SEVERE, null, ex); } }
Example #6
Source File: MarketSummaryWebSocket.java From sample.daytrader7 with Apache License 2.0 | 5 votes |
@OnError public void onError(Throwable t, Session currentSession) { if (Log.doTrace()) { Log.trace("MarketSummaryWebSocket:onError -- session -->" + currentSession + "<--"); } t.printStackTrace(); }
Example #7
Source File: VirtNotifications.java From uyuni with GNU General Public License v2.0 | 5 votes |
/** * Callback executed an error occurs. * @param session the websocket session * @param err the err that occurred */ @OnError public void onError(Session session, Throwable err) { Boolean didClientAbortedConnection = err instanceof EOFException || !session.isOpen() || err.getMessage().startsWith("Unexpected error [32]"); if (didClientAbortedConnection) { LOG.debug("The client aborted the connection.", err); } else { LOG.error("Websocket endpoint error", err); } handbreakSession(session); }
Example #8
Source File: StressEndpoint.java From quarkus-http with Apache License 2.0 | 5 votes |
@OnError public void onError(Throwable e) throws IOException { e.printStackTrace(); if(out != null) { out.close(); } }
Example #9
Source File: WebsocketCollector.java From soul with Apache License 2.0 | 5 votes |
/** * On error. * * @param session the session * @param error the error */ @OnError public void onError(final Session session, final Throwable error) { SESSION_SET.remove(session); WebsocketCollector.session = null; LOGGER.error("websocket collection error:", error); }
Example #10
Source File: RemoteMinionCommands.java From uyuni with GNU General Public License v2.0 | 5 votes |
/** * Callback executed an error occurs. * @param session the websocket session * @param err the err that occurred */ @OnError public void onError(Session session, Throwable err) { Boolean didClientAbortedConnection = err instanceof EOFException || !session.isOpen() || err.getMessage().startsWith("Unexpected error [32]"); if (didClientAbortedConnection) { LOG.debug("The client aborted the connection.", err); } else { LOG.error("Websocket endpoint error", err); } }
Example #11
Source File: Notification.java From uyuni with GNU General Public License v2.0 | 5 votes |
/** * Callback executed an error occurs. * @param session the WebSocket session * @param err the err that occurred */ @OnError public void onError(Session session, Throwable err) { Boolean didClientAbortedConnection = err instanceof EOFException || !session.isOpen() || err.getMessage().startsWith("Unexpected error [32]"); if (didClientAbortedConnection) { LOG.debug("The client aborted the connection.", err); } else { LOG.error("Websocket endpoint error", err); } handbreakSession(session); }
Example #12
Source File: EndpointDispatcher.java From msf4j with Apache License 2.0 | 5 votes |
/** * Extract OnError method from the endpoint if exists * * @param webSocketEndpoint Endpoint to extract method. * @return method optional to handle errors. */ public Optional<Method> getOnErrorMethod(Object webSocketEndpoint) { Method[] methods = webSocketEndpoint.getClass().getMethods(); Method returnMethod = null; for (Method method : methods) { if (method.isAnnotationPresent(OnError.class)) { returnMethod = method; } } return Optional.ofNullable(returnMethod); }
Example #13
Source File: MCRProcessingEndpoint.java From mycore with GNU General Public License v3.0 | 5 votes |
@OnError public void onError(Session session, Throwable error) { if (error instanceof SocketTimeoutException) { this.close(session); LOGGER.warn("Websocket error {}: websocket timeout", session.getId()); return; } LOGGER.error("Websocket error {}", session.getId(), error); }
Example #14
Source File: MCRWebCLIResourceSockets.java From mycore with GNU General Public License v3.0 | 5 votes |
@OnError public void error(Throwable t) { if (t instanceof SocketTimeoutException) { LOGGER.warn("Socket Session timed out, clossing connection"); } else { LOGGER.error("Error in WebSocket Session", t); } }
Example #15
Source File: TerminalSocket.java From zeppelin with Apache License 2.0 | 4 votes |
@OnError public void onWebSocketError(Throwable cause) { LOGGER.warn(cause.getMessage(), cause); terminalManager.onWebSocketError(this, noteId, paragraphId); }
Example #16
Source File: ChatAnnotation.java From tomcatsrc with Apache License 2.0 | 4 votes |
@OnError public void onError(Throwable t) throws Throwable { log.error("Chat Error: " + t.toString(), t); }
Example #17
Source File: PingWebSocketTextSync.java From sample.daytrader7 with Apache License 2.0 | 4 votes |
@OnError public void onError(Throwable t) { t.printStackTrace(); }
Example #18
Source File: ChatAnnotation.java From tomcatsrc with Apache License 2.0 | 4 votes |
@OnError public void onError(Throwable t) throws Throwable { log.error("Chat Error: " + t.toString(), t); }
Example #19
Source File: ChartController.java From JavaWeb with Apache License 2.0 | 4 votes |
@OnError public void onError(Throwable throwable){ //do nothing }
Example #20
Source File: ChatAppEndpoint.java From msf4j with Apache License 2.0 | 4 votes |
@OnError public void onError(Throwable throwable, WebSocketConnection webSocketConnection) { log.error("Error found in method: " + throwable.toString()); }
Example #21
Source File: TestWsRemoteEndpointImplServer.java From tomcatsrc with Apache License 2.0 | 4 votes |
@OnError public void onError(Throwable t) { System.err.println("OnError:"); t.printStackTrace(); }
Example #22
Source File: PingWebSocketBinary.java From sample.daytrader7 with Apache License 2.0 | 4 votes |
@OnError public void onError(Throwable t) { t.printStackTrace(); }
Example #23
Source File: ChatAnnotation.java From Tomcat8-Source-Read with MIT License | 4 votes |
@OnError public void onError(Throwable t) throws Throwable { log.error("Chat Error: " + t.toString(), t); }
Example #24
Source File: OnlineApplicationEndPoint.java From ipst with Mozilla Public License 2.0 | 4 votes |
@OnError public void onError(Session session, Throwable t) { LOGGER.error(t.toString(), t); }
Example #25
Source File: WebSocket.java From tephra with MIT License | 4 votes |
@OnError public void error(Session session, Throwable throwable) { wsHelper.error(session, throwable); }
Example #26
Source File: WebSocketBrowserEndpoint.java From rogue-cloud with Apache License 2.0 | 4 votes |
@OnError public void onError(Throwable error) { System.err.println("Web Socket on error: "); error.printStackTrace(); }
Example #27
Source File: WebSocketClientEndpoint.java From rogue-cloud with Apache License 2.0 | 4 votes |
@OnError public void onError(Throwable error) { System.err.println("Web Socket on error:"); error.printStackTrace(); }
Example #28
Source File: LibertyWsBrowserEndpoint.java From rogue-cloud with Apache License 2.0 | 4 votes |
@OnError public void onError(Throwable error) { System.err.println("Web Socket on error:"); error.printStackTrace(); }
Example #29
Source File: WebsocketClientEndpoint.java From bitfinex-v2-wss-api-java with Apache License 2.0 | 4 votes |
@OnError public void onError(final Session session, final Throwable t) { logger.error("OnError called {}", Throwables.getStackTraceAsString(t)); onErrorConsumer.accept(t); connectLatch.countDown(); }
Example #30
Source File: PingWebSocketJson.java From sample.daytrader7 with Apache License 2.0 | 4 votes |
@OnError public void onError(Throwable t) { t.printStackTrace(); }