/** * Constructs a new <code>DiskAccessException</code> with a message string * and a cause. * * @param msg the message string * @param cause a causal Throwable * @param ds The disk store for which the disk operation failed * @since 6.5 */ public DiskAccessException(String msg, Throwable cause, DiskStore ds) { super((ds!=null ? "For DiskStore: " + ds.getName() + ": " : "") + msg, cause); }
/** * Constructs a new <code>DiskAccessException</code> with a message string * and a cause. * * @param msg the message string * @param cause a causal Throwable * @param ds The disk store for which the disk operation failed * @since 6.5 */ public DiskAccessException(String msg, Throwable cause, DiskStore ds) { super((ds != null ? "For DiskStore '" + ds.getName() + "': " : "") + msg, cause); }
/** * Returns the disk store as a string. For use only by {@link DiskStoreHelper * #diskStoreToString(DiskStore)}. */ protected static synchronized String diskStoreToString(DiskStore d) { return diskStoreToString(d.getName(), d); }
protected static void setDiskStoreForGateway(Cache cache, String gatewayId, GatewayQueueAttributes queueAttributes) { // user is responsible to specify different diskstore or overflow dir // for gateways running on the same host or file system File overflowDirectory = new File(gatewayId+"_disk_"+System.currentTimeMillis()); overflowDirectory.mkdir(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); File[] dirs1 = new File[] {overflowDirectory}; queueAttributes.setDiskStoreName(dsf.setDiskDirs(dirs1).create(gatewayId).getName()); }
protected boolean isUsingDiskStore(final Gateway gateway, final DiskStore diskStore) { return ObjectUtils.equals(getDiskStoreName(gateway), diskStore.getName()); }
public void creatingDiskStore(DiskStore dsi) { if(cache.getPdxDiskStore() != null && dsi.getName().equals(cache.getPdxDiskStore())) { distributedTypeRegistry.initialize(); } }
public void creatingDiskStore(DiskStore dsi) { if(cache.getPdxDiskStore() != null && dsi.getName().equals(cache.getPdxDiskStore())) { distributedTypeRegistry.initialize(); } }
protected boolean isUsingDiskStore(final AsyncEventQueue queue, final DiskStore diskStore) { return (queue.isPersistent() && ObjectUtils.equals(getDiskStoreName(queue), diskStore.getName())); }
protected boolean isUsingDiskStore(final AsyncEventQueue queue, final DiskStore diskStore) { return (queue.isPersistent() && ObjectUtils.equals(getDiskStoreName(queue), diskStore.getName())); }
protected boolean isUsingDiskStore(final Region region, final DiskStore diskStore) { return ((isPersistent(region) || isOverflowToDisk(region)) && ObjectUtils.equals(getDiskStoreName(region), diskStore.getName())); }
protected void setPdxSerializationDetails(final InternalCache cache, final DiskStore diskStore, final DiskStoreDetails diskStoreDetails) { if (cache.getPdxPersistent()) { final String diskStoreName = StringUtils.defaultIfBlank(cache.getPdxDiskStore(), DiskStoreDetails.DEFAULT_DISK_STORE_NAME); diskStoreDetails.setPdxSerializationMetaDataStored(ObjectUtils.equals(diskStoreName, diskStore.getName())); } }
protected void setPdxSerializationDetails(final InternalCache cache, final DiskStore diskStore, final DiskStoreDetails diskStoreDetails) { if (cache.getPdxPersistent()) { String diskStoreName = StringUtils.defaultIfBlank(cache.getPdxDiskStore(), DiskStoreDetails.DEFAULT_DISK_STORE_NAME); diskStoreDetails.setPdxSerializationMetaDataStored(ObjectUtils.equals(diskStoreName, diskStore.getName())); } }
protected RegionAttributes getDiskRegionAttributes() { AttributesFactory factory = new AttributesFactory(getRegionAttributes()); File[] diskDirs = new File[1]; diskDirs[0] = new File("diskRegionDirs/" + ProcessMgr.getProcessId()); diskDirs[0].mkdirs(); factory.setDiskStoreName(getCache().createDiskStoreFactory() .setDiskDirs(diskDirs) .setTimeInterval(1000) .setQueueSize(0) .create("TXRestrictionsTest") .getName()); factory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); return factory.create(); }
public void run2() throws CacheException { AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_NO_ACK); factory.setEvictionAttributes(EvictionAttributes .createLRUMemoryAttributes(2, null, EvictionAction.OVERFLOW_TO_DISK)); File d = new File("DiskRegions" + ProcessMgr.getProcessId()); d.mkdirs(); DiskStoreFactory dsf = getCache().createDiskStoreFactory(); dsf.setDiskDirs(new File[]{d}); DiskStore ds = dsf.create(name); factory.setDiskStoreName(ds.getName()); createRegion(name, factory.create()); } };
private void setUpGem(File diskdir) { CacheFactory cf = new CacheFactory() .set("mcast-port", "0"); cache = cf.create(); ds = cache.createDiskStoreFactory() .setDiskDirs(new File[] { diskdir }) .setMaxOplogSize(SIZE / 16 / 1024 / 1024) .create("store1"); region = cache .<Long, Object>createRegionFactory(RegionShortcut.LOCAL_PERSISTENT) .setDiskStoreName(ds.getName()) .setEvictionAttributes(EvictionAttributes.createLRUEntryAttributes(1, EvictionAction.OVERFLOW_TO_DISK)) .create("test"); }
public void testInvalidate() throws Exception { Region<Integer, MyObject> region = rgen.createRegion(cache, ds.getName(), RegionType.REPLICATE, "test"); MyObject obj = rgen.createData(SerializationType.SERIALIZABLE, 1, "invalidated value"); region.put(1, obj); region.invalidate(1); region.getSnapshotService().save(f, SnapshotFormat.GEMFIRE); region.getSnapshotService().load(f, SnapshotFormat.GEMFIRE); assertTrue(region.containsKey(1)); assertFalse(region.containsValueForKey(1)); assertNull(region.get(1)); }
@Test public void testIsGatewaySenderUsingDiskStoreWhenDiskStoresMismatch() { final GatewaySender mockGatewaySender = mockContext.mock(GatewaySender.class, "GatewaySender"); final DiskStore mockDiskStore = mockContext.mock(DiskStore.class, "DiskStore"); mockContext.checking(new Expectations() {{ oneOf(mockGatewaySender).getDiskStoreName(); will(returnValue("mockDiskStore")); oneOf(mockDiskStore).getName(); will(returnValue("testDiskStore")); }}); final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null); assertFalse(function.isUsingDiskStore(mockGatewaySender, mockDiskStore)); }
@Test public void testIsGatewaySenderUsingDiskStoreWhenUsingDefaultDiskStores() { final GatewaySender mockGatewaySender = mockContext.mock(GatewaySender.class, "GatewaySender"); final DiskStore mockDiskStore = mockContext.mock(DiskStore.class, "DiskStore"); mockContext.checking(new Expectations() {{ oneOf(mockGatewaySender).getDiskStoreName(); will(returnValue(" ")); oneOf(mockDiskStore).getName(); will(returnValue(DiskStoreDetails.DEFAULT_DISK_STORE_NAME)); }}); final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null); assertTrue(function.isUsingDiskStore(mockGatewaySender, mockDiskStore)); }
@Test public void testIsGatewayUsingDiskStoreWithNullGatewayQueueAttributes() { final Gateway mockGateway = mockContext.mock(Gateway.class, "Gateway"); final DiskStore mockDiskStore = mockContext.mock(DiskStore.class, "DiskStore"); mockContext.checking(new Expectations() {{ oneOf(mockGateway).getQueueAttributes(); will(returnValue(null)); oneOf(mockDiskStore).getName(); will(returnValue(DiskStoreDetails.DEFAULT_DISK_STORE_NAME)); }}); final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null); assertFalse(function.isUsingDiskStore(mockGateway, mockDiskStore)); }
public void run() { Cache cache = getCache(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); dsf.setDiskDirs(getDiskDirs(getUniqueName())); dsf.setMaxOplogSize(1); DiskStore ds = dsf.create(getUniqueName()); RegionFactory rf = new RegionFactory(); rf.setDiskStoreName(ds.getName()); rf.setDiskSynchronous(true); rf.setDataPolicy(DataPolicy.REPLICATE); rf.setEvictionAttributes(EvictionAttributes.createLIFOEntryAttributes(1, EvictionAction.OVERFLOW_TO_DISK)); rf.create("region3"); } };