Java 类org.apache.commons.collections.list.UnmodifiableList 实例源码

项目:flink    文件:KafkaTestEnvironmentImpl.java   
@Override
public <K, V> Collection<ConsumerRecord<K, V>> getAllRecordsFromTopic(Properties properties, String topic, int partition, long timeout) {
    List<ConsumerRecord<K, V>> result = new ArrayList<>();
    try (KafkaConsumer<K, V> consumer = new KafkaConsumer<>(properties)) {
        consumer.assign(Arrays.asList(new TopicPartition(topic, partition)));

        while (true) {
            boolean processedAtLeastOneRecord = false;

            Iterator<ConsumerRecord<K, V>> iterator = consumer.poll(timeout).iterator();
            while (iterator.hasNext()) {
                ConsumerRecord<K, V> record = iterator.next();
                result.add(record);
                processedAtLeastOneRecord = true;
            }

            if (!processedAtLeastOneRecord) {
                break;
            }
        }
        consumer.commitSync();
    }

    return UnmodifiableList.decorate(result);
}
项目:flink    文件:KafkaTestEnvironmentImpl.java   
@Override
public <K, V> Collection<ConsumerRecord<K, V>> getAllRecordsFromTopic(Properties properties, String topic, int partition, long timeout) {
    List<ConsumerRecord<K, V>> result = new ArrayList<>();
    try (KafkaConsumer<K, V> consumer = new KafkaConsumer<>(properties)) {
        consumer.subscribe(new TopicPartition(topic, partition));

        while (true) {
            Map<String, ConsumerRecords<K, V>> topics = consumer.poll(timeout);
            if (topics == null || !topics.containsKey(topic)) {
                break;
            }
            List<ConsumerRecord<K, V>> records = topics.get(topic).records(partition);
            result.addAll(records);
            if (records.size() == 0) {
                break;
            }
        }
        consumer.commit(true);
    }

    return UnmodifiableList.decorate(result);
}
项目:flink    文件:KafkaTestEnvironmentImpl.java   
@Override
public <K, V> Collection<ConsumerRecord<K, V>> getAllRecordsFromTopic(Properties properties, String topic, int partition, long timeout) {
    List<ConsumerRecord<K, V>> result = new ArrayList<>();

    try (KafkaConsumer<K, V> consumer = new KafkaConsumer<>(properties)) {
        consumer.assign(Arrays.asList(new TopicPartition(topic, partition)));

        while (true) {
            boolean processedAtLeastOneRecord = false;

            // wait for new records with timeout and break the loop if we didn't get any
            Iterator<ConsumerRecord<K, V>> iterator = consumer.poll(timeout).iterator();
            while (iterator.hasNext()) {
                ConsumerRecord<K, V> record = iterator.next();
                result.add(record);
                processedAtLeastOneRecord = true;
            }

            if (!processedAtLeastOneRecord) {
                break;
            }
        }
        consumer.commitSync();
    }

    return UnmodifiableList.decorate(result);
}
项目:flink    文件:KafkaTestEnvironmentImpl.java   
@Override
public <K, V> Collection<ConsumerRecord<K, V>> getAllRecordsFromTopic(Properties properties, String topic, int partition, long timeout) {
    List<ConsumerRecord<K, V>> result = new ArrayList<>();

    try (KafkaConsumer<K, V> consumer = new KafkaConsumer<>(properties)) {
        consumer.assign(Arrays.asList(new TopicPartition(topic, partition)));

        while (true) {
            boolean processedAtLeastOneRecord = false;

            // wait for new records with timeout and break the loop if we didn't get any
            Iterator<ConsumerRecord<K, V>> iterator = consumer.poll(timeout).iterator();
            while (iterator.hasNext()) {
                ConsumerRecord<K, V> record = iterator.next();
                result.add(record);
                processedAtLeastOneRecord = true;
            }

            if (!processedAtLeastOneRecord) {
                break;
            }
        }
        consumer.commitSync();
    }

    return UnmodifiableList.decorate(result);
}
项目:directory-ldap-api    文件:Dn.java   
/**
 * Retrieves all the components of this name.
 *
 * @return All the components
 */
@SuppressWarnings("unchecked")
public List<Rdn> getRdns()
{
    return UnmodifiableList.decorate( rdns );
}
项目:flink-operator-library    文件:JsonContentProjectionMapper.java   
/**
 * Returns the configuration of this instance - implemented for testing purpose only
 * @return
 */
@SuppressWarnings("unchecked")
protected List<ProjectionMapperConfiguration> getConfiguration() {
    return UnmodifiableList.decorate(this.configuration);
}
项目:gsp-dba-maven-plugin    文件:ViewAnalyzer.java   
@SuppressWarnings("unchecked")
public List<String> getColumnNames() {
    return UnmodifiableList.decorate(simpleColumnNames);
}
项目:projectforge-webapp    文件:UserRights.java   
@SuppressWarnings("unchecked")
public List<UserRight> getOrderedRights()
{
  return UnmodifiableList.decorate(orderedRights);
}
项目:mev    文件:TopList.java   
@SuppressWarnings("unchecked")
public List<String> getList() {
    return UnmodifiableList.decorate(_list);
}