Java Code Examples for com.alibaba.dubbo.remoting.exchange.Request#isHeartbeat()
The following examples show how to use
com.alibaba.dubbo.remoting.exchange.Request#isHeartbeat() .
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: HeaderExchangeHandler.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
@Override public void caught(Channel channel, Throwable exception) throws RemotingException { if (exception instanceof ExecutionException) { ExecutionException e = (ExecutionException) exception; Object msg = e.getRequest(); if (msg instanceof Request) { Request req = (Request) msg; if (req.isTwoWay() && !req.isHeartbeat()) { Response res = new Response(req.getId(), req.getVersion()); res.setStatus(Response.SERVER_ERROR); res.setErrorMessage(StringUtils.toString(e)); channel.send(res); return; } } } ExchangeChannel exchangeChannel = HeaderExchangeChannel.getOrAddChannel(channel); try { handler.caught(exchangeChannel, exception); } finally { HeaderExchangeChannel.removeChannelIfDisconnected(channel); } }
Example 2
Source File: HeaderExchangeHandler.java From dubbox with Apache License 2.0 | 6 votes |
public void caught(Channel channel, Throwable exception) throws RemotingException { if (exception instanceof ExecutionException) { ExecutionException e = (ExecutionException) exception; Object msg = e.getRequest(); if (msg instanceof Request) { Request req = (Request) msg; if (req.isTwoWay() && ! req.isHeartbeat()) { Response res = new Response(req.getId(), req.getVersion()); res.setStatus(Response.SERVER_ERROR); res.setErrorMessage(StringUtils.toString(e)); channel.send(res); return; } } } ExchangeChannel exchangeChannel = HeaderExchangeChannel.getOrAddChannel(channel); try { handler.caught(exchangeChannel, exception); } finally { HeaderExchangeChannel.removeChannelIfDisconnected(channel); } }
Example 3
Source File: HeaderExchangeHandler.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
public void caught(Channel channel, Throwable exception) throws RemotingException { if (exception instanceof ExecutionException) { ExecutionException e = (ExecutionException) exception; Object msg = e.getRequest(); if (msg instanceof Request) { Request req = (Request) msg; if (req.isTwoWay() && ! req.isHeartbeat()) { Response res = new Response(req.getId(), req.getVersion()); res.setStatus(Response.SERVER_ERROR); res.setErrorMessage(StringUtils.toString(e)); channel.send(res); return; } } } ExchangeChannel exchangeChannel = HeaderExchangeChannel.getOrAddChannel(channel); try { handler.caught(exchangeChannel, exception); } finally { HeaderExchangeChannel.removeChannelIfDisconnected(channel); } }
Example 4
Source File: HeaderExchangeHandler.java From dubbo3 with Apache License 2.0 | 6 votes |
public void caught(Channel channel, Throwable exception) throws RemotingException { if (exception instanceof ExecutionException) { ExecutionException e = (ExecutionException) exception; Object msg = e.getRequest(); if (msg instanceof Request) { Request req = (Request) msg; if (req.isTwoWay() && ! req.isHeartbeat()) { Response res = new Response(req.getId(), req.getVersion()); res.setStatus(Response.SERVER_ERROR); res.setErrorMessage(StringUtils.toString(e)); channel.send(res); return; } } } ExchangeChannel exchangeChannel = HeaderExchangeChannel.getOrAddChannel(channel); try { handler.caught(exchangeChannel, exception); } finally { HeaderExchangeChannel.removeChannelIfDisconnected(channel); } }
Example 5
Source File: HeaderExchangeHandler.java From dubbox with Apache License 2.0 | 6 votes |
public void caught(Channel channel, Throwable exception) throws RemotingException { if (exception instanceof ExecutionException) { ExecutionException e = (ExecutionException) exception; Object msg = e.getRequest(); if (msg instanceof Request) { Request req = (Request) msg; if (req.isTwoWay() && ! req.isHeartbeat()) { Response res = new Response(req.getId(), req.getVersion()); res.setStatus(Response.SERVER_ERROR); res.setErrorMessage(StringUtils.toString(e)); channel.send(res); return; } } } ExchangeChannel exchangeChannel = HeaderExchangeChannel.getOrAddChannel(channel); try { handler.caught(exchangeChannel, exception); } finally { HeaderExchangeChannel.removeChannelIfDisconnected(channel); } }
Example 6
Source File: HeaderExchangeHandler.java From dubbox with Apache License 2.0 | 6 votes |
public void caught(Channel channel, Throwable exception) throws RemotingException { if (exception instanceof ExecutionException) { ExecutionException e = (ExecutionException) exception; Object msg = e.getRequest(); if (msg instanceof Request) { Request req = (Request) msg; if (req.isTwoWay() && ! req.isHeartbeat()) { Response res = new Response(req.getId(), req.getVersion()); res.setStatus(Response.SERVER_ERROR); res.setErrorMessage(StringUtils.toString(e)); channel.send(res); return; } } } ExchangeChannel exchangeChannel = HeaderExchangeChannel.getOrAddChannel(channel); try { handler.caught(exchangeChannel, exception); } finally { HeaderExchangeChannel.removeChannelIfDisconnected(channel); } }
Example 7
Source File: HeartBeatExchangeHandler.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
@Override public void received(Channel channel, Object message) throws RemotingException { if (message instanceof Request) { Request req = (Request) message; if (req.isHeartbeat()) { heartBeatCounter.incrementAndGet(); channel.setAttribute(KEY_READ_TIMESTAMP, System.currentTimeMillis()); Response res = new Response(req.getId(), req.getVersion()); res.setEvent(req.getData() == null ? null : req.getData().toString()); channel.send(res); } } else { super.received(channel, message); } }
Example 8
Source File: HeartBeatExchangeHandler.java From dubbox with Apache License 2.0 | 5 votes |
@Override public void received( Channel channel, Object message ) throws RemotingException { if ( message instanceof Request ) { Request req = ( Request ) message; if ( req.isHeartbeat() ) { heartBeatCounter.incrementAndGet(); channel.setAttribute(KEY_READ_TIMESTAMP, System.currentTimeMillis()); Response res = new Response( req.getId(), req.getVersion() ); res.setEvent( req.getData() == null ? null : req.getData().toString() ); channel.send( res ); } } else { super.received( channel, message ); } }
Example 9
Source File: HeartBeatExchangeHandler.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
@Override public void received( Channel channel, Object message ) throws RemotingException { if ( message instanceof Request ) { Request req = ( Request ) message; if ( req.isHeartbeat() ) { heartBeatCounter.incrementAndGet(); channel.setAttribute(KEY_READ_TIMESTAMP, System.currentTimeMillis()); Response res = new Response( req.getId(), req.getVersion() ); res.setEvent( req.getData() == null ? null : req.getData().toString() ); channel.send( res ); } } else { super.received( channel, message ); } }
Example 10
Source File: HeartBeatExchangeHandler.java From dubbox with Apache License 2.0 | 5 votes |
@Override public void received( Channel channel, Object message ) throws RemotingException { if ( message instanceof Request ) { Request req = ( Request ) message; if ( req.isHeartbeat() ) { heartBeatCounter.incrementAndGet(); channel.setAttribute(KEY_READ_TIMESTAMP, System.currentTimeMillis()); Response res = new Response( req.getId(), req.getVersion() ); res.setEvent( req.getData() == null ? null : req.getData().toString() ); channel.send( res ); } } else { super.received( channel, message ); } }
Example 11
Source File: HeartBeatExchangeHandler.java From dubbox with Apache License 2.0 | 5 votes |
@Override public void received( Channel channel, Object message ) throws RemotingException { if ( message instanceof Request ) { Request req = ( Request ) message; if ( req.isHeartbeat() ) { heartBeatCounter.incrementAndGet(); channel.setAttribute(KEY_READ_TIMESTAMP, System.currentTimeMillis()); Response res = new Response( req.getId(), req.getVersion() ); res.setEvent( req.getData() == null ? null : req.getData().toString() ); channel.send( res ); } } else { super.received( channel, message ); } }