@Override public Set getAllClientSessions() { return new HashSet(getCacheClientNotifier().getClientProxies()); }
/** * Returns (possibly stale) set of memberIds for all clients being actively notified by this * server. * * @return set of memberIds */ public Set getActiveClients() { Set clients = new HashSet(); for (Iterator iter = getClientProxies().iterator(); iter.hasNext();) { CacheClientProxy proxy = (CacheClientProxy) iter.next(); if (proxy.hasRegisteredInterested()) { ClientProxyMembershipID proxyID = proxy.getProxyID(); clients.add(proxyID); } } return clients; }
/** * Returns the <code>CacheClientProxySameDS</code> associated to the membershipID * * * @return the <code>CacheClientProxy</code> associated to the same distributed system */ public CacheClientProxy getClientProxySameDS(ClientProxyMembershipID membershipID) { final boolean isDebugEnabled = logger.isDebugEnabled(); if (isDebugEnabled) { logger.debug("{}::getClientProxySameDS(), Determining client for host {}", this, membershipID); logger.debug("{}::getClientProxySameDS(), Number of proxies in the Cache Clinet Notifier: {}", this, getClientProxies().size()); } CacheClientProxy proxy = null; for (Iterator i = getClientProxies().iterator(); i.hasNext();) { CacheClientProxy clientProxy = (CacheClientProxy) i.next(); if (isDebugEnabled) { logger.debug("CacheClientNotifier: Checking client {}", clientProxy); } if (clientProxy.isSameDSMember(membershipID)) { proxy = clientProxy; if (isDebugEnabled) { logger.debug("CacheClientNotifier: {} represents the client running on host {}", proxy, membershipID); } break; } } return proxy; }
/** * @return Client Queue Details for all clients */ public ClientQueueDetail[] getClientQueueDetails() throws Exception { List<ClientQueueDetail> clientQueueDetailList = null; try { if (acceptor != null && acceptor.getCacheClientNotifier() != null) { Collection<CacheClientProxy> clientProxies = acceptor.getCacheClientNotifier().getClientProxies(); if (clientProxies.size() > 0) { clientQueueDetailList = new ArrayList<ClientQueueDetail>(); } else { return new ClientQueueDetail[0]; } for (CacheClientProxy p : clientProxies) { ClientQueueDetail status = getClientQueueDetail(p); if (status != null) { clientQueueDetailList.add(status); } } ClientQueueDetail[] queueDetailArr = new ClientQueueDetail[clientQueueDetailList.size()]; return clientQueueDetailList.toArray(queueDetailArr); } return new ClientQueueDetail[0]; } catch (Exception e) { throw new Exception(e.getMessage()); } }
for (Iterator i = getClientProxies().iterator(); i.hasNext();) { CacheClientProxy clientProxy = (CacheClientProxy) i.next(); if (isTraceEnabled) {
public ClientQueueDetail getClientQueueDetail(String clientId) throws Exception { try { if (acceptor != null && acceptor.getCacheClientNotifier() != null) { Collection<CacheClientProxy> clientProxies = acceptor.getCacheClientNotifier().getClientProxies(); for (CacheClientProxy p : clientProxies) { String buffer = getClientIdFromCacheClientProxy(p); if (buffer.equals(clientId)) { ClientQueueDetail queueDetail = getClientQueueDetail(p); return queueDetail; } } } } catch (Exception e) { throw new Exception(e.getMessage()); } return null; }
for (CacheClientProxy proxy : getClientProxies()) { logger.debug("Checking whether to ping {}", proxy);
public void waitTillCacheClientProxyHasBeenPaused() { await().until(() -> { CacheClientNotifier clientNotifier = CacheClientNotifier.getInstance(); Collection<CacheClientProxy> clientProxies = clientNotifier.getClientProxies(); for (CacheClientProxy clientProxy : clientProxies) { if (clientProxy.isPaused()) { return true; } } return false; }); }
private static void verifyCacheClientProxyOnServer() { Cache cache = new ClientServerMiscDUnitTestBase().getCache(); assertEquals("More than one BridgeServer", 1, cache.getCacheServers().size()); CacheServerImpl bs = (CacheServerImpl) cache.getCacheServers().iterator().next(); assertNotNull(bs); assertNotNull(bs.getAcceptor()); final CacheClientNotifier ccn = bs.getAcceptor().getCacheClientNotifier(); assertNotNull(ccn); await() .until(() -> ccn.getClientProxies().size() == 1); }
private static void verifyNoCacheClientProxyOnServer() { try { Cache cache = new ClientServerMiscDUnitTestBase().getCache(); assertEquals("More than one BridgeServer", 1, cache.getCacheServers().size()); CacheServerImpl cacheServer = (CacheServerImpl) cache.getCacheServers().iterator().next(); assertNotNull(cacheServer); assertNotNull(cacheServer.getAcceptor()); final CacheClientNotifier ccn = cacheServer.getAcceptor().getCacheClientNotifier(); assertNotNull(ccn); await() .until(() -> ccn.getClientProxies().size() == 0); } catch (Exception ex) { System.out.println("The size of the client proxies != 0"); OSProcess.printStacks(0); throw ex; } }
private static void verifyInterestListOnServer() { try { Cache cache = new ClientServerMiscDUnitTestBase().getCache(); assertEquals("More than one BridgeServer", 1, cache.getCacheServers().size()); CacheServerImpl bs = (CacheServerImpl) cache.getCacheServers().iterator().next(); assertNotNull(bs); assertNotNull(bs.getAcceptor()); assertNotNull(bs.getAcceptor().getCacheClientNotifier()); for (CacheClientProxy ccp : bs.getAcceptor().getCacheClientNotifier().getClientProxies()) { // CCP should not contain region1 Set<String> akr = ccp.cils[RegisterInterestTracker.interestListIndex].regions; assertNotNull(akr); assertTrue(!akr.contains(Region.SEPARATOR + REGION_NAME1)); // CCP should contain region2 assertTrue(akr.contains(Region.SEPARATOR + REGION_NAME2)); assertEquals(1, akr.size()); } } catch (Exception ex) { ex.printStackTrace(); fail("while setting verifyInterestListOnServer " + ex); } }
acceptor.getCacheClientNotifier().getClientProxies();
if (cacheClientNotifier != null) { Collection<CacheClientProxy> cacheClientProxySet = cacheClientNotifier.getClientProxies(); ClientInfo clientInfo = null; boolean foundClientinCCP = false;