]
RH Bugzilla Integration commented on ISPN-2187:
-----------------------------------------------
Martin Gencur <mgencur(a)redhat.com> made a comment on [bug
]
Shouldn't we close this as WONTFIX? AFAIK, this was just badly documented flag. It
should not be used by normal users, this is an internal flag. This was fixed in Infinspan
by modifying the javadoc for this flag. Or are we planning to close this once the proper
javadoc is backported to JDG?
Pre-Invocation flag PUT_FOR_EXTERNAL_READ throws exception
----------------------------------------------------------
Key: ISPN-2187
URL:
https://issues.jboss.org/browse/ISPN-2187
Project: Infinispan
Issue Type: Bug
Components: Core API
Reporter: Anna Manukyan
Assignee: Galder ZamarreƱo
Labels: jdg6
Fix For: 5.2.0.Alpha3, 5.2.0.Final
Hi,
While writing tests for Infinispan Flag.PUT_FOR_EXTERNAL_READ the following issue has
been found.
In documentation it is said:
PUT_FOR_EXTERNAL_READ
Flags the invocation as a Cache.putForExternalRead(Object, Object) call, as
opposed to a regular Map.put(Object, Object).
And the documentation for Cache.putForExternalRead(Object, Object) says:
void putForExternalRead(K key,
V value)
...................
Errors and exceptions are 'silent' - logged at a much lower level than normal,
and this method does not throw exceptions
The issue is the following:
when trying to perform operation using PUT_FOR_EXTERNAL_READ flag, the exception is
thrown, it is not 'silent'.
cache1.getAdvancedCache().withFlags(Flag.PUT_FOR_EXTERNAL_READ).put(key, value);
The test is the following:
{code}
public void testExceptionSuppression() throws Exception {
Cache cache1 = cache(0, "replSync");
Cache cache2 = cache(1, "replSync");
Transport mockTransport = mock(Transport.class);
RpcManagerImpl rpcManager = (RpcManagerImpl) TestingUtil.extractComponent(cache1,
RpcManager.class);
Transport originalTransport = TestingUtil.extractComponent(cache1,
Transport.class);
try {
Address mockAddress1 = mock(Address.class);
Address mockAddress2 = mock(Address.class);
List<Address> memberList = new ArrayList<Address>(2);
memberList.add(mockAddress1);
memberList.add(mockAddress2);
rpcManager.setTransport(mockTransport);
when(mockTransport.getMembers()).thenReturn(memberList);
when(mockTransport.getViewId()).thenReturn(originalTransport.getViewId());
when(mockTransport.invokeRemotely(anyAddresses(), (CacheRpcCommand) anyObject(),
anyResponseMode(),
anyLong(), anyBoolean(), (ResponseFilter)
anyObject()))
.thenThrow(new RuntimeException("Barf!"));
try {
cache1.put(key, value);
fail("Should have barfed");
}
catch (RuntimeException re) {
}
// clean up any indeterminate state left over
try {
cache1.remove(key);
fail("Should have barfed");
}
catch (RuntimeException re) {
}
assertNull("Should have cleaned up", cache1.get(key));
// should not barf
cache1.putForExternalRead(key, value);
/** ------------------- Testing the same feature with Flag.PUT_FOR_EXTERNAL_READ
**/
try {
cache1.remove(key);
fail("Should have barfed");
}
catch (RuntimeException re) {
}
cache1.getAdvancedCache().withFlags(Flag.PUT_FOR_EXTERNAL_READ).put(key,
value);
}
finally {
if (rpcManager != null) rpcManager.setTransport(originalTransport);
}
}
{code}
Best regards,
Anna.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: