Search in sources :

Example 1 with ClientStatistics

use of org.infinispan.client.hotrod.impl.ClientStatistics in project infinispan by infinispan.

the class PutAllParallelOperation method mapOperations.

@Override
protected List<PutAllOperation> mapOperations() {
    Map<SocketAddress, Map<byte[], byte[]>> splittedMaps = new HashMap<>();
    for (Map.Entry<byte[], byte[]> entry : map.entrySet()) {
        SocketAddress socketAddress = channelFactory.getHashAwareServer(entry.getKey(), cacheName);
        Map<byte[], byte[]> keyValueMap = splittedMaps.get(socketAddress);
        if (keyValueMap == null) {
            keyValueMap = new HashMap<>();
            splittedMaps.put(socketAddress, keyValueMap);
        }
        keyValueMap.put(entry.getKey(), entry.getValue());
    }
    return splittedMaps.values().stream().map(mapSubset -> new PutAllOperation(codec, channelFactory, mapSubset, cacheName, header.topologyId(), flags, cfg, lifespan, lifespanTimeUnit, maxIdle, maxIdleTimeUnit, dataFormat, clientStatistics)).collect(Collectors.toList());
}
Also used : TimeUnit(java.util.concurrent.TimeUnit) ClientStatistics(org.infinispan.client.hotrod.impl.ClientStatistics) ChannelFactory(org.infinispan.client.hotrod.impl.transport.netty.ChannelFactory) List(java.util.List) SocketAddress(java.net.SocketAddress) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) DataFormat(org.infinispan.client.hotrod.DataFormat) Map(java.util.Map) Configuration(org.infinispan.client.hotrod.configuration.Configuration) HashMap(java.util.HashMap) Codec(org.infinispan.client.hotrod.impl.protocol.Codec) Collectors(java.util.stream.Collectors) HashMap(java.util.HashMap) SocketAddress(java.net.SocketAddress) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with ClientStatistics

use of org.infinispan.client.hotrod.impl.ClientStatistics in project infinispan by infinispan.

the class GetAllParallelOperation method mapOperations.

@Override
protected List<GetAllOperation<K, V>> mapOperations() {
    Map<SocketAddress, Set<byte[]>> splittedKeys = new HashMap<>();
    for (byte[] key : keys) {
        SocketAddress socketAddress = channelFactory.getHashAwareServer(key, cacheName);
        Set<byte[]> keys = splittedKeys.computeIfAbsent(socketAddress, k -> new HashSet<>());
        keys.add(key);
    }
    return splittedKeys.values().stream().map(keysSubset -> new GetAllOperation<K, V>(codec, channelFactory, keysSubset, cacheName, header.topologyId(), flags, cfg, dataFormat, clientStatistics)).collect(Collectors.toList());
}
Also used : ClientStatistics(org.infinispan.client.hotrod.impl.ClientStatistics) SocketAddress(java.net.SocketAddress) Configuration(org.infinispan.client.hotrod.configuration.Configuration) Set(java.util.Set) HashMap(java.util.HashMap) Codec(org.infinispan.client.hotrod.impl.protocol.Codec) Collectors(java.util.stream.Collectors) HashSet(java.util.HashSet) ChannelFactory(org.infinispan.client.hotrod.impl.transport.netty.ChannelFactory) List(java.util.List) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) DataFormat(org.infinispan.client.hotrod.DataFormat) Map(java.util.Map) Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) SocketAddress(java.net.SocketAddress)

Example 3 with ClientStatistics

use of org.infinispan.client.hotrod.impl.ClientStatistics in project infinispan by infinispan.

the class RemoteCacheManager method isTransactional.

@Override
public boolean isTransactional(String cacheName) {
    ClientStatistics stats = ClientStatistics.dummyClientStatistics(timeService);
    OperationsFactory factory = createOperationFactory(cacheName, false, codec, stats);
    return checkTransactionSupport(cacheName, factory, log);
}
Also used : OperationsFactory(org.infinispan.client.hotrod.impl.operations.OperationsFactory) ClientStatistics(org.infinispan.client.hotrod.impl.ClientStatistics)

Aggregations

ClientStatistics (org.infinispan.client.hotrod.impl.ClientStatistics)3 SocketAddress (java.net.SocketAddress)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 Collectors (java.util.stream.Collectors)2 DataFormat (org.infinispan.client.hotrod.DataFormat)2 Configuration (org.infinispan.client.hotrod.configuration.Configuration)2 Codec (org.infinispan.client.hotrod.impl.protocol.Codec)2 ChannelFactory (org.infinispan.client.hotrod.impl.transport.netty.ChannelFactory)2 HashSet (java.util.HashSet)1 Set (java.util.Set)1 TimeUnit (java.util.concurrent.TimeUnit)1 OperationsFactory (org.infinispan.client.hotrod.impl.operations.OperationsFactory)1