rx.functions.Action3 Java Examples
The following examples show how to use
rx.functions.Action3.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ListRecyclerAdapter.java From RxParse with Apache License 2.0 | 5 votes |
public void onBindViewHolder(VH viewHolder, int position, T item) { // final, DO NOT Override until certainly onBindViewHolderSupered = true; if (mOnBindViewHolder == null) { mOnBindViewHolder = new Action3<VH, Integer, T>() { @Override public void call(VH vh, Integer i, T t) { vh.onBind(i, t); } }; } mOnBindViewHolder.call(viewHolder, position, item); }
Example #2
Source File: ConnectToGroupedObservable.java From mantis with Apache License 2.0 | 4 votes |
public Action3<K, V, Throwable> getDeocdingErrorHandler() { return deocdingErrorHandler; }
Example #3
Source File: ConnectToGroupedObservable.java From mantis with Apache License 2.0 | 4 votes |
public Builder<K, V> deocdingErrorHandler(Action3<K, V, Throwable> handler, boolean suppressDecodingErrors) { this.deocdingErrorHandler = handler; this.suppressDecodingErrors = suppressDecodingErrors; return this; }
Example #4
Source File: ListRecyclerAdapter.java From RxParse with Apache License 2.0 | 4 votes |
public ListRecyclerAdapter<T, VH> bindViewHolder(Action3<VH, Integer, T> onBindViewHolder) { mOnBindViewHolder = onBindViewHolder; return this; }
Example #5
Source File: Actions.java From rxjava-extras with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") public static <T, R, S> Action3<T, R, S> doNothing3() { return (Action3<T, R, S>) HolderDoNothing3.INSTANCE; }
Example #6
Source File: KafkaSink.java From suro with Apache License 2.0 | 4 votes |
public void setRecordCounterListener(Action3 action) { this.recordCounterListener = action; }
Example #7
Source File: TestKafkaSink.java From suro with Apache License 2.0 | 4 votes |
@Test public void testCheckPause() throws IOException, InterruptedException { TopicCommand.createTopic(zk.getZkClient(), new TopicCommand.TopicCommandOptions(new String[]{ "--zookeeper", "dummy", "--create", "--topic", TOPIC_NAME + "check_pause", "--replication-factor", "2", "--partitions", "1"})); String description = "{\n" + " \"type\": \"kafka\",\n" + " \"client.id\": \"kafkasink\",\n" + " \"bootstrap.servers\": \"" + kafkaServer.getBrokerListStr() + "\",\n" + " \"acks\": 1,\n" + " \"buffer.memory\": 1000,\n" + " \"batch.size\": 1000\n" + "}"; final KafkaSink sink = jsonMapper.readValue(description, new TypeReference<Sink>(){}); sink.open(); final AtomicBoolean exceptionCaught = new AtomicBoolean(false); final AtomicBoolean checkPaused = new AtomicBoolean(false); final AtomicBoolean pending = new AtomicBoolean(false); final CountDownLatch latch = new CountDownLatch(1); sink.setRecordCounterListener(new Action3<Long, Long, Long>() { @Override public void call(Long queued, Long sent, Long dropped) { if (dropped > 0) { exceptionCaught.set(true); if (sink.checkPause() > 0) { checkPaused.set(true); } if (sink.getNumOfPendingMessages() > 0) { pending.set(true); } latch.countDown(); } } }); for (int i = 0; i < 100; ++i) { sink.writeTo(new DefaultMessageContainer(new Message(TOPIC_NAME + "check_pause", getBigData()), jsonMapper)); } assertTrue(latch.await(10, TimeUnit.SECONDS)); assertTrue(exceptionCaught.get()); assertTrue(checkPaused.get()); assertTrue(pending.get()); }
Example #8
Source File: TestKafkaSink.java From suro with Apache License 2.0 | 4 votes |
@Test public void testStartWithKafkaOutage() throws Throwable { String topicName = TOPIC_NAME + "kafkaoutage"; TopicCommand.createTopic(zk.getZkClient(), new TopicCommand.TopicCommandOptions(new String[]{ "--zookeeper", "dummy", "--create", "--topic", topicName, "--replication-factor", "2", "--partitions", "1"})); String[] brokerList = kafkaServer.getBrokerListStr().split(","); int port1 = Integer.parseInt(brokerList[0].split(":")[1]); int port2 = Integer.parseInt(brokerList[1].split(":")[1]); String description = "{\n" + " \"type\": \"kafka\",\n" + " \"client.id\": \"kafkasink\",\n" + " \"bootstrap.servers\": \"" + kafkaServer.getBrokerListStr() + "\",\n" + " \"acks\": 1\n" + " }" + "}"; kafkaServer.shutdown(); final KafkaSink sink = jsonMapper.readValue(description, new TypeReference<Sink>(){}); sink.open(); final int msgCount = 10000; final CountDownLatch latch = new CountDownLatch(1); sink.setRecordCounterListener(new Action3<Long, Long, Long>() { @Override public void call(Long queued, Long sent, Long dropped) { if (sent == msgCount - sink.droppedRecords.get()) { latch.countDown(); } } }); sendMessages(topicName, sink, msgCount); kafkaServer.startServer(port1, port2); // running up assertTrue(latch.await(10, TimeUnit.SECONDS)); sendMessages(topicName, sink, msgCount); sink.close(); checkConsumer(topicName, 2 * msgCount - (int) sink.droppedRecords.get()); }