Package org.apache.kahadb.util

Examples of org.apache.kahadb.util.ByteSequence


        }

    }

    synchronized ByteSequence getPayload(Location location) throws IllegalStateException, IOException {
        ByteSequence result = null;
        result = this.journal.read(location);
        return result;
    }
View Full Code Here


     * @param location
     * @return
     * @throws IOException
     */
    public JournalCommand<?> load(Location location) throws IOException {
        ByteSequence data = journal.read(location);
        DataByteArrayInputStream is = new DataByteArrayInputStream(data);
        byte readByte = is.readByte();
        KahaEntryType type = KahaEntryType.valueOf(readByte);
        if( type == null ) {
            throw new IOException("Could not load journal record. Invalid location: "+location);
View Full Code Here

            Object repeatValue = msg.getProperty(ScheduledMessage.AMQ_SCHEDULED_REPEAT);
            if (repeatValue != null) {
                repeat = (Integer) TypeConversionSupport.convert(repeatValue, Integer.class);
            }
            getInternalScheduler().schedule(msg.getMessageId().toString(),
                    new ByteSequence(packet.data, packet.offset, packet.length),cronEntry, delay, period, repeat);

        } else {
            super.send(producerExchange, messageSend);
        }
    }
View Full Code Here

        SystemUsage usage = brokerService.getSystemUsage();
        usage.getTempUsage().setLimit(1025*1024*15);

        // put something in the temp store to on demand initialise it
        PList dud = brokerService.getTempDataStore().getPList("dud");
        dud.addFirst("A", new ByteSequence("A".getBytes()));
    }
View Full Code Here

    public Location store(JournalCommand<?> data, boolean sync, Runnable before,Runnable after, Runnable onJournalStoreComplete) throws IOException {
        if (before != null) {
            before.run();
        }
        try {
            ByteSequence sequence = toByteSequence(data);
            long start = System.currentTimeMillis();
            Location location = onJournalStoreComplete == null ? journal.write(sequence, sync) :  journal.write(sequence, onJournalStoreComplete) ;
            long start2 = System.currentTimeMillis();
            process(data, location, after);
            long end = System.currentTimeMillis();
View Full Code Here

     * @return
     * @throws IOException
     */
    public JournalCommand<?> load(Location location) throws IOException {
        long start = System.currentTimeMillis();
        ByteSequence data = journal.read(location);
        long end = System.currentTimeMillis();
        if( LOG_SLOW_ACCESS_TIME>0 && end-start > LOG_SLOW_ACCESS_TIME) {
            if (LOG.isInfoEnabled()) {
                LOG.info("Slow KahaDB access: Journal read took: "+(end-start)+" ms");
            }
View Full Code Here

                    ref.set(iterator.next());
                }
            });
        }
        if (ref.get() != null) {
            ByteSequence bs = this.store.getPayload(ref.get().getValue());
            result = new PListEntry(ref.get().getKey(), bs);
        }
        return result;
    }
View Full Code Here

                    ref.set(getFirst(tx));
                }
            });
        }
        if (ref.get() != null) {
            ByteSequence bs = this.store.getPayload(ref.get().getValue());
            result = new PListEntry(ref.get().getKey(), bs);
        }
        return result;
    }
View Full Code Here

                    ref.set(getLast(tx));
                }
            });
        }
        if (ref.get() != null) {
            ByteSequence bs = this.store.getPayload(ref.get().getValue());
            result = new PListEntry(ref.get().getKey(), bs);
        }
        return result;
    }
View Full Code Here

        }

        @Override
        public PListEntry next() {
            Map.Entry<String, Location> entry = iterator.next();
            ByteSequence bs = null;
            try {
                bs = store.getPayload(entry.getValue());
            } catch (IOException unexpected) {
                NoSuchElementException e = new NoSuchElementException(unexpected.getLocalizedMessage());
                e.initCause(unexpected);
View Full Code Here

TOP

Related Classes of org.apache.kahadb.util.ByteSequence

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.