Search in sources :

Example 1 with HARegionQueue

use of org.apache.geode.internal.cache.ha.HARegionQueue in project geode by apache.

the class CacheClientProxy method destroyRQ.

private void destroyRQ() {
    if (this._messageDispatcher == null) {
        return;
    }
    try {
        // Using Destroy Region bcoz this method is modified in HARegion so as
        // not to distribute.
        // For normal Regions , even the localDestroyRegion actually propagates
        HARegionQueue rq = this._messageDispatcher._messageQueue;
        rq.destroy();
    // if (!rq.getRegion().isDestroyed()) {
    // rq.getRegion().destroyRegion();
    // }
    } catch (RegionDestroyedException rde) {
    // throw rde;
    } catch (CancelException e) {
    // throw e;
    } catch (Exception warning) {
        logger.warn(LocalizedMessage.create(LocalizedStrings.CacheClientProxy_0_EXCEPTION_IN_CLOSING_THE_UNDERLYING_HAREGION_OF_THE_HAREGIONQUEUE, this), warning);
    }
}
Also used : RegionDestroyedException(org.apache.geode.cache.RegionDestroyedException) CancelException(org.apache.geode.CancelException) HARegionQueue(org.apache.geode.internal.cache.ha.HARegionQueue) RegionExistsException(org.apache.geode.cache.RegionExistsException) CqException(org.apache.geode.cache.query.CqException) RegionDestroyedException(org.apache.geode.cache.RegionDestroyedException) CancelException(org.apache.geode.CancelException) SocketException(java.net.SocketException) IOException(java.io.IOException) CacheException(org.apache.geode.cache.CacheException)

Example 2 with HARegionQueue

use of org.apache.geode.internal.cache.ha.HARegionQueue in project geode by apache.

the class CacheClientNotifier method processDispatchedMessage.

/**
   * Adds or updates entry in the dispatched message map when client sends an ack.
   *
   * @return success
   */
public boolean processDispatchedMessage(ClientProxyMembershipID proxyId, EventID eid) {
    boolean success = false;
    CacheClientProxy proxy = getClientProxy(proxyId);
    if (proxy != null) {
        HARegionQueue harq = proxy.getHARegionQueue();
        harq.addDispatchedMessage(new ThreadIdentifier(eid.getMembershipID(), eid.getThreadID()), eid.getSequenceID());
        success = true;
    }
    return success;
}
Also used : ThreadIdentifier(org.apache.geode.internal.cache.ha.ThreadIdentifier) HARegionQueue(org.apache.geode.internal.cache.ha.HARegionQueue)

Example 3 with HARegionQueue

use of org.apache.geode.internal.cache.ha.HARegionQueue in project geode by apache.

the class ConflationDUnitTest method getStatsOnServer.

/**
   * getting conflation Stats on server
   *
   */
public static void getStatsOnServer() {
    Cache cache = GemFireCacheImpl.getInstance();
    Iterator itr = cache.getCacheServers().iterator();
    CacheServerImpl server = (CacheServerImpl) itr.next();
    Iterator iter_prox = server.getAcceptor().getCacheClientNotifier().getClientProxies().iterator();
    int ccpCount = 0;
    while (iter_prox.hasNext()) {
        ccpCount++;
        CacheClientProxy proxy = (CacheClientProxy) iter_prox.next();
        if (HaHelper.checkPrimary(proxy)) {
            HARegion region = (HARegion) proxy.getHARegion();
            assertNotNull(region);
            HARegionQueue haRegionQueue = HAHelper.getRegionQueue(region);
            statMap.put("eventsConflated", new Long(HAHelper.getRegionQueueStats(haRegionQueue).getEventsConflated()));
            LogWriterUtils.getLogWriter().info("new Stats Map  : " + statMap.toString());
        }
    }
    assertTrue("CCP Count is not 1 ", ccpCount == 1);
// }
}
Also used : Iterator(java.util.Iterator) CacheServerImpl(org.apache.geode.internal.cache.CacheServerImpl) HARegion(org.apache.geode.internal.cache.HARegion) HARegionQueue(org.apache.geode.internal.cache.ha.HARegionQueue) Cache(org.apache.geode.cache.Cache)

