Package org.voltdb.messaging

Examples of org.voltdb.messaging.FastDeserializer


        if (catalog_proc == null) {
            throw new RuntimeException("Unknown procedure id '" + procId + "'");
        }
       
        // Initialize the ParameterSet
        FastDeserializer incomingDeserializer = new FastDeserializer();
        ParameterSet procParams = new ParameterSet();
        try {
            incomingDeserializer.setBuffer(StoredProcedureInvocation.getParameterSet(paramsBuffer));
            procParams.readExternal(incomingDeserializer);
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
        assert(procParams != null) :
View Full Code Here


                LOG.warn("Failure to authenticate connection(" + socket.socket().getRemoteSocketAddress() +
                             "): wire protocol violation (timeout reading authentication strings).");
                return null;
            }
            message.flip().position(1);//skip version
            FastDeserializer fds = new FastDeserializer(message);
            @SuppressWarnings("unused")
            final String service = fds.readString();
            @SuppressWarnings("unused")
            final String username = fds.readString();
            final byte password[] = new byte[20];
            message.get(password);

            /*
             * Create an input handler.
View Full Code Here

        }

        // Extract the stuff we need to figure out whether this guy belongs at our site
        // We don't need to create a StoredProcedureInvocation anymore in order to
        // extract out the data that we need in this request
        final FastDeserializer incomingDeserializer = this.incomingDeserializers.get();
        incomingDeserializer.setBuffer(buffer);
        final long client_handle = StoredProcedureInvocation.getClientHandle(buffer);
        final int procId = StoredProcedureInvocation.getProcedureId(buffer);
        int base_partition = StoredProcedureInvocation.getBasePartition(buffer);
        if (debug.val)
            LOG.debug(String.format("Raw Request: clientHandle=%d / basePartition=%d / procId=%d / procName=%s",
                      client_handle, base_partition,
                      procId, StoredProcedureInvocation.getProcedureName(incomingDeserializer)));
       
        // Optimization: We can get the Procedure catalog handle from its procId
        Procedure catalog_proc = catalogContext.getProcedureById(procId);
    
        // Otherwise, we have to get the procedure name and do a look up with that.
        if (catalog_proc == null) {
            String procName = StoredProcedureInvocation.getProcedureName(incomingDeserializer);
            catalog_proc = this.catalogContext.procedures.getIgnoreCase(procName);
            if (catalog_proc == null) {
                String msg = "Unknown procedure '" + procName + "'";
                this.responseError(client_handle,
                                   Status.ABORT_UNEXPECTED,
                                   msg,
                                   clientCallback,
                                   timestamp);
                return;
            }
        }
        boolean sysproc = catalog_proc.getSystemproc();
       
        // -------------------------------
        // PARAMETERSET INITIALIZATION
        // -------------------------------
       
        // Extract just the ParameterSet from the StoredProcedureInvocation
        // We will deserialize the rest of it later
        ParameterSet procParams = new ParameterSet();
        try {
            StoredProcedureInvocation.seekToParameterSet(buffer);
            incomingDeserializer.setBuffer(buffer);
            procParams.readExternal(incomingDeserializer);
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
        assert(procParams != null) :
View Full Code Here

        } catch (IOException ex) {
            LOG.trace("Failed to open file :"+f.getAbsolutePath());           
            throw new RuntimeException(ex);
        }
        assert(readonlybuffer != null);
        this.fd = new FastDeserializer(readonlybuffer);
               
        this.procedures = this.readHeader();       
    }
View Full Code Here

    public Iterator<LogEntry> iterator() {
        Iterator<LogEntry> it = new Iterator<LogEntry>() {
            FastDeserializer decompressedFd;
            private LogEntry _next;
            {
                decompressedFd = new FastDeserializer(ByteBuffer.allocate(0));
               
                this.next();
            }
            @Override
            public boolean hasNext() {
View Full Code Here

        ByteBuffer buffer = ByteBuffer.wrap(invocation_bytes);
        ByteBuffer paramsBuffer = StoredProcedureInvocation.getParameterSet(buffer);
        assertNotNull(paramsBuffer);
       
        ParameterSet cloneParams = new ParameterSet();
        FastDeserializer fds = new FastDeserializer(paramsBuffer);
        cloneParams.readExternal(fds);
       
        assertEquals(PARAMS.length, cloneParams.size());
        for (int i = 0; i < PARAMS.length; i++) {
            assertEquals(PARAMS[i], cloneParams.toArray()[i]);
View Full Code Here

        byte[] invocation_bytes = FastSerializer.serialize(invocation);
        assertNotNull(invocation_bytes);
       
        for (int partition = 0; partition < 100; partition+=3) {
            StoredProcedureInvocation.setBasePartition(partition, ByteBuffer.wrap(invocation_bytes));
            FastDeserializer fds = new FastDeserializer(invocation_bytes);
            StoredProcedureInvocation clone = fds.readObject(StoredProcedureInvocation.class);
            assertNotNull(clone);
            assert(clone.hasBasePartition());
            assertEquals(partition, clone.getBasePartition());
        } // FOR
    }
View Full Code Here

        StoredProcedureInvocation invocation = new StoredProcedureInvocation(CLIENT_HANDLE, TARGET_PROCEDURE, PARAMS);
        byte[] invocation_bytes = FastSerializer.serialize(invocation);
        assertNotNull(invocation_bytes);

        // Let 'er rip!
        FastDeserializer fds = new FastDeserializer(invocation_bytes);
        StoredProcedureInvocation clone = fds.readObject(StoredProcedureInvocation.class);
        assertNotNull(clone);
        clone.buildParameterSet();
       
        assertEquals(invocation.getClientHandle(), clone.getClientHandle());
        assertEquals(invocation.getProcName(), clone.getProcName());
View Full Code Here

        assertNotNull(invocation_bytes);
       
        for (int i = 0; i < 99; i++) {
            ByteBuffer b = ByteBuffer.wrap(invocation_bytes);
            ClientResponseImpl.setRestartCounter(b, i);
            FastDeserializer fds = new FastDeserializer(invocation_bytes);
            ClientResponseImpl clone = fds.readObject(ClientResponseImpl.class);
            assertNotNull(clone);
            assertEquals(i, clone.getRestartCounter());
        } // FOR
    }
View Full Code Here

        assertNotNull(invocation_bytes);
       
        for (int partition : new int[]{ 1, 10, 100}) {
            ByteBuffer b = ByteBuffer.wrap(invocation_bytes);
            ClientResponseImpl.setBasePartition(b, partition);
            FastDeserializer fds = new FastDeserializer(invocation_bytes);
            ClientResponseImpl clone = fds.readObject(ClientResponseImpl.class);
            assertNotNull(clone);
            assertEquals(partition, clone.getBasePartition());
        } // FOR
    }
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.