use of com.aerospike.redisson.AerospikeHandler in project XRTB by benmfaul.
the class TestDeadmanSwitch method testDelayedExpire.
@Test
public void testDelayedExpire() throws Exception {
AerospikeHandler spike = AerospikeHandler.getInstance("localhost", 3000, 300);
RedissonClient redisson = new RedissonClient(spike);
redisson.del("xxx");
Map m = new HashMap();
m.put("Ben", 1);
m.put("Peter", 2);
redisson.hmset("xxx", m);
m = redisson.hgetAll("xxx");
assertNotNull(m);
Long n = (Long) m.get("Ben");
assertNotNull(n);
redisson.expire("xxx", 2);
m = redisson.hgetAll("xxx");
assertNotNull(m);
n = (Long) m.get("Ben");
assertNotNull(n);
Thread.sleep(5000);
m = redisson.hgetAll("xxx");
assertNull(m);
}
use of com.aerospike.redisson.AerospikeHandler in project XRTB by benmfaul.
the class TestDeadmanSwitch method testSwitch.
/**
*
* @throws Exception
*/
@Test
public void testSwitch() throws Exception {
AerospikeHandler spike = AerospikeHandler.getInstance("localhost", 3000, 300);
RedissonClient redisson = new RedissonClient(spike);
DeadmanSwitch.testmode = true;
redisson.del("deadmanswitch");
DeadmanSwitch d = new DeadmanSwitch(redisson, "deadmanswitch");
Thread.sleep(1000);
assertFalse(d.canRun());
redisson.set("deadmanswitch", "ready", 5);
assertTrue(d.canRun());
Thread.sleep(10000);
assertFalse(d.canRun());
}
use of com.aerospike.redisson.AerospikeHandler in project XRTB by benmfaul.
the class AeroListSet method main.
public static void main(String[] args) throws Exception {
int i = 0;
String aero = "localhost:3000";
String key = null;
String setName = null;
String mapName = null;
String op = null;
String name = null;
String file = null;
boolean range = false;
while (i < args.length) {
switch(args[i]) {
case "-file":
file = args[i + 1];
i += 2;
break;
case "-aero":
aero = args[i + 1];
i += 2;
break;
case "-load-set":
setName = args[i + 1];
op = "load";
i += 2;
break;
case "-range":
range = true;
i++;
break;
case "-delete-set":
setName = args[i + 1];
op = "delete";
i += 2;
break;
case "-read-set":
op = "read";
setName = args[i + 1];
i += 2;
break;
case "-load-map":
op = "load";
mapName = args[i + 1];
i += 2;
break;
case "-delete-map":
op = "delete";
mapName = args[i + 1];
i += 2;
break;
case "-read-map":
op = "read";
mapName = args[i + 1];
i += 2;
break;
case "-key":
key = args[i + 1];
i += 2;
case "-name":
name = args[i + 1];
i += 2;
break;
default:
System.out.println("Huh? " + args[i]);
System.exit(0);
;
}
;
}
String[] parts = aero.split(":");
int port = 3000;
String host = parts[0];
if (parts.length > 1) {
port = Integer.parseInt(parts[1]);
}
AerospikeHandler client = AerospikeHandler.getInstance(host, port, 300);
RedissonClient redisson = new RedissonClient(client);
if (setName != null) {
if (op.equals("load")) {
loadSet(redisson, file, setName, range);
return;
}
if (op.equals("query")) {
Object value = redisson.get("userstore", key);
System.out.println(value);
}
}
if (mapName != null) {
}
System.out.println("Can't figure out what you want to do");
}
use of com.aerospike.redisson.AerospikeHandler in project XRTB by benmfaul.
the class TestFreqCapLogc method testExpire.
@Test
public void testExpire() throws Exception {
AerospikeHandler client = AerospikeHandler.getInstance("localhost", 3000, 300);
RedissonClient redisson = new RedissonClient(client);
redisson.del("JUNK");
redisson.set("JUNK", "1000", 5);
Thread.sleep(4000);
assertTrue(redisson.get("JUNK").equals("1000"));
Thread.sleep(2000);
assertNull(redisson.get("JUNK"));
}
use of com.aerospike.redisson.AerospikeHandler in project XRTB by benmfaul.
the class NameNode method main.
public static void main(String[] args) throws Exception {
AerospikeHandler spike = AerospikeHandler.getInstance("localhost", 3000, 300);
redis = new RedissonClient(spike);
System.out.println("Members(0): " + NameNode.getMembers(redis));
NameNode master = new NameNode("localhost", 3000);
NameNode a = new NameNode("a", "localhost", 3000);
NameNode b = new NameNode("b", "localhost", 3000);
System.out.println("Members(1): " + NameNode.getMembers(redis));
Thread.sleep(15000);
b.stop();
System.out.println("STOPPED B");
Thread.sleep(40000);
System.out.println("Members(n): " + NameNode.getMembers(redis));
}
Aggregations