public static MemoryAllocatorImpl getAllocator() { MemoryAllocatorImpl result = singleton; if (result == null) { throw new CacheClosedException("Off Heap memory allocator does not exist."); } return result; }
@Test public void getCacheClosedExceptionWhenCauseGivenButDisconnectExceptionExistsPrefersCause() { cache = GemFireCacheImpl.create(distributedSystem, cacheConfig); cache.disconnectCause = new Throwable("disconnectCause"); Throwable cause = new Throwable(); CacheClosedException e = cache.getCacheClosedException("message", cause); assertThat(e.getCause()).isEqualTo(cause); assertThat(e.getMessage()).isEqualTo("message"); }
logger.debug(ccex.getMessage(), ccex);
@Override public Object getDataValue() { String dataType = getDataType(); if (dataType == null || dataType.equals("N/A")) { return null; } else if (isCompressed()) { return ((OffHeapStoredObject) this.block).getCompressedBytes(); } else if (!isSerialized()) { // byte array // return "byte[" + ((Chunk)this.block).getDataSize() + "]"; return ((OffHeapStoredObject) this.block).getRawBytes(); } else { try { byte[] bytes = ((OffHeapStoredObject) this.block).getRawBytes(); return DataSerializer.readObject(DataType.getDataInput(bytes)); } catch (IOException e) { e.printStackTrace(); return "IOException:" + e.getMessage(); } catch (ClassNotFoundException e) { e.printStackTrace(); return "ClassNotFoundException:" + e.getMessage(); } catch (CacheClosedException e) { e.printStackTrace(); return "CacheClosedException:" + e.getMessage(); } } }
@Test public void getCacheClosedExceptionWhenNoCauseGivenProvidesDisconnectExceptionIfExists() { cache = GemFireCacheImpl.create(distributedSystem, cacheConfig); Throwable disconnectCause = new Throwable("disconnectCause"); cache.disconnectCause = disconnectCause; CacheClosedException e = cache.getCacheClosedException("message", null); assertThat(e.getCause()).isEqualTo(disconnectCause); assertThat(e.getMessage()).isEqualTo("message"); }
result = ResultModel.createMemberStatusResult((List<CliFunctionResult>) rc.getResult()); } catch (CacheClosedException e) { result = ResultModel.createError(e.getMessage()); } catch (FunctionInvocationTargetException e) { result = ResultModel.createError(
@Override public Cache getCache() throws CacheClosedException { if (cache == null) { throw new CacheClosedException("FunctionContext does not have a valid Cache"); } return cache; }
@Test public void getCacheClosedExceptionReturnsExceptionWithDisconnectCause() { cache = GemFireCacheImpl.create(distributedSystem, cacheConfig); Throwable disconnectCause = new Throwable("disconnectCause"); cache.disconnectCause = disconnectCause; CacheClosedException e = cache.getCacheClosedException("message"); assertThat(e.getMessage()).isEqualTo("message"); assertThat(e.getCause()).isEqualTo(disconnectCause); }
FunctionInvocationTargetException fite = new InternalFunctionInvocationTargetException( ((CacheClosedException) result).getMessage()); if (resultResponse instanceof ArrayList) { DistributedMember memberID = (DistributedMember) ((List) resultResponse).get(1);
@Override public boolean addAll(int index, Collection c) { throw new CacheClosedException("This pool has been closed"); } }
@Test public void getCacheClosedExceptionReturnsExceptionWithProvidedCauseAndReason() { cache = GemFireCacheImpl.create(distributedSystem, cacheConfig); Throwable cause = new Throwable(); CacheClosedException e = cache.getCacheClosedException("message", cause); assertThat(e.getCause()).isEqualTo(cause); assertThat(e.getMessage()).isEqualTo("message"); }
partitionedRegion.getFullPath(), cce.getMessage()); } catch (CancelException ce) { logger.debug("Encounter CancelException when shutDownAll is closing PR: {}:{}",
@Override public boolean add(Object element) { throw new CacheClosedException("This pool has been closed"); }
@Test public void getCacheClosedExceptionWithNoCauseGivesExceptionWithReason() { cache = GemFireCacheImpl.create(distributedSystem, cacheConfig); CacheClosedException e = cache.getCacheClosedException("message", null); assertThat(e.getCause()).isNull(); assertThat(e.getMessage()).isEqualTo("message"); }
result = ResultModel.createMemberStatusResult((List<CliFunctionResult>) rc.getResult()); } catch (CacheClosedException e) { result = ResultModel.createError(e.getMessage()); } catch (FunctionInvocationTargetException e) { result = ResultModel.createError(
@Override public void add(int index, Object element) { throw new CacheClosedException("This pool has been closed"); }
@Test public void getCacheClosedExceptionReturnsExceptionWithProvidedReason() { cache = GemFireCacheImpl.create(distributedSystem, cacheConfig); CacheClosedException e = cache.getCacheClosedException("message"); assertThat(e.getMessage()).isEqualTo("message"); assertThat(e.getCause()).isNull(); }
if (isHA) { fite = new InternalFunctionInvocationTargetException( ((CacheClosedException) result).getMessage()); } else { fite = new FunctionInvocationTargetException( ((CacheClosedException) result).getMessage());
@Override public Object remove(int index) { throw new CacheClosedException("This pool has been closed"); }
@Test public void getCacheClosedExceptionReturnsExceptionWithNoMessageWhenReasonNotGiven() { cache = GemFireCacheImpl.create(distributedSystem, cacheConfig); CacheClosedException e = cache.getCacheClosedException(null); assertThat(e.getMessage()).isEqualTo(null); assertThat(e.getCause()).isNull(); }