forked from wildfly/wildfly
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request wildfly#17067 from pferraro/WFLY-18233
WFLY-18233 Optimize payload of ATTRIBUTE granularity mapping in distributed session manager using Infinispan's Cache.compute(...)
- Loading branch information
Showing
65 changed files
with
575 additions
and
996 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...trod/src/main/java/org/wildfly/clustering/ee/hotrod/RemoteCacheComputeMutatorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.wildfly.clustering.ee.hotrod; | ||
|
||
import java.util.function.BiFunction; | ||
import java.util.function.Function; | ||
|
||
import org.infinispan.client.hotrod.RemoteCache; | ||
import org.wildfly.clustering.ee.Mutator; | ||
import org.wildfly.clustering.ee.MutatorFactory; | ||
|
||
/** | ||
* Factory that creates compute-based Mutator instances. | ||
* @author Paul Ferraro | ||
* @param <K> the cache key type | ||
* @param <V> the cache value type | ||
* @param <O> the function operand type | ||
*/ | ||
public class RemoteCacheComputeMutatorFactory<K, V, O> implements MutatorFactory<K, O> { | ||
|
||
private final RemoteCache<K, V> cache; | ||
private final Function<O, BiFunction<Object, V, V>> functionFactory; | ||
|
||
public RemoteCacheComputeMutatorFactory(RemoteCache<K, V> cache, Function<O, BiFunction<Object, V, V>> functionFactory) { | ||
this.cache = cache; | ||
this.functionFactory = functionFactory; | ||
} | ||
|
||
@Override | ||
public Mutator createMutator(K key, O operand) { | ||
return new RemoteCacheEntryComputeMutator<>(this.cache, key, this.functionFactory.apply(operand)); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...hotrod/src/main/java/org/wildfly/clustering/ee/hotrod/RemoteCacheEntryComputeMutator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.wildfly.clustering.ee.hotrod; | ||
|
||
import java.util.function.BiFunction; | ||
|
||
import org.infinispan.client.hotrod.RemoteCache; | ||
import org.wildfly.clustering.ee.Mutator; | ||
|
||
/** | ||
* Mutator for a cache entry using a compute function. | ||
* @author Paul Ferraro | ||
* @param <K> the cache key type | ||
* @param <V> the cache value type | ||
*/ | ||
public class RemoteCacheEntryComputeMutator<K, V> implements Mutator { | ||
|
||
private final RemoteCache<K, V> cache; | ||
private final K key; | ||
private final BiFunction<Object, V, V> function; | ||
|
||
public RemoteCacheEntryComputeMutator(RemoteCache<K, V> cache, K key, BiFunction<Object, V, V> function) { | ||
this.cache = cache; | ||
this.key = key; | ||
this.function = function; | ||
} | ||
|
||
@Override | ||
public void mutate() { | ||
this.cache.compute(this.key, this.function); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...nispan/src/main/java/org/wildfly/clustering/ee/infinispan/CacheComputeMutatorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.wildfly.clustering.ee.infinispan; | ||
|
||
import java.util.function.BiFunction; | ||
import java.util.function.Function; | ||
|
||
import org.infinispan.Cache; | ||
import org.wildfly.clustering.ee.Mutator; | ||
import org.wildfly.clustering.ee.MutatorFactory; | ||
|
||
/** | ||
* Factory that creates compute-based Mutator instances. | ||
* @author Paul Ferraro | ||
* @param <K> the cache key type | ||
* @param <V> the cache value type | ||
* @param <O> the function operand type | ||
*/ | ||
public class CacheComputeMutatorFactory<K, V, O> implements MutatorFactory<K, O> { | ||
|
||
private final Cache<K, V> cache; | ||
private final Function<O, BiFunction<Object, V, V>> functionFactory; | ||
|
||
public CacheComputeMutatorFactory(Cache<K, V> cache, Function<O, BiFunction<Object, V, V>> functionFactory) { | ||
this.cache = cache; | ||
this.functionFactory = functionFactory; | ||
} | ||
|
||
@Override | ||
public Mutator createMutator(K key, O operand) { | ||
return new CacheEntryComputeMutator<>(this.cache, key, this.functionFactory.apply(operand)); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...finispan/src/main/java/org/wildfly/clustering/ee/infinispan/CacheEntryComputeMutator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.wildfly.clustering.ee.infinispan; | ||
|
||
import java.util.function.BiFunction; | ||
|
||
import org.infinispan.Cache; | ||
import org.infinispan.context.Flag; | ||
import org.wildfly.clustering.ee.Mutator; | ||
|
||
/** | ||
* Mutator for a cache entry using a compute function. | ||
* @author Paul Ferraro | ||
* @param <K> the cache key type | ||
* @param <V> the cache value type | ||
*/ | ||
public class CacheEntryComputeMutator<K, V> implements Mutator { | ||
|
||
private final Cache<K, V> cache; | ||
private final K key; | ||
private final BiFunction<Object, V, V> function; | ||
|
||
public CacheEntryComputeMutator(Cache<K, V> cache, K key, BiFunction<Object, V, V> function) { | ||
this.cache = cache; | ||
this.key = key; | ||
this.function = function; | ||
} | ||
|
||
@Override | ||
public void mutate() { | ||
// Use FAIL_SILENTLY to prevent mutation from failing locally due to remote exceptions | ||
this.cache.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES, Flag.FAIL_SILENTLY).compute(this.key, this.function); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
...ver/infinispan/src/main/resources/org.wildfly.clustering.server.infinispan.provider.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.