Java Code Examples for com.gemstone.gemfire.cache.Region#put()
The following examples show how to use
com.gemstone.gemfire.cache.Region#put() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PRColocationDUnitTest.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
public static void putOrderPartitionedRegion(String partitionedRegionName) { assertNotNull(basicGetCache()); Region partitionedregion = basicGetCache().getRegion(Region.SEPARATOR + partitionedRegionName); assertNotNull(partitionedregion); for (int i = 1; i <= 10; i++) { CustId custid = new CustId(i); for (int j = 1; j <= 10; j++) { int oid = (i * 10) + j; OrderId orderId = new OrderId(oid, custid); Order order = new Order("OREDR" + oid); try { partitionedregion.put(orderId, order); assertTrue(partitionedregion.containsKey(orderId)); assertEquals(order,partitionedregion.get(orderId)); } catch (Exception e) { fail( "putOrderPartitionedRegion : failed while doing put operation in OrderPartitionedRegion ", e); } // getLogWriter().info("Order :- { " + orderId + " : " + order + " }"); } } }
Example 2
Source File: SnapshotTest.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
/** Update an existing entry in the given region. If there are * no available keys in the region, then this is a noop. * * @param aRegion The region to use for updating an entry. * @param key The key to update. */ protected void updateEntry(Region aRegion, Object key) { Object anObj = getUpdateObject(aRegion, (String)key); String callback = updateCallbackPrefix + ProcessMgr.getProcessId(); Object returnVal = null; if (TestConfig.tab().getRandGen().nextBoolean()) { // do a put with callback arg Log.getLogWriter().info("updateEntry: replacing key " + key + " with " + TestHelper.toString(anObj) + ", callback is " + callback + ", region is " + aRegion.getFullPath()); returnVal = aRegion.put(key, anObj, callback); Log.getLogWriter().info("Done with call to put (update), returnVal is " + returnVal); } else { // do a put without callback Log.getLogWriter().info("updateEntry: replacing key " + key + " with " + TestHelper.toString(anObj) + ", region is " + aRegion.getFullPath()); returnVal = aRegion.put(key, anObj, false); Log.getLogWriter().info("Done with call to put (update), returnVal is " + returnVal); } }
Example 3
Source File: IndexCreationTest.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
/** * Test the Index maiantenance as it may use the method keys() of QRegion * instead of DummyQRegion while running an IndexMaintenanceQuery * @author Asif */ public void testIMQFailureAsMethodKeysNAInDummyQRegion() { QueryService qs; qs = CacheUtils.getQueryService(); try{ Index i1 = qs.createIndex("keyIndex", IndexType.FUNCTIONAL, "ks.hashCode","/portfolios.keys() ks"); Region rgn = CacheUtils.getRegion("/portfolios"); rgn.put("4",new Portfolio(4)); rgn.put("5",new Portfolio(5)); System.out.println(((CompactRangeIndex)i1).dump()); Query qr = qs.newQuery("Select distinct keys.hashCode from /portfolios.keys() keys where keys.hashCode >= $1"); SelectResults sr = (SelectResults)qr.execute(new Object[]{new Integer(-1)}); assertEquals(6,sr.size()); }catch(Exception e) { CacheUtils.getLogger().error(e); fail("Test failed because of exception. e="+e); } }
Example 4
Source File: QueryREUpdateInProgressJUnitTest.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
private void putREWithUpdateInProgressTrue(String region) { Region reg = CacheUtils.getRegion(region); Portfolio[] values = new PRQueryDUnitHelper("").createPortfoliosAndPositions(numOfEntries); int i=0; for (Object val: values) { reg.put(i, val); i++; } //Set all RegionEntries to be updateInProgress. Iterator entryItr = reg.entrySet().iterator(); while (entryItr.hasNext()) { Region.Entry nonTxEntry = (Region.Entry) entryItr.next(); RegionEntry entry = ((NonTXEntry)nonTxEntry).getRegionEntry(); entry.setUpdateInProgress(true); assertTrue(entry.isUpdateInProgress()); } }
Example 5
Source File: PRClientServerRegionFunctionExecutionSingleHopDUnitTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public static void serverSingleKeyExecutionSocketTimeOut(Boolean isByName) { Region region = cache.getRegion(PartitionedRegionName); assertNotNull(region); final String testKey = "execKey"; final Set testKeysSet = new HashSet(); testKeysSet.add(testKey); DistributedSystem.setThreadsSocketPolicy(false); Function function = new TestFunction(true,TestFunction.TEST_FUNCTION_SOCKET_TIMEOUT); FunctionService.registerFunction(function); Execution dataSet = FunctionService.onRegion(region); region.put(testKey, new Integer(1)); try { ResultCollector rs = execute(dataSet, testKeysSet, Boolean.TRUE, function, isByName); assertEquals(Boolean.TRUE, ((List)rs.getResult()).get(0)); ResultCollector rs2 = execute(dataSet, testKeysSet, testKey, function, isByName); assertEquals(testKey, ((List)rs2.getResult()).get(0)); }catch (Exception ex) { ex.printStackTrace(); getLogWriter().info("Exception : " , ex); fail("Test failed after the put operation",ex); } }
Example 6
Source File: DistinctResultsWithDupValuesInRegionTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
private void createPartitionedRegion() { Cache cache = CacheUtils.getCache(); PartitionAttributesFactory prAttFactory = new PartitionAttributesFactory(); AttributesFactory attributesFactory = new AttributesFactory(); attributesFactory.setPartitionAttributes(prAttFactory.create()); RegionAttributes regionAttributes = attributesFactory.create(); Region region = cache.createRegion(regionName, regionAttributes); for (int i = 1; i <= numElem; i++) { Portfolio obj = new Portfolio(i); region.put(i, obj); region.put(i + numElem, obj); System.out.println(obj); } }
Example 7
Source File: PRClientServerRegionFunctionExecutionDUnitTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public static void serverMultiKeyExecution_ThrowException(Boolean isByName) { Region region = cache.getRegion(PartitionedRegionName); assertNotNull(region); final HashSet testKeysSet = new HashSet(); for (int i = (totalNumBuckets.intValue() * 2); i > 0; i--) { testKeysSet.add("execKey-" + i); } DistributedSystem.setThreadsSocketPolicy(false); Function function = new TestFunction(true,TestFunction.TEST_FUNCTION_THROW_EXCEPTION); FunctionService.registerFunction(function); Execution dataSet = FunctionService.onRegion(region); int j = 0; HashSet origVals = new HashSet(); for (Iterator i = testKeysSet.iterator(); i.hasNext();) { Integer val = new Integer(j++); origVals.add(val); region.put(i.next(), val); } try { List l = null; ResultCollector rc1 = execute(dataSet, testKeysSet, Boolean.TRUE, function, isByName); fail("Exception Expected"); } catch(Exception ex){ ex.printStackTrace(); } }
Example 8
Source File: PRClientServerRegionFunctionExecutionDUnitTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public static void regionSingleKeyExecutionNonHA(Boolean isByName, Function function, Boolean toRegister) { Region region = cache.getRegion(PartitionedRegionName); assertNotNull(region); final String testKey = "execKey"; final Set testKeysSet = new HashSet(); testKeysSet.add(testKey); DistributedSystem.setThreadsSocketPolicy(false); if (toRegister.booleanValue()) { FunctionService.registerFunction(function); } else { FunctionService.unregisterFunction(function.getId()); assertNull(FunctionService.getFunction(function.getId())); } Execution dataSet = FunctionService.onRegion(region); region.put(testKey, new Integer(1)); try { ArrayList<String> args = new ArrayList<String>(); args.add(retryRegionName); args.add("regionSingleKeyExecutionNonHA"); ResultCollector rs = execute(dataSet, testKeysSet, args, function, isByName); fail("Expected ServerConnectivityException not thrown!"); } catch (Exception ex) { if (!(ex.getCause() instanceof ServerConnectivityException) && !(ex.getCause() instanceof FunctionInvocationTargetException)) { ex.printStackTrace(); getLogWriter().info("Exception : ", ex); fail("Test failed after the execute operation"); } } }
Example 9
Source File: ManagementTestBase.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** * Puts in distributed region * * @param vm */ protected void putInDistributedRegion(final VM vm, final String key, final String value, final String regionPath) { SerializableRunnable put = new SerializableRunnable( "Put In Distributed Region") { public void run() { GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); Region region = cache.getRegion(regionPath); region.put(key, value); } }; vm.invoke(put); }
Example 10
Source File: DistinctResultsWithDupValuesInRegionTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
private void createPartitionedRegion() { Cache cache = CacheUtils.getCache(); PartitionAttributesFactory prAttFactory = new PartitionAttributesFactory(); AttributesFactory attributesFactory = new AttributesFactory(); attributesFactory.setPartitionAttributes(prAttFactory.create()); RegionAttributes regionAttributes = attributesFactory.create(); Region region = cache.createRegion(regionName, regionAttributes); for (int i = 1; i <= numElem; i++) { Portfolio obj = new Portfolio(i); region.put(i, obj); region.put(i + numElem, obj); System.out.println(obj); } }
Example 11
Source File: ExecuteClient.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
private void putAndGetFunctionExecution(Region r, int i) throws Exception { Serializable key = (Serializable)ObjectHelper.createName(this.keyType, i); String objectType = CachePerfPrms.getObjectType(); Object val = ObjectHelper.createObject(objectType, i); // initial put /* long start = this.statistics.startPut(); r.put(key, val); this.statistics.endPut(start, 1, this.isMainWorkload, this.histogram); */ for (int j = 0; j < 4; j++) { if (this.sleepBeforeOp) { MasterController.sleepForMs(CachePerfPrms.getSleepMs()); } // put long start = this.statistics.startPut(); r.put(key, val); this.statistics.endPut(start, 1, this.isMainWorkload, this.histogram); // get using function start = this.statistics.startGet(); Object result = retrieveUsingRegionFunction(r, key); this.statistics.endGet(start, 1, this.isMainWorkload, this.histogram); } }
Example 12
Source File: WanQueueSizeDUnitTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** * Function for populating the wan eanbled region at the server. * * @throws Exception */ public static void doPutAtServer() throws Exception { Region region = cache.getRegion(REGION_NAME); byte[] val = new byte[CACHE_SIZE] ; for (int i= 0; i<CACHE_SIZE ; i++){ val[i] = 0; } for (int count = 0; count < MAX_PUT; count++) { region.put("key" + count,val); cache.getLogger().fine("Put the key ===== " + "key" + count); } }
Example 13
Source File: WANTestBase.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public static void doPutsWithKeyAsString(String regionName, int numPuts) { Region r = cache.getRegion(Region.SEPARATOR + regionName); assertNotNull(r); for (long i = 0; i < numPuts; i++) { r.put("Object_" + i, i); } }
Example 14
Source File: HARegionJUnitTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** * test no exception being thrown while put is being done on an HARegion * */ public void testPut() { try { Region region = createHARegion(); region.put("key1", "value1"); Assert.assertEquals(region.get("key1"), "value1"); } catch (Exception e) { fail("put failed due to " + e); } }
Example 15
Source File: PRClientServerRegionFunctionExecutionDUnitTest.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
public static void serverMultiKeyExecution_Inline() { Region region = cache.getRegion(PartitionedRegionName); assertNotNull(region); final HashSet testKeysSet = new HashSet(); for (int i = (totalNumBuckets.intValue() * 2); i > 0; i--) { testKeysSet.add("execKey-" + i); } DistributedSystem.setThreadsSocketPolicy(false); Execution dataSet = FunctionService.onRegion(region); try { int j = 0; HashSet origVals = new HashSet(); for (Iterator i = testKeysSet.iterator(); i.hasNext();) { Integer val = new Integer(j++); origVals.add(val); region.put(i.next(), val); } List l = null; ResultCollector rc1 = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter(){ @Override public void execute(FunctionContext context) { if (context.getArguments() instanceof String) { context.getResultSender().lastResult( "Success"); }else if(context.getArguments() instanceof Boolean){ context.getResultSender().lastResult(Boolean.TRUE); } } @Override public String getId() { return getClass().getName(); } @Override public boolean hasResult() { return true; } }); l = ((List)rc1.getResult()); getLogWriter().info("Result size : " + l.size()); assertEquals(3, l.size()); for (Iterator i = l.iterator(); i.hasNext();) { assertEquals(Boolean.TRUE, i.next()); } }catch(Exception e){ getLogWriter().info("Exception : " + e.getMessage()); e.printStackTrace(); fail("Test failed after the put operation"); } }
Example 16
Source File: CacheServerLauncherJUnitTest.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
public void testWithoutServerPort() throws Exception { String testName = "testWithoutServerPort"; this.cacheserverDirName = "CacheServerLauncherJUnitTest_"+testName; String logName = testName+".log"; String cacheXmlName = testName+".xml"; File dir = new File(this.cacheserverDirName); dir.mkdir(); int xmlPort = AvailablePortHelper.getRandomAvailableTCPPort(); createCacheXml(dir, cacheXmlName, xmlPort, null, 1); execAndValidate(new String[] { "start", "-J-D"+CONTROLLER_NAMING_PORT_PROP+"="+controllerNamingPort, "-J-D"+CACHESERVER_NAMING_PORT_PROP+"="+cacheserverNamingPort, "-J-Xmx"+Runtime.getRuntime().maxMemory(), "mcast-port="+mcastPort, "log-file="+logName, "cache-xml-file="+cacheXmlName, "-dir="+this.cacheserverDirName, "-classpath="+JTESTS }, "CacheServer pid: \\d+ status: running"); execAndValidate(new String[] { "status", "-dir=" + dir }, "CacheServer pid: \\d+ status: running"); ClientCache cache = new ClientCacheFactory().create(); ClientRegionFactory<Integer, Integer> fact = cache .createClientRegionFactory(ClientRegionShortcut.PROXY); Pool p = PoolManager.createFactory().addServer("localhost", xmlPort) .create("cslPool"); fact.setPoolName(p.getName()); Region<Integer, Integer> rgn = fact.create("rgn"); List<InetSocketAddress> servers = p.getServers(); Assert.assertTrue(servers.size() == 1); Assert.assertTrue(servers.iterator().next().getPort() == xmlPort); rgn.put(1, 1); // put should be successful execAndValidate(new String[] { "stop", "-dir=" + dir }, "The CacheServer has stopped\\."); }
Example 17
Source File: PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
public static void serverAllKeyExecution(Boolean isByName) { Region region = cache.getRegion(PartitionedRegionName); assertNotNull(region); final HashSet testKeysSet = new HashSet(); for (int i = (totalNumBuckets.intValue() / 2); i > 0; i--) { testKeysSet.add("execKey-" + i); } DistributedSystem.setThreadsSocketPolicy(false); Function function = new TestFunction(true, TEST_FUNCTION2); FunctionService.registerFunction(function); Execution dataSet = FunctionService.onRegion(region); try { int j = 0; HashSet origVals = new HashSet(); for (Iterator i = testKeysSet.iterator(); i.hasNext();) { Integer val = new Integer(j++); origVals.add(val); region.put(i.next(), val); } ResultCollector rc1 = executeOnAll(dataSet, Boolean.TRUE, function, isByName); List resultList = (List)((List)rc1.getResult()); getLogWriter().info("Result size : " + resultList.size()); getLogWriter().info("Result are SSSS : " + resultList); assertEquals(3, resultList.size()); Iterator resultIterator = resultList.iterator(); Map.Entry entry = null; DistributedMember key = null; List resultListForMember = new ArrayList(); // while (resultIterator.hasNext()) { // resultListForMember.add(resultIterator.next()); // // for (Object result : resultListForMember) { // assertEquals(Boolean.TRUE, result); // } // } for (Object result : resultList) { assertEquals(Boolean.TRUE, result); } List l2 = null; ResultCollector rc2 = executeOnAll(dataSet, testKeysSet, function, isByName); l2 = ((List)rc2.getResult()); assertEquals(3, l2.size()); HashSet foundVals = new HashSet(); for (Iterator i = l2.iterator(); i.hasNext();) { ArrayList subL = (ArrayList)(i.next()); assertTrue(subL.size() > 0); for (Iterator subI = subL.iterator(); subI.hasNext();) { assertTrue(foundVals.add(subI.next())); } } assertEquals(origVals, foundVals); } catch (Exception e) { fail("Test failed after the put operation", e); } }
Example 18
Source File: DistributedRegionFunction.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
@Override public void execute(FunctionContext context) { RegionFunctionContext rcontext = (RegionFunctionContext)context; Region<Object, Object> region = rcontext.getDataSet(); InternalDistributedSystem sys = InternalDistributedSystem .getConnectedInstance(); sys.getLogWriter().fine( "DistributedRegionFunction#execute( " + rcontext + " )"); Assert.assertTrue(region.getAttributes().getDataPolicy().withStorage()); Assert.assertTrue(region.getAttributes() .getDataPolicy() != DataPolicy.NORMAL); Assert.assertTrue(rcontext.getFilter().size() == 20); long startTime = System.currentTimeMillis(); // Boolean.TRUE dummy argument indicates that CacheClose has to be done from // the body itself if (Boolean.TRUE.equals(rcontext.getArguments())) { // do not close cache in retry if (!rcontext.isPossibleDuplicate()) { sys.disconnect(); throw new CacheClosedException("Throwing CacheClosedException " + "to simulate failover during function exception"); } } else { WaitCriterion wc = new WaitCriterion() { String excuse; public boolean done() { return false; } public String description() { return excuse; } }; DistributedTestCase.waitForCriterion(wc, 12000, 500, false); } long endTime = System.currentTimeMillis(); // intentionally doing region operation to cause cacheClosedException region.put("execKey-201", new Integer(201)); if (rcontext.isPossibleDuplicate()) { // Below operation is done when the // function is reexecuted region.put("execKey-202", new Integer(202)); region.put("execKey-203", new Integer(203)); } sys.getLogWriter().fine( "Time wait for Function Execution = " + (endTime - startTime)); for (int i = 0; i < 5000; i++) { context.getResultSender().sendResult(Boolean.TRUE); } context.getResultSender().lastResult(Boolean.TRUE); }
Example 19
Source File: DiskRegionJUnitTest.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
/** * When max-dir-size is exceeded and compaction is enabled we allow oplogs to * keep getting created. Make sure that when they do they do not keep putting * one op per oplog (which is caused by bug 42464). */ public void testBug42464() { putsHaveStarted = false; DiskRegionProperties diskRegionProperties = new DiskRegionProperties(); File[] myDirs = new File[] { dirs[0] }; int[] dirSizes = { 900 }; diskRegionProperties.setDiskDirsAndSizes(myDirs, dirSizes); diskRegionProperties.setMaxOplogSize(500); diskRegionProperties.setRolling(true); diskRegionProperties.setOverFlowCapacity(1); Region region = DiskRegionHelperFactory.getSyncOverFlowOnlyRegion(cache, diskRegionProperties); DiskStore ds = ((LocalRegion) region).getDiskStore(); DiskStoreImpl dsi = (DiskStoreImpl) ds; if (!Arrays.equals(dirSizes, ds.getDiskDirSizes())) { fail("expected=" + Arrays.toString(dirSizes) + " actual=" + Arrays.toString(ds.getDiskDirSizes())); } // One entry is kept in memory // since the crf max is 500 we should only be able to have 4 entries. The // 5th should not fit because of record overhead. for (int i = 0; i <= 9; i++) { region.getCache().getLogger().info("putting " + i); region.put(new Integer(i), new byte[101]); } // At this point we should have two oplogs that are basically full // (they should each contain 4 entries) and a third oplog that // contains a single entry. But the 3rd one will end up also containing 4 // entries. // TODO what is the max size of this 3rd oplog's crf? The first two crfs // will be close to 400 bytes each. So the max size of the 3rd oplog should // be close to 100. ArrayList<OverflowOplog> oplogs = dsi.testHookGetAllOverflowOplogs(); assertEquals(3, oplogs.size()); // TODO verify oplogs // Now make sure that further oplogs can hold 4 entries for (int j = 10; j <= 13; j++) { region.getCache().getLogger().info("putting " + j); region.put(new Integer(j), new byte[101]); } oplogs = dsi.testHookGetAllOverflowOplogs(); assertEquals(4, oplogs.size()); // now remove all entries and make sure old oplogs go away for (int i = 0; i <= 13; i++) { region.getCache().getLogger().info("removing " + i); region.remove(new Integer(i)); } // give background compactor chance to remove oplogs oplogs = dsi.testHookGetAllOverflowOplogs(); int retryCount = 20; while (oplogs.size() > 1 && retryCount > 0) { DistributedTestCase.staticPause(100); oplogs = dsi.testHookGetAllOverflowOplogs(); retryCount--; } assertEquals(1, oplogs.size()); }
Example 20
Source File: CacheServerLauncherJUnitTest.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
public void testRebalance() throws Exception { String testName = "testRebalance"; this.cacheserverDirName = "CacheServerLauncherJUnitTest_"+testName; String logName = testName+".log"; String cacheXmlName = testName+".xml"; Registry registry = LocateRegistry.createRegistry(controllerNamingPort); RebalanceStatus status = new RebalanceStatus(); registry.bind(REBALANCE_STATUS_BINDING, status); try { File dir = new File(this.cacheserverDirName); dir.mkdir(); createCacheXml(dir, cacheXmlName, serverPort, true); // connect local member and create PR... Properties props = new Properties(); props.setProperty(DistributionConfig.MCAST_PORT_NAME, ""+mcastPort); DistributedSystem system = DistributedSystem.connect(props); Cache cache = CacheFactory.create(system); AttributesFactory factory = new AttributesFactory(); factory.setPartitionAttributes(new PartitionAttributesFactory() //.setLocalMaxMemory(localMaxMemory) //.setTotalNumBuckets(numBuckets) //.setRedundantCopies(redundantCopies) //.setColocatedWith(colocatedWith) .create()); RegionAttributes attrs = factory.create(); Region pr = cache.createRegion("PartitionedRegion", attrs); // create 6 different buckets... int createdBuckets = 6; for (int i = 0; i < createdBuckets; i++) { pr.put(Integer.valueOf(i), Integer.valueOf(i)); } // assert that there are 6 local buckets PartitionedRegionDataStore dataStore = ((PartitionedRegion)pr).getDataStore(); assertEquals(createdBuckets, dataStore.getBucketsManaged()); execAndValidate(new String[] { "start", "-J-D"+CONTROLLER_NAMING_PORT_PROP+"="+controllerNamingPort, "-J-D"+CACHESERVER_NAMING_PORT_PROP+"="+cacheserverNamingPort, "-J-Xmx"+Runtime.getRuntime().maxMemory(), "mcast-port="+mcastPort, "log-file="+logName, "cache-xml-file="+cacheXmlName, "-dir="+this.cacheserverDirName, "-classpath="+JTESTS, "-rebalance" }, "CacheServer pid: \\d+ status: running"); assertTrue(status.waitForRebalancingToStart(10*1000)); assertTrue(status.waitForRebalancingToFinish(10*1000)); // assert that there are 3 local buckets AFTER the rebalance assertEquals(createdBuckets/2, dataStore.getBucketsManaged()); execAndValidate(new String[] { "status", "-dir="+dir }, "CacheServer pid: \\d+ status: running"); execAndValidate(new String[] { "stop", "-dir="+dir }, ".*The CacheServer has stopped\\."); } finally { UnicastRemoteObject.unexportObject(status, true); UnicastRemoteObject.unexportObject(registry, true); } }