Package com.netflix.curator.framework.recipes.atomic

Examples of com.netflix.curator.framework.recipes.atomic.DistributedAtomicLong


        super.init(); // super.init() must be called after setControlTree()
    }

    private void initRefIdCounter() throws Exception {
        this.refIdCounter = new DistributedAtomicLong(client, REF_COUNTER, retryPolicy);
        AtomicValue<Long> av;

        av = refIdCounter.increment(); // we need this b/c refIdCounter.compareAndSet(0, INITIAL_REF_ID) doesn't work on a newly allocated znode.
        if (!av.succeeded())
            throw new RuntimeException("Error initializing refIdCounter");
View Full Code Here


        super.init(); // super.init() must be called after setControlTree()
    }

    private void initRefIdCounter() throws Exception {
        this.refIdCounter = new DistributedAtomicLong(client, REF_COUNTER, retryPolicy);
        AtomicValue<Long> av;

        av = refIdCounter.increment(); // we need this b/c refIdCounter.compareAndSet(0, INITIAL_REF_ID) doesn't work on a newly allocated znode.
        if (!av.succeeded())
            throw new RuntimeException("Error initializing refIdCounter");
View Full Code Here

    }

    @Override
    public long nextUid(MailboxSession session, Mailbox mailbox) throws MailboxException {
        if (client.isStarted()) {
            DistributedAtomicLong uid = new DistributedAtomicLong(client, pathForMailbox(mailbox), retryPolicy);
            AtomicValue<Long> value = null;
            try {
                uid.increment();
                value = uid.get();
            } catch (Exception e) {
                throw new MailboxException("Exception incrementing UID for session " + session, e);
            } finally {
                if (value != null && value.succeeded()) {
                    return value.postValue();
View Full Code Here

    }

    @Override
    public long lastUid(MailboxSession session, Mailbox<E> mailbox) throws MailboxException {
        if (client.isStarted()) {
            DistributedAtomicLong uid = new DistributedAtomicLong(client, pathForMailbox(mailbox), retryPolicy);
            AtomicValue<Long> value = null;
            try {
                value = uid.get();
            } catch (Exception e) {
                throw new MailboxException("Exception getting last UID for session " + session, e);
            } finally {
                if (value != null && value.succeeded()) {
                    return value.postValue();
View Full Code Here

TOP

Related Classes of com.netflix.curator.framework.recipes.atomic.DistributedAtomicLong

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.