Package org.elasticsearch.memcached

Examples of org.elasticsearch.memcached.MemcachedTransportException


                ChannelFuture future = channel.write(writeBuffer);
                if (releaseContentListener != null) {
                    future.addListener(releaseContentListener);
                }
            } catch (Exception e) {
                throw new MemcachedTransportException("Failed to write response", e);
            }
        } else {
            if (response.status().getStatus() >= 500) {
                channel.write(ERROR.duplicate());
            } else {
                if (request.method() == RestRequest.Method.POST) {
                    // TODO this is SET, can we send a payload?
                    channel.write(STORED.duplicate());
                } else if (request.method() == RestRequest.Method.DELETE) {
                    channel.write(DELETED.duplicate());
                } else { // GET
                    try {
                        ChannelBuffer writeBuffer = ChannelBuffers.dynamicBuffer(response.contentLength() + 512);
                        writeBuffer.writeBytes(VALUE.duplicate());
                        writeBuffer.writeBytes(Unicode.fromStringAsBytes(request.uri()));
                        writeBuffer.writeByte(' ');
                        writeBuffer.writeByte('0');
                        writeBuffer.writeByte(' ');
                        writeBuffer.writeBytes(Bytes.itoa(response.contentLength()));
                        writeBuffer.writeByte('\r');
                        writeBuffer.writeByte('\n');
                        writeBuffer.writeBytes(response.content(), 0, response.contentLength());
                        writeBuffer.writeByte('\r');
                        writeBuffer.writeByte('\n');
                        writeBuffer.writeBytes(END.duplicate());
                        channel.write(writeBuffer);
                    } catch (Exception e) {
                        throw new MemcachedTransportException("Failed to write 'get' response", e);
                    }
                }
            }
        }
    }
View Full Code Here


                ChannelFuture future = channel.write(writeBuffer);
                if (releaseContentListener != null) {
                    future.addListener(releaseContentListener);
                }
            } catch (Exception e) {
                throw new MemcachedTransportException("Failed to write response", e);
            }
        } else {
            if (response.status().getStatus() >= 500) {
                channel.write(ERROR.duplicate());
            } else {
                if (request.method() == RestRequest.Method.POST) {
                    // TODO this is SET, can we send a payload?
                    channel.write(STORED.duplicate());
                } else if (request.method() == RestRequest.Method.DELETE) {
                    channel.write(DELETED.duplicate());
                } else { // GET
                    try {
                        ChannelBuffer writeBuffer = ChannelBuffers.dynamicBuffer(response.content().length() + 512);
                        writeBuffer.writeBytes(VALUE.duplicate());
                        BytesRef bytesRef = new BytesRef(request.uri());
                        writeBuffer.writeBytes(bytesRef.bytes, bytesRef.offset, bytesRef.length);
                        writeBuffer.writeByte(' ');
                        writeBuffer.writeByte('0');
                        writeBuffer.writeByte(' ');
                        writeBuffer.writeBytes(Bytes.itoa(response.content().length()));
                        writeBuffer.writeByte('\r');
                        writeBuffer.writeByte('\n');
                        writeBuffer.writeBytes(response.content().toBytes(), 0, response.content().length());
                        writeBuffer.writeByte('\r');
                        writeBuffer.writeByte('\n');
                        writeBuffer.writeBytes(END.duplicate());
                        channel.write(writeBuffer);
                    } catch (Exception e) {
                        throw new MemcachedTransportException("Failed to write 'get' response", e);
                    }
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.memcached.MemcachedTransportException

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.