Package org.apache.bookkeeper.proto.BookkeeperInternalCallbacks

Examples of org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.WriteCallback


    private class BookieSafeEntryAdder implements SafeEntryAdder {
        @Override
        public void safeAddEntry(final long ledgerId, final ByteBuffer buffer,
                                 final GenericCallback<Void> cb) {
            journal.logAddEntry(buffer, new WriteCallback() {
                    @Override
                    public void writeComplete(int rc, long ledgerId2, long entryId,
                                              InetSocketAddress addr, Object ctx) {
                        if (rc != BookieException.Code.OK) {
                            LOG.error("Error rewriting to journal (ledger {}, entry {})", ledgerId2, entryId);
View Full Code Here


    public static void main(String[] args) throws NumberFormatException, IOException, InterruptedException {
        if (args.length != 3) {
            System.err.println("USAGE: BookieClient bookieHost port ledger#");
            return;
        }
        WriteCallback cb = new WriteCallback() {

            public void writeComplete(int rc, long ledger, long entry, InetSocketAddress addr, Object ctx) {
                Counter counter = (Counter) ctx;
                counter.dec();
                if (rc != 0) {
View Full Code Here

                LedgerEntry entry = seq.nextElement();
                byte[] data = entry.getEntry();
                ChannelBuffer toSend = lh.getDigestManager().computeDigestAndPackageForSending(entryId,
                                       lh.getLastAddConfirmed(), entry.getLength(), data, 0, data.length);
                bkc.getBookieClient().addEntry(newBookie, lh.getId(), lh.getLedgerKey(), entryId, toSend,
                new WriteCallback() {
                    @Override
                    public void writeComplete(int rc, long ledgerId, long entryId, InetSocketAddress addr,
                    Object ctx) {
                        if (rc != Code.OK.intValue()) {
                            LOG.error("BK error writing entry for ledgerId: " + ledgerId + ", entryId: "
View Full Code Here

    void doOps(final int numOps) throws Exception {
        int numOutstanding = Integer.getInteger("nPars",1000);
        final Semaphore outstanding = new Semaphore(numOutstanding);


        WriteCallback callback = new WriteCallback() {
            AbstractCallback handler = new AbstractCallback(outstanding, numOps);

            @Override
            public void writeComplete(int rc, long ledgerId, long entryId,
            InetSocketAddress addr, Object ctx) {
View Full Code Here

        return finish - start;
    }
    private long doWrites(int ledgers, int size, int totalwrites)
            throws IOException, InterruptedException, BookieException {
        throttle = new Semaphore(10000);
        WriteCallback cb = new WriteCallback() {
            @Override
            public void writeComplete(int rc, long ledgerId, long entryId,
            InetSocketAddress addr, Object ctx) {
                AtomicInteger counter = (AtomicInteger)ctx;
                counter.getAndIncrement();
View Full Code Here

        return finish - start;
    }
    private long doWrites(int ledgers, int size, int totalwrites)
            throws IOException, InterruptedException, BookieException {
        throttle = new Semaphore(10000);
        WriteCallback cb = new WriteCallback() {
            @Override
            public void writeComplete(int rc, long ledgerId, long entryId,
            InetSocketAddress addr, Object ctx) {
                AtomicInteger counter = (AtomicInteger)ctx;
                counter.getAndIncrement();
View Full Code Here

    public static void main(String[] args) throws NumberFormatException, IOException, InterruptedException {
        if (args.length != 3) {
            System.err.println("USAGE: BookieClient bookieHost port ledger#");
            return;
        }
        WriteCallback cb = new WriteCallback() {

            public void writeComplete(int rc, long ledger, long entry, InetSocketAddress addr, Object ctx) {
                Counter counter = (Counter) ctx;
                counter.dec();
                if (rc != 0) {
View Full Code Here

        return finish - start;
    }
    private long doWrites(int ledgers, int size, int totalwrites)
            throws IOException, InterruptedException, BookieException {
        throttle = new Semaphore(10000);
        WriteCallback cb = new WriteCallback() {
            @Override
            public void writeComplete(int rc, long ledgerId, long entryId,
                    InetSocketAddress addr, Object ctx) {
                AtomicInteger counter = (AtomicInteger)ctx;
                counter.getAndIncrement();
View Full Code Here

    public static void main(String[] args) throws NumberFormatException, IOException, InterruptedException {
        if (args.length != 3) {
            System.err.println("USAGE: BookieClient bookieHost port ledger#");
            return;
        }
        WriteCallback cb = new WriteCallback() {

            public void writeComplete(int rc, long ledger, long entry, InetSocketAddress addr, Object ctx) {
                Counter counter = (Counter) ctx;
                counter.dec();
                if (rc != 0) {
View Full Code Here

                 */
                LedgerEntry entry = seq.nextElement();
                ChannelBuffer toSend = lh.getDigestManager().computeDigestAndPackageForSending(entryId,
                        lh.getLastAddConfirmed(), entry.getLength(), entry.getEntry());
                bkc.getBookieClient().addEntry(newBookie, lh.getId(), lh.getLedgerKey(), entryId, toSend,
                        new WriteCallback() {
                            @Override
                            public void writeComplete(int rc, long ledgerId, long entryId, InetSocketAddress addr,
                                    Object ctx) {
                                if (rc != Code.OK.intValue()) {
                                    LOG.error("BK error writing entry for ledgerId: " + ledgerId + ", entryId: "
View Full Code Here

TOP

Related Classes of org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.WriteCallback

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.