Example 4 with HARegionQueue

use of org.apache.geode.internal.cache.ha.HARegionQueue in project geode by apache.

the class DurableClientSimpleDUnitTest method waitForEventsRemovedByQueueRemovalMessage.

private static void waitForEventsRemovedByQueueRemovalMessage(String durableClientId, final int numEvents) {
    CacheClientNotifier ccn = CacheClientNotifier.getInstance();
    CacheClientProxy ccp = ccn.getClientProxy(durableClientId);
    HARegionQueue harq = ccp.getHARegionQueue();
    HARegionQueueStats harqStats = harq.getStatistics();
    Awaitility.await().atMost(10, TimeUnit.SECONDS).until(() -> assertEquals("Expected queue removal messages: " + numEvents + " but actual messages: " + harqStats.getEventsRemovedByQrm(), numEvents, harqStats.getEventsRemovedByQrm()));
}
Also used : HARegionQueueStats(org.apache.geode.internal.cache.ha.HARegionQueueStats) HARegionQueue(org.apache.geode.internal.cache.ha.HARegionQueue)

Example 5 with HARegionQueue

use of org.apache.geode.internal.cache.ha.HARegionQueue in project geode by apache.

the class CacheClientProxy method registerClientInterest.

/*
   * protected void addFilterRegisteredClients(String regionName, Object keyOfInterest) { try {
   * this._cacheClientNotifier.addFilterRegisteredClients(regionName, this.proxyID); } catch
   * (RegionDestroyedException e) {
   * logger.warn(LocalizedStrings.CacheClientProxy_0_INTEREST_REG_FOR_0_FAILED, regionName + "->" +
   * keyOfInterest, e); } }
   */
/**
   * Registers interest in the input region name and key
   *
   * @param regionName The fully-qualified name of the region in which to register interest
   * @param keyOfInterest The key in which to register interest
   */
protected void registerClientInterest(String regionName, Object keyOfInterest, int interestType, boolean isDurable, boolean sendUpdatesAsInvalidates, boolean flushState) {
    ClientInterestList cil = this.cils[RegisterInterestTracker.getInterestLookupIndex(isDurable, false)];
    cil.registerClientInterest(regionName, keyOfInterest, interestType, sendUpdatesAsInvalidates);
    if (flushState) {
        flushForInterestRegistration(regionName, this._cache.getDistributedSystem().getDistributedMember());
    }
    HARegionQueue queue = getHARegionQueue();
    if (queue != null) {
        // queue is null during initialization
        queue.setHasRegisteredInterest(true);
    }
}
Also used : HARegionQueue(org.apache.geode.internal.cache.ha.HARegionQueue)

Aggregations

HARegionQueue (org.apache.geode.internal.cache.ha.HARegionQueue)7 Iterator (java.util.Iterator)2 CacheServerImpl (org.apache.geode.internal.cache.CacheServerImpl)2 IOException (java.io.IOException)1 SocketException (java.net.SocketException)1 Map (java.util.Map)1 CancelException (org.apache.geode.CancelException)1 Cache (org.apache.geode.cache.Cache)1 CacheException (org.apache.geode.cache.CacheException)1 RegionDestroyedException (org.apache.geode.cache.RegionDestroyedException)1 RegionExistsException (org.apache.geode.cache.RegionExistsException)1 CqException (org.apache.geode.cache.query.CqException)1 HARegion (org.apache.geode.internal.cache.HARegion)1 HARegionQueueStats (org.apache.geode.internal.cache.ha.HARegionQueueStats)1 ThreadIdentifier (org.apache.geode.internal.cache.ha.ThreadIdentifier)1 ClientProxyMembershipID (org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID)1 ClientQueueDetail (org.apache.geode.management.ClientQueueDetail)1