public void run2() throws CacheException { final CacheClientNotifier ccnInstance = CacheClientNotifier .getInstance(); final CacheClientProxy clientProxy = ccnInstance .getClientProxy(durableClientId); ClientProxyMembershipID proxyId = clientProxy.getProxyID(); try { ccnInstance.closeClientCq(durableClientId, "All"); ccnInstance.closeClientCq(durableClientId, "GreaterThan5"); ccnInstance.closeClientCq(durableClientId, "LessThan5"); } catch (CqException e) { throw new CacheException(e){}; } } });
public void run2() throws CacheException { final CacheClientNotifier ccnInstance = CacheClientNotifier .getInstance(); final CacheClientProxy clientProxy = ccnInstance .getClientProxy(durableClientId); ClientProxyMembershipID proxyId = clientProxy.getProxyID(); try { ccnInstance.closeClientCq(durableClientId, "All"); ccnInstance.closeClientCq(durableClientId, "GreaterThan5"); ccnInstance.closeClientCq(durableClientId, "LessThan5"); } catch (CqException e) { throw new CacheException(e){}; } } });
public void run2() throws CacheException { final CacheClientNotifier ccnInstance = CacheClientNotifier .getInstance(); final CacheClientProxy clientProxy = ccnInstance .getClientProxy(durableClientId); ClientProxyMembershipID proxyId = clientProxy.getProxyID(); try { ccnInstance.closeClientCq(durableClientId, "All"); } catch (CqException e) { throw new CacheException(e){}; } } });
public void run2() throws CacheException { final CacheClientNotifier ccnInstance = CacheClientNotifier .getInstance(); final CacheClientProxy clientProxy = ccnInstance .getClientProxy(durableClientId); ClientProxyMembershipID proxyId = clientProxy.getProxyID(); try { ccnInstance.closeClientCq(durableClientId, "All"); } catch (CqException e) { throw new CacheException(e){}; } } });
public void run2() throws CacheException { //Set the Test Hook! //This test hook will pause during the drain process CacheClientProxy.testHook = new RejectClientReconnectTestHook(); final CacheClientNotifier ccnInstance = CacheClientNotifier .getInstance(); final CacheClientProxy clientProxy = ccnInstance .getClientProxy(durableClientId); ClientProxyMembershipID proxyId = clientProxy.getProxyID(); try { ccnInstance.closeClientCq(durableClientId, "All"); } catch (CqException e) { throw new CacheException(e){}; } } });
public void run2() throws CacheException { final CacheClientNotifier ccnInstance = CacheClientNotifier .getInstance(); final CacheClientProxy clientProxy = ccnInstance .getClientProxy(durableClientId); ClientProxyMembershipID proxyId = clientProxy.getProxyID(); try { ccnInstance.closeClientCq(durableClientId, "All"); fail("expected a cq exception. We have an active client proxy, the close cq command should have failed"); } catch (CqException e) { //expected exception; String expected = LocalizedStrings.CacheClientProxy_COULD_NOT_DRAIN_CQ_DUE_TO_ACTIVE_DURABLE_CLIENT.toLocalizedString("All", proxyId.getDurableId()); if (!e.getMessage().equals(expected)) { fail("Not the expected exception, was expecting " + (LocalizedStrings.CacheClientProxy_COULD_NOT_DRAIN_CQ_DUE_TO_ACTIVE_DURABLE_CLIENT.toLocalizedString("All", proxyId.getDurableId()) + " instead of exception: " + e.getMessage())); } } } });
public void run2() throws CacheException { //Set the Test Hook! //This test hook will pause during the drain process CacheClientProxy.testHook = new CqExceptionDueToActivatingClientTestHook(); final CacheClientNotifier ccnInstance = CacheClientNotifier .getInstance(); final CacheClientProxy clientProxy = ccnInstance .getClientProxy(durableClientId); ClientProxyMembershipID proxyId = clientProxy.getProxyID(); try { ccnInstance.closeClientCq(durableClientId, "All"); fail("Should have thrown an exception due to activating client"); } catch (CqException e) { String expected = LocalizedStrings.CacheClientProxy_COULD_NOT_DRAIN_CQ_DUE_TO_RESTARTING_DURABLE_CLIENT.toLocalizedString("All", proxyId.getDurableId()); if (!e.getMessage().equals(expected)) { fail("Not the expected exception, was expecting " + (LocalizedStrings.CacheClientProxy_COULD_NOT_DRAIN_CQ_DUE_TO_RESTARTING_DURABLE_CLIENT.toLocalizedString("All", proxyId.getDurableId()) + " instead of exception: " + e.getMessage())); } } } });
@Override public void execute(FunctionContext context) { final Cache cache = CliUtil.getCacheIfExists(); final String memberNameOrId = CliUtil.getMemberNameOrId(cache.getDistributedSystem().getDistributedMember()); CacheClientNotifier cacheClientNotifier = CacheClientNotifier.getInstance(); String [] args = (String []) context.getArguments(); String durableClientId = args[0]; String cqName = args[1]; MemberResult memberResult = new MemberResult(memberNameOrId); try { if (cacheClientNotifier != null) { CacheClientProxy cacheClientProxy = cacheClientNotifier.getClientProxy(durableClientId); if (cacheClientProxy != null) { if (cacheClientNotifier.closeClientCq(durableClientId, cqName)) { memberResult.setSuccessMessage(CliStrings.format(CliStrings.CLOSE_DURABLE_CQS__SUCCESS, cqName, durableClientId)); } else { memberResult.setErrorMessage(CliStrings.format(CliStrings.CLOSE_DURABLE_CQS__UNABLE__TO__CLOSE__CQ, cqName, durableClientId)); } } else { memberResult.setErrorMessage(CliStrings.format(CliStrings.NO_CLIENT_FOUND_WITH_CLIENT_ID, durableClientId)); } } else { memberResult.setErrorMessage(CliStrings.NO_CLIENT_FOUND); } } catch (Exception e) { memberResult.setExceptionMessage(e.getMessage()); } finally { context.getResultSender().lastResult(memberResult); } }
@Override public void execute(FunctionContext context) { final Cache cache = CliUtil.getCacheIfExists(); final String memberNameOrId = CliUtil.getMemberNameOrId(cache.getDistributedSystem().getDistributedMember()); CacheClientNotifier cacheClientNotifier = CacheClientNotifier.getInstance(); String [] args = (String []) context.getArguments(); String durableClientId = args[0]; String cqName = args[1]; MemberResult memberResult = new MemberResult(memberNameOrId); try { if (cacheClientNotifier != null) { CacheClientProxy cacheClientProxy = cacheClientNotifier.getClientProxy(durableClientId); if (cacheClientProxy != null) { if (cacheClientNotifier.closeClientCq(durableClientId, cqName)) { memberResult.setSuccessMessage(CliStrings.format(CliStrings.CLOSE_DURABLE_CQS__SUCCESS, cqName, durableClientId)); } else { memberResult.setErrorMessage(CliStrings.format(CliStrings.CLOSE_DURABLE_CQS__UNABLE__TO__CLOSE__CQ, cqName, durableClientId)); } } else { memberResult.setErrorMessage(CliStrings.format(CliStrings.NO_CLIENT_FOUND_WITH_CLIENT_ID, durableClientId)); } } else { memberResult.setErrorMessage(CliStrings.NO_CLIENT_FOUND); } } catch (Exception e) { memberResult.setExceptionMessage(e.getMessage()); } finally { context.getResultSender().lastResult(memberResult); } }