Examples of multi()


Examples of redis.clients.jedis.Jedis.multi()

        try {
//            jedis.pipelined(new PipelineBlock() {
//                @Override
//                public void execute() {
            Transaction multi = jedis.multi();
            while (events.hasNext()) {
                DomainEventMessage domainEvent = events.next();
                multi.rpush(new String(key, IOUtils.UTF8), new String(eventSerializer.serialize(domainEvent, byte[].class)
                                                                             .getData(), IOUtils.UTF8));
            }
View Full Code Here

Examples of redis.clients.jedis.Jedis.multi()

     */
    private List<Object> runWithTx(final JedisTransactionalCallback callback) {

        Jedis jedis = jedisPool.getResource();
        try {
            Transaction tx = jedis.multi();
            callback.execute(tx);
            return tx.exec();
        } finally {
            jedisPool.returnResource(jedis);
        }
View Full Code Here

Examples of redis.clients.jedis.Jedis.multi()

            final String chid = channel.getChannelId();
            if (jedis.sismember(uaidLookupKey(uaid), chid)) {
                return false;
            }
            final String endpointToken = channel.getEndpointToken();
            final Transaction tx = jedis.multi();
            tx.set(endpointToken, Long.toString(channel.getVersion()));
            tx.set(tokenLookupKey(endpointToken), chid);
            tx.hmset(chidLookupKey(chid), mapOf(endpointToken, uaid));
            tx.sadd(uaidLookupKey(uaid), chid);
            tx.exec();
View Full Code Here

Examples of redis.clients.jedis.Jedis.multi()

    private void removeChannel(final String channelId) {
        final Jedis jedis = jedisPool.getResource();
        try {
            final Channel channel = getChannel(channelId);
            final String endpointToken = channel.getEndpointToken();
            final Transaction tx = jedis.multi();
            tx.del(endpointToken);
            tx.del(chidLookupKey(channelId));
            tx.del(tokenLookupKey(endpointToken));
            tx.srem(uaidLookupKey(channel.getUAID()), channelId);
            tx.exec();
View Full Code Here

Examples of redis.clients.jedis.Jedis.multi()

            }
            final long currentVersion = Long.valueOf(versionString);
            if (newVersion <= currentVersion) {
                throw new VersionException("version [" + newVersion + "] must be greater than the current version [" + currentVersion + "]");
            }
            final Transaction tx = jedis.multi();
            tx.set(endpointToken, String.valueOf(newVersion));
            tx.exec();
            logger.debug(tokenLookupKey(endpointToken));
            return jedis.get(tokenLookupKey(endpointToken));
        } finally {
View Full Code Here

Examples of redis.clients.jedis.Jedis.multi()

                        j.unwatch();
                        throw new SetFailedException();
                    }
                }
            }
            Transaction tr = j.multi();
            if (state == null) {
                tr.hdel(queueUrl + "-" + shard + "-" + CQSConstants.REDIS_STATE, CQSConstants.REDIS_STATE);
            } else {
                tr.hset(queueUrl + "-" + shard + "-" + CQSConstants.REDIS_STATE, CQSConstants.REDIS_STATE, state.name());
            }
View Full Code Here

Examples of redis.clients.jedis.Jedis.multi()

            String val = j.get(redisKey);
            if (val != null) {
                j.unwatch();
                return false;
            }
            Transaction tr = j.multi();

            //sentinel expired. kick off new RevisibleProcessor job
            tr.set(redisKey, "Y");
            tr.expire(redisKey, exp); //expire after exp seconds
            // since we have called watch, tr.exec will return null in the case that someone else has modified
View Full Code Here

Examples of redis.clients.jedis.Jedis.multi()

             j.unwatch();
             throw new SetFailedException();
           }
         }
       }
       Transaction tr = j.multi();
       if (state == null) {
         tr.hdel(queueUrl + "-" + shard + "-" + CQSConstants.REDIS_STATE, CQSConstants.REDIS_STATE);
       } else {
         tr.hset(queueUrl + "-" + shard + "-" + CQSConstants.REDIS_STATE, CQSConstants.REDIS_STATE, state.name());
       }
View Full Code Here

Examples of redis.clients.jedis.Jedis.multi()

        long expireAtTime = currentTime + (maxInactiveInterval * 1000);
        long expireAtTimeWithReserve = currentTime + (maxInactiveInterval * 1000 * 2);

        Jedis jedis = pool.getResource();
        try {
            Transaction transaction = jedis.multi();

            transaction.set(creationTimeKey, Long.toString(currentTime));
            transaction.set(lastAccessTimeKey, Long.toString(currentTime));
            transaction.set(expiresAtKey, Long.toString(expireAtTimeWithReserve));
            transaction.set(timeoutKey, Integer.toString(maxInactiveInterval));
View Full Code Here

Examples of redis.clients.jedis.Jedis.multi()

        long lastAccessTime = getLastAccessedTime();

        Jedis jedis = pool.getResource();
        try {
            Transaction transaction = jedis.multi();

            transaction.rename(oldCreationTimeKey, newCreationTimeKey);
            transaction.rename(oldLastAccessTimeKey, newLastAccessTimeKey);
            transaction.rename(oldExpiresAtKey, newExpiresAtKey);
            transaction.rename(oldTimeoutKey, newTimeoutKey);
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.