Package org.voltdb.messaging

Examples of org.voltdb.messaging.FastDeserializer


        assertNotNull(invocation_bytes);
       
        for (Status s : Status.values()) {
            ByteBuffer b = ByteBuffer.wrap(invocation_bytes);
            ClientResponseImpl.setStatus(b, s);
            FastDeserializer fds = new FastDeserializer(invocation_bytes);
            ClientResponseImpl clone = fds.readObject(ClientResponseImpl.class);
            assertNotNull(clone);
            assertEquals(s, clone.getStatus());
        } // FOR
    }
View Full Code Here


        params.setParameters(new Object[]{null, null, null});
        ByteBuffer buf = ByteBuffer.wrap(FastSerializer.serialize(params));
        buf.rewind();

        ParameterSet out = new ParameterSet();
        out.readExternal(new FastDeserializer(buf));

        assertEquals(3, out.toArray().length);
        assertNull(out.toArray()[0]);
    }
View Full Code Here

        params.setParameters(new Object[]{"foo"});
        ByteBuffer buf = ByteBuffer.wrap(FastSerializer.serialize(params));
        buf.rewind();

        ParameterSet out = new ParameterSet();
        out.readExternal(new FastDeserializer(buf));
        assertEquals(1, out.toArray().length);
        assertEquals("foo", out.toArray()[0]);
    }
View Full Code Here

        params.setParameters(new Object[]{new byte[]{'f', 'o', 'o'}});
        ByteBuffer buf = ByteBuffer.wrap(FastSerializer.serialize(params));
        buf.rewind();

        ParameterSet out = new ParameterSet();
        out.readExternal(new FastDeserializer(buf));
        assertEquals(1, out.toArray().length);

        byte[] bin = (byte[]) out.toArray()[0];
        assertEquals(bin[0], 'f'); assertEquals(bin[1], 'o'); assertEquals(bin[2], 'o');
    }
View Full Code Here

        }

        @Override
        public void handleMessage(ByteBuffer message, Connection c) {
            try {
                FastDeserializer fds = new FastDeserializer(message);
                StoredProcedureInvocation spi = fds.readObject(StoredProcedureInvocation.class);

                VoltTable vt[] = new VoltTable[1];
                vt[0] = new VoltTable(new VoltTable.ColumnInfo("Foo", VoltType.BIGINT));
                vt[0].addRow(1);
                ClientResponseImpl response =
View Full Code Here

                              this.ts, partition));
                synchronized (this) {
                    this.prefetchDeserializers = new ThreadLocal<FastDeserializer>() {
                        @Override
                        protected FastDeserializer initialValue() {
                            return (new FastDeserializer(new byte[0]));
                        }
                    };
                } // SYNCH
            }
            FastDeserializer fd = this.prefetchDeserializers.get();
            boolean result = PrefetchQueryUtil.dispatchPrefetchQueries(hstore_site, this.ts, fd, partition);
            if (debug.val)
                LOG.debug(String.format("%s - Result from dispatching prefetch queries at partition %d -> %s",
                          this.ts, partition, result));
        }
View Full Code Here

            if (this.prefetchDeserializers == null) {
                synchronized (this) {
                    this.prefetchDeserializers = new ThreadLocal<FastDeserializer>() {
                        @Override
                        protected FastDeserializer initialValue() {
                            return (new FastDeserializer(new byte[0]));
                        }
                    };
                } // SYNCH
            }
            FastDeserializer fd = this.prefetchDeserializers.get();
            boolean result = PrefetchQueryUtil.dispatchPrefetchQueries(hstore_site, this.ts, fd, partition);
            if (debug.val)
                LOG.debug(String.format("%s - Result from dispatching prefetch queries at partition %d -> %s",
                          this.ts, partition, result));
        }
View Full Code Here

        /**
         * Handle an incoming message
         */
        public void handleInput(ByteBuffer message, Connection connection) {
            ClientResponseImpl response = null;
            FastDeserializer fds = new FastDeserializer(message);
            try {
                response = fds.readObject(ClientResponseImpl.class);
            } catch (IOException e) {
                e.printStackTrace();
            }
            ProcedureCallback cb = null;
            cb = m_callbacks.remove(response.getClientHandle());
View Full Code Here

        }

        ArrayList<AdvertisedDataSource> result =
            new ArrayList<AdvertisedDataSource>();

        FastDeserializer fds = new FastDeserializer(m_data);

        int count = m_data.getInt();
        for (int i=0; i < count; i++) {
            ArrayList<VoltType> types = new ArrayList<VoltType>();
            ArrayList<String> names = new ArrayList<String>();

            byte is_replicated = fds.readByte();
            int p_id = fds.readInt();
            long t_id = fds.readLong();
            String t_name = fds.readString();
            int colcnt = fds.readInt();
            for (int jj = 0; jj < colcnt; jj++) {
                names.add(fds.readString());
                types.add(VoltType.get((byte)fds.readInt()));
            }
            result.add(new AdvertisedDataSource(is_replicated, p_id, t_id,
                                                t_name, names, types));
        }
        return result;
View Full Code Here

            // partitions that are local at this site.
            partitions = new PartitionSet(request.getPartitionsList());

            ParameterSet procParams = null;
            if (request.hasProcParams()) {
                FastDeserializer fds = new FastDeserializer(request.getProcParams().asReadOnlyByteBuffer());
                try {
                    procParams = fds.readObject(ParameterSet.class);
                } catch (Exception ex) {
                    String msg = String.format("Failed to deserialize procedure ParameterSet for txn #%d from %s",
                                               txn_id, request.getClass().getSimpleName());
                    throw new ServerFaultException(msg, ex, txn_id);
                }
View Full Code Here

TOP

Related Classes of org.voltdb.messaging.FastDeserializer

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.