Package com.rackspacecloud.blueflood.exceptions

Examples of com.rackspacecloud.blueflood.exceptions.SerializationException


            byte version = in.readRawByte();
            switch (version) {
                case Constants.VERSION_1_HISTOGRAM:
                    return deserializeV1Histogram(in);
                default:
                    throw new SerializationException("Unexpected serialization version");
            }
        } catch (IOException ex) {
            throw new RuntimeException(ex) ;
        }
    }
View Full Code Here


   
    /** return a serializer for a specific type */
    public static <T> AbstractSerializer<T> serializerFor(Class<T> type) {
        if (type == null)
            throw new RuntimeException("serializable type cannot be null",
                    new SerializationException("serializable type cannot be null"));
        else if (type.equals(String.class))
            throw new RuntimeException("We don't serialize strings anymore",
                    new SerializationException("We don't serialize strings anymore"));
       
        if (type.equals(BasicRollup.class))
            return (AbstractSerializer<T>) basicRollupInstance;
        else if (type.equals(TimerRollup.class))
            return (AbstractSerializer<T>)timerRollupInstance;
View Full Code Here

            case Type.B_FLOAT_AS_DOUBLE:
                protobufOut.writeRawByte(Constants.B_DOUBLE);
                protobufOut.writeDoubleNoTag(((Float) o).doubleValue());
                break;
            default:
                throw new SerializationException(String.format("Cannot serialize %s", o.getClass().getName()));
        }
    }
View Full Code Here

        else if (o instanceof BasicRollup)
            return Type.B_ROLLUP;
        else if (o instanceof CounterRollup)
            return Type.B_COUNTER;
        else
            throw new SerializationException("Unexpected type: " + o.getClass().getName());
    }
View Full Code Here

            case Constants.DOUBLE:
                return in.readDouble();
            case Constants.STR:
                throw new UnexpectedStringSerializationException("We don't rollup strings");
            default:
                throw new SerializationException(String.format("Unexpected raw metric type=%s for full res " +
                    "metric", (char)metricValueType));
        }
    }
View Full Code Here

        public Object fromByteBuffer(ByteBuffer byteBuffer) {
            CodedInputStream in = CodedInputStream.newInstance(byteBuffer.array());
            try {
                byte version = in.readRawByte();
                if (version != VERSION_1_FULL_RES && version != VERSION_1_ROLLUP) {
                    throw new SerializationException(String.format("Unexpected serialization version: %d",
                            (int)version));
                }
                return deserializeSimpleMetric(in);
            } catch (Exception e) {
                throw new RuntimeException("Deserialization Failure", e);
View Full Code Here

        public BasicRollup fromByteBuffer(ByteBuffer byteBuffer) {
            CodedInputStream in = CodedInputStream.newInstance(byteBuffer.array());
            try {
                byte version = in.readRawByte();
                if (version != VERSION_1_FULL_RES && version != VERSION_1_ROLLUP) {
                    throw new SerializationException(String.format("Unexpected serialization version: %d",
                            (int)version));
                }
                return deserializeV1Rollup(in);
            } catch (Exception e) {
                throw new RuntimeException("Deserialization Failure", e);
View Full Code Here

        public TimerRollup fromByteBuffer(ByteBuffer byteBuffer) {
            CodedInputStream in = CodedInputStream.newInstance(byteBuffer.array());
            try {
                byte version = in.readRawByte();
                if (version != VERSION_1_TIMER)
                    throw new SerializationException(String.format("Unexpected serialization version: %d", (int)version));
                return deserializeV1Timer(in);
            } catch (Exception ex) {
                throw new RuntimeException(ex);
            }
        }
View Full Code Here

        public SetRollup fromByteBuffer(ByteBuffer byteBuffer) {
            CodedInputStream in = CodedInputStream.newInstance(byteBuffer.array());
            try {
                byte version = in.readRawByte();
                if (version != VERSION_1_SET_ROLLUP)
                    throw new SerializationException(String.format("Unexpected serialization version: %d", (int)version));
                return deserializeV1SetRollup(in);
            } catch (Exception ex) {
                throw new RuntimeException(ex);
            }
        }
View Full Code Here

        public GaugeRollup fromByteBuffer(ByteBuffer byteBuffer) {
            CodedInputStream in = CodedInputStream.newInstance(byteBuffer.array());
            try {
                byte version = in.readRawByte();
                if (version != VERSION_1_ROLLUP)
                    throw new SerializationException(String.format("Unexpected serialization version: %d", (int)version));
                return deserializeV1Gauge(in);
            } catch (Exception e) {
                throw new RuntimeException("Deserialization Failure", e);
            }
        }
View Full Code Here

TOP

Related Classes of com.rackspacecloud.blueflood.exceptions.SerializationException

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.