geode-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dinesh Akhand <dines...@amdocs.com>
Subject RE: need information about SerialGatewaySenderQueue/ParallelGatewaySenderQueue Clear
Date Fri, 14 Jul 2017 09:23:46 GMT
Hi Team,



Please reply . why we don't have implementation of clear method in  ParallelGatewaySenderQueue/
SerialGatewaySenderQueue in geode. Requirement: we want to clear the queue data.



I have implement below method in our code.

--------------------------------------------------------------

Class ParallelGatewaySenderQueue.java



//clear the partition region

private void clearPartitionedRegion(PartitionedRegion partitionedRegion)

{

                    LocalDataSet lds = (LocalDataSet)PartitionRegionHelper.getLocalPrimaryData(partitionedRegion);

                    Set<Integer>set = lds.getBucketSet(); // this returns bucket ids
in the function context



                    for (Integer bucketId : set) {

                                        Bucket bucket = partitionedRegion.getRegionAdvisor().getBucket(bucketId);

                                        if (bucket instanceof ProxyBucketRegion == false)
{

                                                            if (bucket instanceof BucketRegion)
{

                                                                                BucketRegion
bucketRegion = (BucketRegion) bucket;

                                                                                Set keySet
= bucketRegion.keySet();

                                                                                for (Iterator
iterator = keySet.iterator(); iterator.hasNext();) {

                                                                                         
          Object key = iterator.next();

                                                                                         
          bucketRegion.remove(key);

                                                                                }

                                                            }

                                        }

                    }

}

-------------------------------------------------------------

Class : SerialGatewaySenderQueue.java

 @Override

  public void clearQueue() {



    this.sender.getLifeCycleLock().readLock().lock();

    Set<Long> keys = this.region.keys();

    for (Long key : keys) {

      this.region.remove(key);

    }

    this.sender.getLifeCycleLock().readLock().unlock();



  }

-----------------------------------------------------------------



Any comment in above code will welcome.





Thanks,

Dinesh Akhand



-----Original Message-----
From: Dinesh Akhand
Sent: Monday, May 15, 2017 2:39 PM
To: dev@geode.apache.org
Subject: need information about RegionQueue





Hi Team,



Why we do't have support to clear complete queue.  Is there any limitation for it?.



public void clear(PartitionedRegion pr, int bucketId) {

       throw new RuntimeException("This method(clear)is not supported by ParallelGatewaySenderQueue");

  }



Class : ParallelGatewaySenderQueue

Class : SerialGatewaySenderQueue



Thanks,

Dinesh Akhand



This message and the information contained herein is proprietary and confidential and subject
to the Amdocs policy statement,



you may review at https://www.amdocs.com/about/email-disclaimer <https://www.amdocs.com/about/email-disclaimer>
This message and the information contained herein is proprietary and confidential and subject
to the Amdocs policy statement,

you may review at https://www.amdocs.com/about/email-disclaimer <https://www.amdocs.com/about/email-disclaimer>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message