Search in sources :

Example 1 with OverflowQueueWithDMStats

use of org.apache.geode.distributed.internal.OverflowQueueWithDMStats in project geode by apache.

the class HeapEvictor method initializeEvictorThreadPool.

private void initializeEvictorThreadPool() {
    final ThreadGroup evictorThreadGroup = LoggingThreadGroup.createThreadGroup(getEvictorThreadGroupName(), logger);
    ThreadFactory evictorThreadFactory = new ThreadFactory() {

        private int next = 0;

        public Thread newThread(Runnable command) {
            Thread t = new Thread(evictorThreadGroup, command, getEvictorThreadName() + next++);
            t.setDaemon(true);
            return t;
        }
    };
    if (!DISABLE_HEAP_EVICTIOR_THREAD_POOL) {
        this.poolQueue = new OverflowQueueWithDMStats(getGemFireCache().getCachePerfStats().getEvictionQueueStatHelper());
        this.evictorThreadPool = new ThreadPoolExecutor(MAX_EVICTOR_THREADS, MAX_EVICTOR_THREADS, 15, TimeUnit.SECONDS, this.poolQueue, evictorThreadFactory);
    }
}
Also used : LoggingThreadGroup(org.apache.geode.internal.logging.LoggingThreadGroup) OverflowQueueWithDMStats(org.apache.geode.distributed.internal.OverflowQueueWithDMStats)

Example 2 with OverflowQueueWithDMStats

use of org.apache.geode.distributed.internal.OverflowQueueWithDMStats in project geode by apache.

the class GMSMembershipManager method waitForSerialMessageProcessing.

/**
   * wait for serial executor messages from the given member to be processed
   */
public boolean waitForSerialMessageProcessing(InternalDistributedMember idm) throws InterruptedException {
    // run a message through the member's serial execution queue to ensure that all of its
    // current messages have been processed
    boolean result = false;
    OverflowQueueWithDMStats serialQueue = listener.getDM().getSerialQueue(idm);
    if (serialQueue != null) {
        final boolean[] done = new boolean[1];
        final FlushingMessage msg = new FlushingMessage(done);
        serialQueue.add(new SizeableRunnable(100) {

            public void run() {
                msg.invoke();
            }

            public String toString() {
                return "Processing fake message";
            }
        });
        synchronized (done) {
            while (!done[0]) {
                done.wait(10);
            }
            result = true;
        }
    }
    return result;
}
Also used : SizeableRunnable(org.apache.geode.distributed.internal.SizeableRunnable) OverflowQueueWithDMStats(org.apache.geode.distributed.internal.OverflowQueueWithDMStats)

Aggregations

OverflowQueueWithDMStats (org.apache.geode.distributed.internal.OverflowQueueWithDMStats)2 SizeableRunnable (org.apache.geode.distributed.internal.SizeableRunnable)1 LoggingThreadGroup (org.apache.geode.internal.logging.LoggingThreadGroup)1