[JBoss JIRA] (ISPN-11249) Unexpected functionality added by Java8 default interface methods
by Will Burns (Jira)
[ https://issues.redhat.com/browse/ISPN-11249?page=com.atlassian.jira.plugi... ]
Will Burns updated ISPN-11249:
------------------------------
Status: Open (was: New)
> Unexpected functionality added by Java8 default interface methods
> -----------------------------------------------------------------
>
> Key: ISPN-11249
> URL: https://issues.redhat.com/browse/ISPN-11249
> Project: Infinispan
> Issue Type: Bug
> Reporter: Wolf-Dieter Fink
> Priority: Critical
> Fix For: 10.1.3.Final, 11.0.0.Alpha2
>
>
> With Java8 there are interfaces which implement default methods.
> Those defaults are available if not overridden, but the function behind might not be correct because the method was not meant to be implemented.
> There are issues with the transaction and locking because of the remote invocation, so the conditional operation will not work consistent.
> Such methods need to be checked and throw a UnsupportedOperation.
> This appears for the compute(...) methods
> compute(key, BiFunct) -> default to java.util.concurrent.ConcurrentMap interface
> compute() methods with expiration will throw an UnsupportedOperationException as expected.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month
[JBoss JIRA] (ISPN-11249) Unexpected functionality added by Java8 default interface methods
by Will Burns (Jira)
[ https://issues.redhat.com/browse/ISPN-11249?page=com.atlassian.jira.plugi... ]
Will Burns edited comment on ISPN-11249 at 2/19/20 9:36 AM:
------------------------------------------------------------
For now I will just add in UnsupportedOperationException, however compute is more than doable with an override of the following:
{code}
@Override
public V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) {
V newValue;
while (true) {
MetadataValue<V> metadataValue = getWithMetadata(key);
V oldValue;
long version;
if (metadataValue != null) {
oldValue = metadataValue.getValue();
version = metadataValue.getVersion();
} else {
oldValue = null;
version = -1;
}
newValue = remappingFunction.apply(key, oldValue);
boolean done;
if (newValue != null) {
if (oldValue != null) {
done = replaceWithVersion(key, newValue, version, lifespan, lifespanUnit, maxIdleTime, maxIdleTimeUnit);
} else {
done = putIfAbsent(key, newValue, lifespan, lifespanUnit, maxIdleTime, maxIdleTimeUnit) != null;
}
} else {
done = removeWithVersion(key, version);
}
if (done) {
break;
}
}
return newValue;
}
{code}
was (Author: william.burns):
For now I will just add in UnsupportedOperationException, however compute is more than doable with an override of the following:
```
@Override
public V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) {
V newValue;
while (true) {
MetadataValue<V> metadataValue = getWithMetadata(key);
V oldValue;
long version;
if (metadataValue != null) {
oldValue = metadataValue.getValue();
version = metadataValue.getVersion();
} else {
oldValue = null;
version = -1;
}
newValue = remappingFunction.apply(key, oldValue);
boolean done;
if (newValue != null) {
if (oldValue != null) {
done = replaceWithVersion(key, newValue, version, lifespan, lifespanUnit, maxIdleTime, maxIdleTimeUnit);
} else {
done = putIfAbsent(key, newValue, lifespan, lifespanUnit, maxIdleTime, maxIdleTimeUnit) != null;
}
} else {
done = removeWithVersion(key, version);
}
if (done) {
break;
}
}
return newValue;
}
```
> Unexpected functionality added by Java8 default interface methods
> -----------------------------------------------------------------
>
> Key: ISPN-11249
> URL: https://issues.redhat.com/browse/ISPN-11249
> Project: Infinispan
> Issue Type: Bug
> Reporter: Wolf-Dieter Fink
> Priority: Critical
>
> With Java8 there are interfaces which implement default methods.
> Those defaults are available if not overridden, but the function behind might not be correct because the method was not meant to be implemented.
> There are issues with the transaction and locking because of the remote invocation, so the conditional operation will not work consistent.
> Such methods need to be checked and throw a UnsupportedOperation.
> This appears for the compute(...) methods
> compute(key, BiFunct) -> default to java.util.concurrent.ConcurrentMap interface
> compute() methods with expiration will throw an UnsupportedOperationException as expected.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month
[JBoss JIRA] (ISPN-11249) Unexpected functionality added by Java8 default interface methods
by Will Burns (Jira)
[ https://issues.redhat.com/browse/ISPN-11249?page=com.atlassian.jira.plugi... ]
Will Burns commented on ISPN-11249:
-----------------------------------
For now I will just add in UnsupportedOperationException, however compute is more than doable with an override of the following:
```
@Override
public V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) {
V newValue;
while (true) {
MetadataValue<V> metadataValue = getWithMetadata(key);
V oldValue;
long version;
if (metadataValue != null) {
oldValue = metadataValue.getValue();
version = metadataValue.getVersion();
} else {
oldValue = null;
version = -1;
}
newValue = remappingFunction.apply(key, oldValue);
boolean done;
if (newValue != null) {
if (oldValue != null) {
done = replaceWithVersion(key, newValue, version, lifespan, lifespanUnit, maxIdleTime, maxIdleTimeUnit);
} else {
done = putIfAbsent(key, newValue, lifespan, lifespanUnit, maxIdleTime, maxIdleTimeUnit) != null;
}
} else {
done = removeWithVersion(key, version);
}
if (done) {
break;
}
}
return newValue;
}
```
> Unexpected functionality added by Java8 default interface methods
> -----------------------------------------------------------------
>
> Key: ISPN-11249
> URL: https://issues.redhat.com/browse/ISPN-11249
> Project: Infinispan
> Issue Type: Bug
> Reporter: Wolf-Dieter Fink
> Priority: Critical
>
> With Java8 there are interfaces which implement default methods.
> Those defaults are available if not overridden, but the function behind might not be correct because the method was not meant to be implemented.
> There are issues with the transaction and locking because of the remote invocation, so the conditional operation will not work consistent.
> Such methods need to be checked and throw a UnsupportedOperation.
> This appears for the compute(...) methods
> compute(key, BiFunct) -> default to java.util.concurrent.ConcurrentMap interface
> compute() methods with expiration will throw an UnsupportedOperationException as expected.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month
[JBoss JIRA] (ISPN-11292) Add in (non)blocking thread pools
by Dan Berindei (Jira)
[ https://issues.redhat.com/browse/ISPN-11292?page=com.atlassian.jira.plugi... ]
Dan Berindei updated ISPN-11292:
--------------------------------
Status: Resolved (was: Pull Request Sent)
Resolution: Done
> Add in (non)blocking thread pools
> ---------------------------------
>
> Key: ISPN-11292
> URL: https://issues.redhat.com/browse/ISPN-11292
> Project: Infinispan
> Issue Type: Sub-task
> Components: Core
> Reporter: Will Burns
> Assignee: Will Burns
> Priority: Major
> Fix For: 11.0.0.Alpha2
>
>
> We should remove the ASYNC_OPERATIONS_EXECUTOR and PERSISTENCE_EXECUTOR components and replace them with a NON_BLOCKING_EXECUTOR and BLOCKING_EXECUTOR or something similarly named.
> We should probably default the NON_BLOCKING_EXECUTOR to 2 * numCPU and blocking to 100? The queue size should be a bit bigger for blocking as compared to non blocking. The parser should allow these to be changed as other executors are currently.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month
[JBoss JIRA] (ISPN-11370) Extract the server test driver to a separate module
by Tristan Tarrant (Jira)
Tristan Tarrant created ISPN-11370:
--------------------------------------
Summary: Extract the server test driver to a separate module
Key: ISPN-11370
URL: https://issues.redhat.com/browse/ISPN-11370
Project: Infinispan
Issue Type: Enhancement
Components: Server, Test Suite
Affects Versions: 11.0.0.Alpha1
Reporter: Tristan Tarrant
Assignee: Tristan Tarrant
Fix For: 11.0.0.Alpha2
Introduce an infinispan-server-testdriver which contains the server testsuite logic so that it can be used outside of Infinispan.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month
[JBoss JIRA] (ISPN-5938) ClusterListenerReplInitialStateTest.testPrimaryOwnerGoesDownAfterBackupRaisesEvent fails randomly
by Dan Berindei (Jira)
[ https://issues.redhat.com/browse/ISPN-5938?page=com.atlassian.jira.plugin... ]
Dan Berindei updated ISPN-5938:
-------------------------------
Status: Open (was: New)
> ClusterListenerReplInitialStateTest.testPrimaryOwnerGoesDownAfterBackupRaisesEvent fails randomly
> -------------------------------------------------------------------------------------------------
>
> Key: ISPN-5938
> URL: https://issues.redhat.com/browse/ISPN-5938
> Project: Infinispan
> Issue Type: Bug
> Components: Test Suite
> Affects Versions: 11.0.0.Alpha1
> Reporter: Roman Macor
> Assignee: Dan Berindei
> Priority: Major
> Fix For: 11.0.0.Alpha2
>
>
> ClusterListenerReplInitialStateTest.testPrimaryOwnerGoesDownAfterBackupRaisesEvent fails randomly with:
> Stacktrace
> java.util.concurrent.TimeoutException
> at java.util.concurrent.FutureTask.get(FutureTask.java:205)
> at org.infinispan.notifications.cachelistener.cluster.ClusterListenerReplTest.testPrimaryOwnerGoesDownAfterBackupRaisesEvent(ClusterListenerReplTest.java:123)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:497)
> at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
> at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
> at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
> at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
> at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
> at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
> at org.testng.TestRunner.privateRun(TestRunner.java:767)
> at org.testng.TestRunner.run(TestRunner.java:617)
> at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
> at org.testng.SuiteRunner.access$000(SuiteRunner.java:37)
> at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:368)
> at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month