/** return a CacheClosedException with the given reason */ public CacheClosedException getCacheClosedException(String reason, Throwable cause) { CacheClosedException result; if (cause != null) { result = new CacheClosedException(reason, cause); } else if (this.disconnectCause != null) { result = new CacheClosedException(reason, this.disconnectCause); } else { result = new CacheClosedException(reason); } return result; }
public void run2() throws CacheException { Region region = getRootRegion(PR_REGION_NAME); ExpectedException expect = addExpectedException("CacheClosedException"); try { region.put(10, "b"); fail("Expect CacheClosedException here"); } catch (CacheClosedException cce) { System.out.println(title+cce.getMessage()); if (DiskStoreImpl.KRF_DEBUG) { assert cce.getMessage().contains("The disk store is closed."); } else { assert cce.getMessage().contains("The disk store is closed"); } } finally { expect.remove(); } } });
/** * Constructs a new <code>CacheClosedException</code> with a message string. * * @param msg a message string */ public CacheClosedException(String msg) { super(msg); // bug #43108 - CacheClosedException should include cause of closure GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); if (cache != null) { initCause(cache.getDisconnectCause()); } }
@Override public Object getDataValue() { String dataType = getDataType(); if (dataType == null || dataType.equals("N/A")) { return null; } else if (isCompressed()) { return ((Chunk)this.block).getCompressedBytes(); } else if (!isSerialized()) { // byte array //return "byte[" + ((Chunk)this.block).getDataSize() + "]"; return ((Chunk)this.block).getRawBytes(); } else { try { byte[] bytes = ((Chunk)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(); } } } @Override
/** Determines if this member has off-heap memory currently allocated. This returns true * if off-heap memory is present even if the cache is closed. * * @return True if this member has off-heap memory currently allocated, false otherwise. */ public static boolean isOffHeapMemoryConfigured() { try { MemoryAllocator offHeapStore = SimpleMemoryAllocatorImpl.getAllocator(); return (offHeapStore != null); } catch (CacheClosedException e) { // CacheClosed is thrown if the cache is closed AND no off-heap memory is present // but is not thrown if the cache is closed and off-heap memory is present String errStr = e.toString(); if (errStr.contains("Off Heap memory allocator does not exist")) { return false; } else throw e; } }
e.printStackTrace(); functionContext.getResultSender().sendException(e); } catch (Exception e) {
/** * Determines if this member has off-heap memory currently allocated. This * returns true if off-heap memory is present even if the cache is closed. * * @return True if this member has off-heap memory currently allocated, * false otherwise. */ public static boolean isOffHeapMemoryConfigured() { try { MemoryAllocator offHeapStore = SimpleMemoryAllocatorImpl.getAllocator(); return (offHeapStore != null); } catch (CacheClosedException e) { // CacheClosed is thrown if the cache is closed AND no off-heap memory // is present but is not thrown if the cache is closed and // off-heap memory is present String errStr = e.toString(); if (errStr.contains("Off Heap memory allocator does not exist")) { return false; } else throw e; } }
functionContext.getResultSender().lastResult(result); } catch (CacheClosedException e) { e.printStackTrace(); functionContext.getResultSender().sendException(e); } catch (Exception e) {
/** return a CacheClosedException with the given reason */ public CacheClosedException getCacheClosedException(String reason, Throwable cause) { CacheClosedException result; if (cause != null) { result = new CacheClosedException(reason, cause); } else if (this.disconnectCause != null) { result = new CacheClosedException(reason, this.disconnectCause); } else { result = new CacheClosedException(reason); } return result; }
public void run2() throws CacheException { Region region = getRootRegion(PR_REGION_NAME); ExpectedException expect = addExpectedException("CacheClosedException"); try { region.put(1, "b"); fail("Expect CacheClosedException here"); } catch (CacheClosedException cce) { System.out.println(title+cce.getMessage()); if (DiskStoreImpl.KRF_DEBUG) { assert cce.getMessage().contains("The disk store is closed."); } else { assert cce.getMessage().contains("The disk store is closed"); } } finally { expect.remove(); } } });
/** * Constructs a new <code>CacheClosedException</code> with a message string. * * @param msg a message string */ public CacheClosedException(String msg) { super(msg); // bug #43108 - CacheClosedException should include cause of closure GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); if (cache != null) { initCause(cache.getDisconnectCause()); } }
/** * Pdx is allowed to obtain the cache even while it is being closed */ public static GemFireCacheImpl getForPdx(String reason) { final GemFireCacheImpl result = pdxInstance; if (result != null) { return result; } throw new CacheClosedException(reason); }
public void run2() throws CacheException { Region region = getRootRegion(PR_REGION_NAME); ExpectedException expect = addExpectedException("CacheClosedException"); try { region.destroy(2, "b"); fail("Expect CacheClosedException here"); } catch (CacheClosedException cce) { System.out.println(title+cce.getMessage()); if (DiskStoreImpl.KRF_DEBUG) { assert cce.getMessage().contains("The disk store is closed."); } else { assert cce.getMessage().contains("The disk store is closed"); } } finally { expect.remove(); } } });
public static SimpleMemoryAllocatorImpl getAllocator() { SimpleMemoryAllocatorImpl result = singleton; if (result == null) { throw new CacheClosedException("Off Heap memory allocator does not exist."); } return result; }
return crex.getResult(); }catch (CacheClosedException e) { return ResultBuilder.createGemFireErrorResult(e.getMessage()); } catch (FunctionInvocationTargetException e) { return ResultBuilder.createGemFireErrorResult(CliStrings.format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, CliStrings.ALTER_RUNTIME_CONFIG));
public static SimpleMemoryAllocatorImpl getAllocator() { final SimpleMemoryAllocatorImpl result = singleton; if (result != null) { return result; } else { throw new CacheClosedException( "Off Heap memory allocator does not exist."); } }
return crex.getResult(); }catch (CacheClosedException e) { return ResultBuilder.createGemFireErrorResult(e.getMessage()); } catch (FunctionInvocationTargetException e) { return ResultBuilder.createGemFireErrorResult(CliStrings.format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, CliStrings.ALTER_RUNTIME_CONFIG));
/** * Pdx is allowed to obtain the cache even while it is being closed */ public static GemFireCacheImpl getForPdx(String reason) { GemFireCacheImpl result = pdxInstance; if (result == null) { throw new CacheClosedException(reason); } return result; }
logger.debug(ccex.getMessage(), ccex);
@Override protected Cache getCache() { throw new CacheClosedException("Expected"); } };