Search in sources :

Example 6 with RedissonClient

use of com.aerospike.redisson.RedissonClient 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());
}
Also used : RedissonClient(com.aerospike.redisson.RedissonClient) DeadmanSwitch(com.xrtb.bidder.DeadmanSwitch) AerospikeHandler(com.aerospike.redisson.AerospikeHandler) Test(org.junit.Test)

Example 7 with RedissonClient

use of com.aerospike.redisson.RedissonClient 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");
}
Also used : RedissonClient(com.aerospike.redisson.RedissonClient) AerospikeHandler(com.aerospike.redisson.AerospikeHandler)

Example 8 with RedissonClient

use of com.aerospike.redisson.RedissonClient 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"));
}
Also used : RedissonClient(com.aerospike.redisson.RedissonClient) AerospikeHandler(com.aerospike.redisson.AerospikeHandler) Test(org.junit.Test)

Example 9 with RedissonClient

use of com.aerospike.redisson.RedissonClient 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));
}
Also used : RedissonClient(com.aerospike.redisson.RedissonClient) AerospikeHandler(com.aerospike.redisson.AerospikeHandler)

Aggregations

AerospikeHandler (com.aerospike.redisson.AerospikeHandler)9 RedissonClient (com.aerospike.redisson.RedissonClient)9 Test (org.junit.Test)4 DeadmanSwitch (com.xrtb.bidder.DeadmanSwitch)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 BasicAWSCredentials (com.amazonaws.auth.BasicAWSCredentials)1 AmazonS3Client (com.amazonaws.services.s3.AmazonS3Client)1 ListObjectsRequest (com.amazonaws.services.s3.model.ListObjectsRequest)1 ObjectListing (com.amazonaws.services.s3.model.ObjectListing)1 S3Object (com.amazonaws.services.s3.model.S3Object)1 NavMap (com.xrtb.blocks.NavMap)1 DataBaseObject (com.xrtb.db.DataBaseObject)1 Database (com.xrtb.db.Database)1 Appnexus (com.xrtb.exchanges.appnexus.Appnexus)1 ForensiqClient (com.xrtb.fraud.ForensiqClient)1 MMDBClient (com.xrtb.fraud.MMDBClient)1 BidRequest (com.xrtb.pojo.BidRequest)1 ZkConnect (com.xrtb.tools.ZkConnect)1 ArrayList (java.util.ArrayList)1