public Object load2(LoaderHelper helper) { if (helper.getArgument() instanceof Integer) { try { Thread.sleep(((Integer) helper.getArgument()).intValue()); } catch (InterruptedException ugh) { fail("interrupted"); } } return helper.getKey(); }
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 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; } };
public Object load(LoaderHelper helper) throws CacheLoaderException { return "value" + helper.getArgument(); } public void close() {}
Region region = helper.getRegion();
public Object load2(LoaderHelper helper) throws CacheLoaderException { try { helper.netSearch(true); } catch (TimeoutException ex) { fail("Why did I timeout?", 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(false); assertEquals(value, result); return result; } catch (TimeoutException ex) { fail("Why did I time out?", ex); } return null; } };
public Object load(LoaderHelper helper) { return "val" + helper.getArgument(); } public void close() {}
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 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; } };
@Override public Object load2(LoaderHelper helper) { if (helper.getArgument() instanceof Integer) { try { Thread.sleep(((Integer) helper.getArgument()).intValue()); } catch (InterruptedException ugh) { fail("interrupted"); } } Object ret = helper.getKey(); if( ret instanceof String) { if(ret != null && ret.equals(NON_EXISTENT_KEY)) return null;//return null } return ret; }
public Object load2(LoaderHelper helper) throws CacheLoaderException { Object[] array = (Object[]) helper.getArgument(); assertEquals(one, array[0]); array[0] = two; return value; } };
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 { Object[] array = (Object[]) helper.getArgument(); assertEquals(one, array[0]); array[0] = two; return value; } };
public Object load(LoaderHelper helper) throws CacheLoaderException { String key = (String)helper.getKey(); Portfolio p = new Portfolio(Integer.parseInt(key)); return p; }
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"); }