public Object load2(LoaderHelper helper) throws CacheLoaderException { assertEquals(key, helper.getKey()); assertEquals(name, helper.getRegion().getName()); try { helper.getRegion().getAttributes(); Object result = helper.netSearch(false); assertEquals(value, result); return result; } catch (TimeoutException ex) { fail("Why did I time out?", ex); } return null; } };
public Object load2(LoaderHelper helper) throws CacheLoaderException { assertEquals(key, helper.getKey()); assertEquals(name, helper.getRegion().getName()); try { helper.getRegion().getAttributes(); Object result = helper.netSearch(true); assertEquals(value, result); return result; } catch (TimeoutException ex) { fail("Why did I time out?", ex); } return null; } };
public Object load(LoaderHelper helper) throws CacheLoaderException { if(helper.getRegion().getAttributes().getScope().equals(Scope.DISTRIBUTED_ACK)) { System.err.println("Doing a net search for " + helper.getKey()); Object result = helper.netSearch(false); System.err.println("Net search found " + result); if(result != null) { return result; } } Object key = helper.getKey(); return message + "-" + key; }
public Object load(LoaderHelper helper) throws CacheLoaderException { String s = "Should not be loading \"" + helper.getKey() + "\" in \"" + helper.getRegion().getFullPath() + "\""; throw new CacheLoaderException(s); }
public Object load(LoaderHelper helper) throws CacheLoaderException { /* checking the attributes set in xml file. */ PartitionedRegion pr = (PartitionedRegion) helper.getRegion(); if (pr.getAttributes().getPartitionAttributes().getRedundantCopies() != 1) Assert .fail("Redundancy of the partition region is not 1"); Assert.assertEquals( pr.getAttributes().getPartitionAttributes().getLocalMaxMemory(), 200); /* * Returning the same key. This is to check CaccheLoader is invoked or * not */ return helper.getKey(); }
public Object load(LoaderHelper helper) throws CacheLoaderException { /* checking the attributes set in xml file */ PartitionedRegion pr = (PartitionedRegion) helper.getRegion(); if (pr.getAttributes().getPartitionAttributes().getRedundantCopies() != 1) Assert .fail("Redundancy of the partition region is not 1"); Assert.assertEquals(pr.getAttributes() .getPartitionAttributes().getGlobalProperties().getProperty( PartitionAttributesFactory.GLOBAL_MAX_BUCKETS_PROPERTY), "11"); Assert.assertEquals(pr.getAttributes() .getPartitionAttributes().getLocalMaxMemory(), 200); /* * Returning the same key. This is to check CaccheLoader is invoked or * not */ return helper.getKey(); }
public Object load2(LoaderHelper helper) throws CacheLoaderException { assertEquals(key, helper.getKey()); assertEquals(name, helper.getRegion().getName()); try { RegionAttributes attrs = helper.getRegion().getAttributes(); if (attrs.getScope().isDistributed()) { assertNull(helper.netSearch(false)); assertNull(helper.netSearch(true)); } } catch (TimeoutException ex) { fail("Why did I time out?", ex); } Object argument = helper.getArgument(); if (argument != null) { if (argument.equals(exception)) { String s = "Test Exception"; throw new CacheLoaderException(s); } else { assertEquals(arg, argument); } } return value; } };
Region region = helper.getRegion();
public Object load(LoaderHelper<Object, Object> helper) throws CacheLoaderException { RegionKey primaryKey = null; try { primaryKey = (RegionKey)helper.getKey(); Object[] columnValues = new Object[this.numberOfColumns]; Object[] primaryKeyAsJavaObjectArray = new Object[primaryKey.nCols()]; primaryKey.getKeyColumns(primaryKeyAsJavaObjectArray); for (int index = 0; index < primaryKeyAsJavaObjectArray.length; ++index) { columnValues[pkIndexes[index] - 1] = primaryKeyAsJavaObjectArray[index]; } Object row = this.gfxdLdr.getRow(this.schemaName, this.tableName, primaryKeyAsJavaObjectArray); if (row != null) { GemFireContainer gfcontainer = (GemFireContainer)helper.getRegion() .getUserAttribute(); final Object value = gfcontainer.makeValueAsPerStorage(row); if (value != null) { return value; } } } catch (Throwable t) { if (GemFireXDUtils.retryToBeDone(t)) { throw new InternalFunctionInvocationTargetException(t); } throw new CacheLoaderException("exception while loading a row", t); } throw new EntryNotFoundException("no value obtained for key: " + primaryKey + " from row loader"); }
public Object load(LoaderHelper<Object, Object> helper) throws CacheLoaderException { RegionKey primaryKey = null; try { primaryKey = (RegionKey)helper.getKey(); Object[] columnValues = new Object[this.numberOfColumns]; Object[] primaryKeyAsJavaObjectArray = new Object[primaryKey.nCols()]; primaryKey.getKeyColumns(primaryKeyAsJavaObjectArray); for (int index = 0; index < primaryKeyAsJavaObjectArray.length; ++index) { columnValues[pkIndexes[index] - 1] = primaryKeyAsJavaObjectArray[index]; } Object row = this.gfxdLdr.getRow(this.schemaName, this.tableName, primaryKeyAsJavaObjectArray); if (row != null) { GemFireContainer gfcontainer = (GemFireContainer)helper.getRegion() .getUserAttribute(); final Object value = gfcontainer.makeValueAsPerStorage(row); if (value != null) { return value; } } } catch (Throwable t) { if (GemFireXDUtils.retryToBeDone(t)) { throw new InternalFunctionInvocationTargetException(t); } throw new CacheLoaderException("exception while loading a row", t); } throw new EntryNotFoundException("no value obtained for key: " + primaryKey + " from row loader"); }
public Object load(LoaderHelper<Object, Object> helper) throws CacheLoaderException { RegionKey primaryKey = null; try { primaryKey = (RegionKey)helper.getKey(); Object[] columnValues = new Object[this.numberOfColumns]; Object[] primaryKeyAsJavaObjectArray = new Object[primaryKey.nCols()]; primaryKey.getKeyColumns(primaryKeyAsJavaObjectArray); for (int index = 0; index < primaryKeyAsJavaObjectArray.length; ++index) { columnValues[pkIndexes[index] - 1] = primaryKeyAsJavaObjectArray[index]; } Object row = this.gfxdLdr.getRow(this.schemaName, this.tableName, primaryKeyAsJavaObjectArray); if (row != null) { GemFireContainer gfcontainer = (GemFireContainer)helper.getRegion() .getUserAttribute(); final Object value = gfcontainer.makeValueAsPerStorage(row); if (value != null) { return value; } } } catch (Throwable t) { if (GemFireXDUtils.retryToBeDone(t)) { throw new InternalFunctionInvocationTargetException(t); } throw new CacheLoaderException("exception while loading a row", t); } throw new EntryNotFoundException("no value obtained for key: " + primaryKey + " from row loader"); }
if (helper.getRegion().getAttributes().getScope().isDistributed()) { if (true) { String s = "netSearch not working. See bug 30895";