Search in sources :

Example 1 with MarshallableEntry

use of org.infinispan.persistence.spi.MarshallableEntry in project wildfly by wildfly.

the class HotRodStore method batch.

@Override
public CompletionStage<Void> batch(int publisherCount, Publisher<SegmentedPublisher<Object>> removePublisher, Publisher<SegmentedPublisher<MarshallableEntry<K, V>>> writePublisher) {
    Completable removeCompletable = Flowable.fromPublisher(removePublisher).flatMap(sp -> Flowable.fromPublisher(sp), publisherCount).flatMapCompletable(key -> Completable.fromCompletionStage(this.cache.removeAsync(this.marshalKey(key))), false, this.batchSize);
    Completable writeCompletable = Flowable.fromPublisher(writePublisher).flatMap(sp -> Flowable.fromPublisher(sp), publisherCount).flatMapCompletable(entry -> Completable.fromCompletionStage(this.cache.putAsync(entry.getKeyBytes(), this.marshalValue(entry.getMarshalledValue()))), false, this.batchSize);
    return removeCompletable.mergeWith(writeCompletable).toCompletionStage(null);
}
Also used : MarshalledValue(org.infinispan.persistence.spi.MarshalledValue) ByteBuffer(org.infinispan.commons.io.ByteBuffer) MarshallableEntryFactory(org.infinispan.persistence.spi.MarshallableEntryFactory) RemoteCache(org.infinispan.client.hotrod.RemoteCache) RemoteCacheManager(org.infinispan.client.hotrod.RemoteCacheManager) HotRodClientException(org.infinispan.client.hotrod.exceptions.HotRodClientException) Functions(org.wildfly.common.function.Functions) CompletableFutures(org.infinispan.util.concurrent.CompletableFutures) InfinispanLogger(org.jboss.as.clustering.infinispan.InfinispanLogger) Flag(org.infinispan.client.hotrod.Flag) Map(java.util.Map) TransactionMode(org.infinispan.client.hotrod.configuration.TransactionMode) MarshallableEntry(org.infinispan.persistence.spi.MarshallableEntry) ConfiguredBy(org.infinispan.commons.configuration.ConfiguredBy) DefaultTemplate(org.infinispan.client.hotrod.DefaultTemplate) RemoteCacheContainer(org.wildfly.clustering.infinispan.client.RemoteCacheContainer) EnumSet(java.util.EnumSet) Flowable(io.reactivex.rxjava3.core.Flowable) NonBlockingStore(org.infinispan.persistence.spi.NonBlockingStore) Predicate(java.util.function.Predicate) Publisher(org.reactivestreams.Publisher) Set(java.util.Set) IOException(java.io.IOException) OperationsFactory(org.infinispan.client.hotrod.impl.operations.OperationsFactory) Completable(io.reactivex.rxjava3.core.Completable) RemoteCacheConfigurationBuilder(org.infinispan.client.hotrod.configuration.RemoteCacheConfigurationBuilder) Objects(java.util.Objects) Consumer(java.util.function.Consumer) NearCacheMode(org.infinispan.client.hotrod.configuration.NearCacheMode) IntSet(org.infinispan.commons.util.IntSet) CompletionStage(java.util.concurrent.CompletionStage) Stream(java.util.stream.Stream) PersistenceMarshaller(org.infinispan.marshall.persistence.PersistenceMarshaller) InitializationContext(org.infinispan.persistence.spi.InitializationContext) PingResponse(org.infinispan.client.hotrod.impl.operations.PingResponse) BlockingManager(org.infinispan.util.concurrent.BlockingManager) PersistenceException(org.infinispan.persistence.spi.PersistenceException) Completable(io.reactivex.rxjava3.core.Completable)

Aggregations

Completable (io.reactivex.rxjava3.core.Completable)1 Flowable (io.reactivex.rxjava3.core.Flowable)1 IOException (java.io.IOException)1 EnumSet (java.util.EnumSet)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Set (java.util.Set)1 CompletionStage (java.util.concurrent.CompletionStage)1 Consumer (java.util.function.Consumer)1 Predicate (java.util.function.Predicate)1 Stream (java.util.stream.Stream)1 DefaultTemplate (org.infinispan.client.hotrod.DefaultTemplate)1 Flag (org.infinispan.client.hotrod.Flag)1 RemoteCache (org.infinispan.client.hotrod.RemoteCache)1 RemoteCacheManager (org.infinispan.client.hotrod.RemoteCacheManager)1 NearCacheMode (org.infinispan.client.hotrod.configuration.NearCacheMode)1 RemoteCacheConfigurationBuilder (org.infinispan.client.hotrod.configuration.RemoteCacheConfigurationBuilder)1 TransactionMode (org.infinispan.client.hotrod.configuration.TransactionMode)1 HotRodClientException (org.infinispan.client.hotrod.exceptions.HotRodClientException)1 OperationsFactory (org.infinispan.client.hotrod.impl.operations.OperationsFactory)1