Examples of Pipeline


Examples of redis.clients.jedis.Pipeline

  assertEquals(r.get(), "bar");
    }

    @Test
    public void multi() {
  Pipeline p = jedis.pipelined();
  p.multi();
  Response<Long> r1 = p.hincrBy("a", "f1", -1);
  Response<Long> r2 = p.hincrBy("a", "f1", -2);
  Response<List<Object>> r3 = p.exec();
  List<Object> result = p.syncAndReturnAll();

  assertEquals(new Long(-1), r1.get());
  assertEquals(new Long(-3), r2.get());

  assertEquals(4, result.size());
View Full Code Here

Examples of redis.clients.jedis.Pipeline

    @Test
    public void multiWithSync() {
  jedis.set("foo", "314");
  jedis.set("bar", "foo");
  jedis.set("hello", "world");
  Pipeline p = jedis.pipelined();
  Response<String> r1 = p.get("bar");
  p.multi();
  Response<String> r2 = p.get("foo");
  p.exec();
  Response<String> r3 = p.get("hello");
  p.sync();

  // before multi
  assertEquals("foo", r1.get());
  // It should be readable whether exec's response was built or not
  assertEquals("314", r2.get());
View Full Code Here

Examples of redis.clients.jedis.Pipeline

  assertEquals("world", r3.get());
    }

    @Test(expected = JedisDataException.class)
    public void pipelineExecShoudThrowJedisDataExceptionWhenNotInMulti() {
  Pipeline pipeline = jedis.pipelined();
  pipeline.exec();
    }
View Full Code Here

Examples of redis.clients.jedis.Pipeline

  pipeline.exec();
    }

    @Test(expected = JedisDataException.class)
    public void pipelineDiscardShoudThrowJedisDataExceptionWhenNotInMulti() {
  Pipeline pipeline = jedis.pipelined();
  pipeline.discard();
    }
View Full Code Here

Examples of simple.http.Pipeline

        super(size);
    }

    @Override
    public Pipeline getInstance(Socket sock) throws IOException {
        Pipeline result = super.getInstance(sock);
        result.put(PROPERTY_SOCKET, sock);
        return result;
    }
View Full Code Here

Examples of streamer.Pipeline

                (byte)0x01, (byte)0x00, // Length if source descriptor: 1 (LE)
                (byte)0x00, // Source descriptor (should be set to 0): 0
        }));

        Pipeline pipeline = new PipelineImpl("test");
        pipeline.add(source, tpkt, x224, mcs, channel1003, sink);
        pipeline.link("source", "tpkt", "x224", "mcs >channel_1003", "channel_1003 >deactivate_all", "sink");
        pipeline.runMainLoop("source", STDOUT, false, false);
    }
View Full Code Here

Examples of us.codecraft.webmagic.pipeline.Pipeline

public class SpiderTest {

    @Ignore("long time")
    @Test
    public void testStartAndStop() throws InterruptedException {
        Spider spider = Spider.create(new SimplePageProcessor("http://www.oschina.net/", "http://www.oschina.net/*")).addPipeline(new Pipeline() {
            @Override
            public void process(ResultItems resultItems, Task task) {
                System.out.println(1);
            }
        }).thread(1);
View Full Code Here

Examples of voldemort.store.routed.Pipeline

                                                                                                                         failureDetector,
                                                                                                                         1,
                                                                                                                         routingStrategy,
                                                                                                                         aKey,
                                                                                                                         null);
        Pipeline pipeline = new Pipeline(Operation.GET, 10000, TimeUnit.MILLISECONDS);
        pipeline.addEventAction(Event.STARTED, action);
        pipeline.addEvent(Event.STARTED);
        pipeline.execute();

        if(pipelineData.getFatalError() != null)
            throw pipelineData.getFatalError();

        assertEquals(cluster.getNodes().size(), pipelineData.getNodes().size());
View Full Code Here

Examples of voldemort.store.routed.Pipeline

                                                                                                                         cluster.getNodes()
                                                                                                                                .size() + 1,
                                                                                                                         routingStrategy,
                                                                                                                         aKey,
                                                                                                                         null);
        Pipeline pipeline = new Pipeline(Operation.GET, 10000, TimeUnit.MILLISECONDS);
        pipeline.addEventAction(Event.STARTED, action);
        pipeline.addEvent(Event.STARTED);
        pipeline.execute();

        if(pipelineData.getFatalError() != null)
            throw pipelineData.getFatalError();
        else
            fail();
View Full Code Here

Examples of voldemort.store.routed.Pipeline

        RoutingStrategy routingStrategy = new ZoneRoutingStrategy(clusterWithZones,
                                                                  storeDef.getZoneReplicationFactor(),
                                                                  storeDef.getReplicationFactor());

        BasicPipelineData<byte[]> pipelineData = new BasicPipelineData<byte[]>();
        Pipeline pipeline = new Pipeline(Operation.PUT, 10000, TimeUnit.MILLISECONDS);

        // PUT with changing zone id
        for(int clusterZoneId = 0; clusterZoneId < clusterWithZones.getNumberOfZones(); clusterZoneId++) {
            pipelineData.setZonesRequired(storeDef.getZoneCountWrites());
            pipeline.addEventAction(Event.STARTED,
                                    new ConfigureNodes<byte[], BasicPipelineData<byte[]>>(pipelineData,
                                                                                          Event.COMPLETED,
                                                                                          failureDetectorWithZones,
                                                                                          storeDef.getRequiredReads(),
                                                                                          routingStrategy,
                                                                                          aKey,
                                                                                          clusterWithZones.getZoneById(clusterZoneId)));
            pipeline.addEvent(Event.STARTED);
            pipeline.execute();

            List<Node> pipelineNodes = pipelineData.getNodes();
            int pipelineNodesIndex = 0;
            List<Integer> proximityList = clusterWithZones.getZoneById(clusterZoneId)
                                                          .getProximityList();

            // Check if returned list is as per the proximity list
            assertEquals(pipelineNodes.get(pipelineNodesIndex++).getZoneId(), clusterZoneId);
            for(; pipelineNodesIndex < pipelineNodes.size(); pipelineNodesIndex++) {
                assertEquals(proximityList.get(pipelineNodesIndex - 1),
                             new Integer(pipelineNodes.get(pipelineNodesIndex).getZoneId()));
            }
        }

        // GET with changing zone requirements
        for(int zoneReq = 0; zoneReq < clusterWithZones.getNumberOfZones(); zoneReq++) {
            pipelineData = new BasicPipelineData<byte[]>();
            pipeline = new Pipeline(Operation.GET, 10000, TimeUnit.MILLISECONDS);
            pipelineData.setZonesRequired(zoneReq);
            pipeline.addEventAction(Event.STARTED,
                                    new ConfigureNodes<byte[], BasicPipelineData<byte[]>>(pipelineData,
                                                                                          Event.COMPLETED,
                                                                                          failureDetectorWithZones,
                                                                                          storeDef.getRequiredReads(),
                                                                                          routingStrategy,
                                                                                          aKey,
                                                                                          clusterWithZones.getZoneById(0)));
            pipeline.addEvent(Event.STARTED);
            pipeline.execute();

            // Check the first few nodes which are from different zones
            int zoneId = 1;
            for(int index = 0; index < zoneReq; index++) {
                assertEquals(pipelineData.getNodes().get(index).getZoneId(), zoneId++);
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.