Search in sources :

Example 1 with ExecutionException

use of com.alibaba.dubbo.remoting.ExecutionException in project dubbo by alibaba.

the class ConnectionOrderedChannelHandler method connected.

public void connected(Channel channel) throws RemotingException {
    try {
        checkQueueLength();
        connectionExecutor.execute(new ChannelEventRunnable(channel, handler, ChannelState.CONNECTED));
    } catch (Throwable t) {
        throw new ExecutionException("connect event", channel, getClass() + " error when process connected event .", t);
    }
}
Also used : ChannelEventRunnable(com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable) ExecutionException(com.alibaba.dubbo.remoting.ExecutionException) RejectedExecutionException(java.util.concurrent.RejectedExecutionException)

Example 2 with ExecutionException

use of com.alibaba.dubbo.remoting.ExecutionException in project dubbo by alibaba.

the class ConnectionOrderedChannelHandler method disconnected.

public void disconnected(Channel channel) throws RemotingException {
    try {
        checkQueueLength();
        connectionExecutor.execute(new ChannelEventRunnable(channel, handler, ChannelState.DISCONNECTED));
    } catch (Throwable t) {
        throw new ExecutionException("disconnected event", channel, getClass() + " error when process disconnected event .", t);
    }
}
Also used : ChannelEventRunnable(com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable) ExecutionException(com.alibaba.dubbo.remoting.ExecutionException) RejectedExecutionException(java.util.concurrent.RejectedExecutionException)

Example 3 with ExecutionException

use of com.alibaba.dubbo.remoting.ExecutionException in project dubbo by alibaba.

the class HeaderExchangeHandler method caught.

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);
    }
}
Also used : Response(com.alibaba.dubbo.remoting.exchange.Response) Request(com.alibaba.dubbo.remoting.exchange.Request) ExchangeChannel(com.alibaba.dubbo.remoting.exchange.ExchangeChannel) ExecutionException(com.alibaba.dubbo.remoting.ExecutionException)

Aggregations

ExecutionException (com.alibaba.dubbo.remoting.ExecutionException)3 ChannelEventRunnable (com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable)2 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)2 ExchangeChannel (com.alibaba.dubbo.remoting.exchange.ExchangeChannel)1 Request (com.alibaba.dubbo.remoting.exchange.Request)1 Response (com.alibaba.dubbo.remoting.exchange.Response)1