Examples of DistributedAtomicLong


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

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

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

    }

    @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

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

    }

    @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

Examples of org.apache.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

Examples of org.apache.curator.framework.recipes.atomic.DistributedAtomicLong

        super.init(services);
        try {
            zk = ZKUtils.register(this);
            PromotedToLock.Builder lockBuilder = PromotedToLock.builder().lockPath(getPromotedLock())
                    .retryPolicy(getRetryPolicy()).timeout(Service.lockTimeout, TimeUnit.MILLISECONDS);
            atomicIdGenerator = new DistributedAtomicLong(zk.getClient(), ZK_SEQUENCE_PATH, getRetryPolicy(),
                    lockBuilder.build());

        }
        catch (Exception ex) {
            throw new ServiceException(ErrorCode.E1700, ex.getMessage(), ex);
View Full Code Here

Examples of org.apache.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
TOP
Copyright © 2018 www.massapi.com. 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.