Skip to content

Commit c716fba

Browse files
committed
Bug 36409014 - Build: Intermittent failure in queues.GrpcClientDequeTests.shouldGetNewInstanceOfDestroyedQueue
(merge main -> ce/main 107684) [git-p4: depot-paths = "//dev/coherence-ce/main/": change = 107725]
1 parent d33a2ab commit c716fba

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

prj/coherence-grpc-proxy-common/src/main/java/com/oracle/coherence/grpc/proxy/common/BaseNamedCacheServiceImpl.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,28 @@ public void destroy(DestroyRequest request, StreamObserver<Empty> observer)
224224
StreamObserver<Empty> safeObserver = SafeStreamObserver.ensureSafeObserver(observer);
225225
try
226226
{
227-
NamedCache<Binary, Binary> cache = getPassThroughCache(request.getScope(), request.getCache());
228-
cache.destroy();
227+
String sCacheName = request.getCache();
228+
if (sCacheName == null || sCacheName.trim().isEmpty())
229+
{
230+
throw Status.INVALID_ARGUMENT
231+
.withDescription(INVALID_CACHE_NAME_MESSAGE)
232+
.asRuntimeException();
233+
}
234+
235+
ConfigurableCacheFactory ccf = getCCF(request.getScope());
236+
NamedCache<Binary, Binary> cachePassThru = ccf.ensureCache(sCacheName, NullImplementation.getClassLoader());
237+
NamedCache<Binary, Binary> cache = ccf.ensureCache(sCacheName, Classes.getContextClassLoader());
238+
// we get caches via the CCF, so we must destroy them that way too
239+
ccf.destroyCache(cachePassThru);
240+
try
241+
{
242+
ccf.destroyCache(cache);
243+
}
244+
catch (Exception ignored)
245+
{
246+
// We may get an exception if destroying the first pass-thru cache also destroys the plain cache.
247+
// We can just ignore it.
248+
}
229249
handleUnary(Empty.getDefaultInstance(), null, safeObserver);
230250
}
231251
catch (Throwable t)

prj/test/functional/grpc-proxy-netty/src/main/java/netty/grpc/proxy/NamedCacheServiceImplTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,8 +758,7 @@ public void shouldNotExecuteDestroyWithoutCacheName() throws Exception
758758
@Test
759759
public void shouldHandleDestroyError() throws Exception
760760
{
761-
NamedCache cache = m_testAsyncCache.getNamedCache();
762-
doThrow(ERROR).when(cache).destroy();
761+
doThrow(ERROR).when(m_testCCF).destroyCache(any(NamedCache.class));
763762

764763
TestStreamObserver<Empty> observer = new TestStreamObserver<>();
765764
NamedCacheService service = s_serviceProvider.getService(m_dependencies);

0 commit comments

Comments
 (0)