[infinispan-issues] [JBoss JIRA] (ISPN-2187) Pre-Invocation flag PUT_FOR_EXTERNAL_READ throws exception
RH Bugzilla Integration (JIRA)
jira-events at lists.jboss.org
Tue Dec 18 04:57:08 EST 2012
[ https://issues.jboss.org/browse/ISPN-2187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12742030#comment-12742030 ]
RH Bugzilla Integration commented on ISPN-2187:
-----------------------------------------------
Tristan Tarrant <ttarrant at redhat.com> changed the Status of [bug 847062|https://bugzilla.redhat.com/show_bug.cgi?id=847062] from ASSIGNED to ON_QA
> 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: http://www.atlassian.com/software/jira
More information about the infinispan-issues
mailing list