Package org.apache.thrift.transport

Examples of org.apache.thrift.transport.TTransportException


                            channel.setSendTimeout(sendTimeout);
                            set(channel);
                        }
                        else if (future.isCancelled()) {
                            if (!cancel(true)) {
                                setException(new TTransportException("Unable to cancel client channel connection"));
                            }
                        }
                        else {
                            throw future.getCause();
                        }
                    }
                    catch (Throwable t) {
                        setException(new TTransportException("Failed to connect client channel", t));
                    }
                }
            });
        }
View Full Code Here


        if (f.getCause() != null) {
            String message = String.format("unable to connect to %s:%d %s",
                    addr.getHostName(),
                    addr.getPort(),
                    socksProxyAddress == null ? "" : "via socks proxy at " + socksProxyAddress);
            throw new TTransportException(message, f.getCause());
        }

        if (f.isSuccess() && (channel != null)) {
            if (channel.isOpen()) {
                // Add the channel to allChannels, and set it up to be removed when closed
                allChannels.add(channel);
                channel.getCloseFuture().addListener(new ChannelFutureListener() {
                    @Override
                    public void operationComplete(ChannelFuture future) throws Exception {
                        Channel channel = future.getChannel();
                        allChannels.remove(channel);
                    }
                });
            }

            TNiftyClientTransport transport = new TNiftyClientTransport(channel, receiveTimeout);
            channel.getPipeline().addLast("thrift", transport);
            return transport;
        }

        throw new TTransportException(String.format(
                "unknown error connecting to %s:%d %s",
                addr.getHostName(),
                addr.getPort(),
                socksProxyAddress == null ? "" : "via socks proxy at " + socksProxyAddress
        ));
View Full Code Here

            int stringLength;
            stringLength = message.getInt(4);
            sequenceId = message.getInt(8 + stringLength);
            return sequenceId;
        } catch (Throwable t) {
            throw new TTransportException("Could not find sequenceId in Thrift message");
        }
    }
View Full Code Here

        }

        HttpResponse httpResponse = (HttpResponse) message;

        if (!httpResponse.getStatus().equals(HttpResponseStatus.OK)) {
            throw new TTransportException("HTTP response had non-OK status: " + httpResponse
                    .getStatus().toString());
        }

        ChannelBuffer content = httpResponse.getContent();
View Full Code Here

                                retireRequest(sequenceId);
                            } else {
                                queueReceiveTimeout(request);
                            }
                        } else {
                            TTransportException transportException =
                                    new TTransportException("Sending request failed",
                                                            future.getCause());
                            listener.onChannelError(transportException);
                            onError(transportException);
                        }
                    }
View Full Code Here

    private void onResponseReceived(int sequenceId, ChannelBuffer response)
    {
        Request request = retireRequest(sequenceId);
        if (request == null) {
            onError(new TTransportException("Bad sequence id in response: " + sequenceId));
        } else {
            request.getListener().onResponseReceived(response);
        }
    }
View Full Code Here

            cancelAllTimeouts();
            WriteTimeoutException timeoutException =
                    new WriteTimeoutException(
                            "Timed out waiting " + getSendTimeout() + " to send request");

            request.getListener().onChannelError(new TTransportException(timeoutException));
        }
    }
View Full Code Here

            ReadTimeoutException timeoutException =
                    new ReadTimeoutException(
                            "Timed out waiting " + getReceiveTimeout() + " to receive response");

            request.getListener().onChannelError(new TTransportException(timeoutException));
        }
    }
View Full Code Here

            serverSocket.bind(bindAddr, listenBacklog);
        }
        catch (IOException ioe)
        {
            serverSocket = null;
            throw new TTransportException("Could not create ServerSocket on address " + bindAddr + ".");
        }

        this.keepAlive = keepAlive;
        this.sendBufferSize = sendBufferSize;
        this.recvBufferSize = recvBufferSize;
View Full Code Here

    @Override
    protected TCustomSocket acceptImpl() throws TTransportException
    {

        if (serverSocket == null)
            throw new TTransportException(TTransportException.NOT_OPEN, "No underlying server socket.");

        TCustomSocket tsocket = null;
        Socket socket = null;
        try
        {
            socket = serverSocket.accept();
            tsocket = new TCustomSocket(socket);
            tsocket.setTimeout(0);
        }
        catch (IOException iox)
        {
            throw new TTransportException(iox);
        }

        try
        {
            socket.setKeepAlive(this.keepAlive);
View Full Code Here

TOP

Related Classes of org.apache.thrift.transport.TTransportException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.