Package org.apache.kahadb.util

Examples of org.apache.kahadb.util.ByteSequence


        long start = 10000;

        for (int i = 0; i < COUNT; i++) {
            String str = new String("test" + i);

                scheduler.schedule(ID + i, new ByteSequence(str.getBytes()), "", start + (i * 1000), 10000 + i, 0);

        }
        start = System.currentTimeMillis();
        long finish = start + 12000+ (COUNT * 1000);
        List<Job> list = scheduler.getAllJobs(start, finish);
View Full Code Here


        long start = 10000;

        for (int i = 0; i < COUNT; i++) {
            String str = new String("test" + i);

                scheduler.schedule(ID + i, new ByteSequence(str.getBytes()), "", start + (i * 1000), 10000 + i, 0);

        }
        start = System.currentTimeMillis();
        long finish = start + 12000+ (COUNT * 1000);
        scheduler.removeAllJobs(start, finish);
View Full Code Here

        store.setDirectory(directory);
    final int NUMBER = 1000;
    store.start();
    List<ByteSequence>list = new ArrayList<ByteSequence>();
    for (int i = 0; i < NUMBER;i++ ) {
            ByteSequence buff = new ByteSequence(new String("testjob"+i).getBytes());
            list.add(buff);    
        }
    JobScheduler js = store.getJobScheduler("test");
    int count = 0;
    long startTime = 10000;
View Full Code Here

                            flushToDisk();
                        }
                    }
                }
                if (systemUsage.getTempUsage().waitForSpace(maxWaitTime)) {
                    ByteSequence bs = getByteSequence(node.getMessage());
                    getDiskList().addLast(node.getMessageId().toString(), bs);
                    return true;
                }
                return false;
View Full Code Here

                        }
                    }
                }
                systemUsage.getTempUsage().waitForSpace();
                node.decrementReferenceCount();
                ByteSequence bs = getByteSequence(node.getMessage());
                getDiskList().addFirst(node.getMessageId().toString(), bs);

            } catch (Exception e) {
                LOG.error("Caught an Exception adding a message: " + node + " first to FilePendingMessageCursor ", e);
                throw new RuntimeException(e);
View Full Code Here

        if (!memoryList.isEmpty()) {
            while (!memoryList.isEmpty()) {
                MessageReference node = memoryList.removeFirst();
                node.decrementReferenceCount();
                ByteSequence bs;
                try {
                    bs = getByteSequence(node.getMessage());
                    getDiskList().addLast(node.getMessageId().toString(), bs);
                } catch (IOException e) {
                    LOG.error("Failed to write to disk list", e);
View Full Code Here

        broker.getRoot().sendToDeadLetterQueue(ctx, message, null);
    }

    protected ByteSequence getByteSequence(Message message) throws IOException {
        org.apache.activemq.util.ByteSequence packet = wireFormat.marshal(message);
        return new ByteSequence(packet.data, packet.offset, packet.length);
    }
View Full Code Here

        }

        public MessageReference next() {
            this.current = next;
            try {
                ByteSequence bs = this.current.getByteSequence();
                synchronized (this.list) {
                    this.current = this.list.refresh(this.current);
                    this.next = this.list.getNext(this.current);
                }
                return getMessage(bs);
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

        this.store.getPageFile().tx().execute(new Transaction.Closure<IOException>() {
            public void execute(Transaction tx) throws IOException {
                Map.Entry<Long, List<JobLocation>> first = index.getFirst(store.getPageFile().tx());
                if (first != null) {
                    for (JobLocation jl : first.getValue()) {
                        ByteSequence bs = getPayload(jl.getLocation());
                        Job job = new JobImpl(jl, bs);
                        result.add(job);
                    }
                }
            }
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.