jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dürig <mdue...@apache.org>
Subject Re: svn commit: r1368425 - in /jackrabbit/oak/trunk: oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/ oak-jcr/src/main/java/org/a...
Date Tue, 14 Aug 2012 16:54:13 GMT


On 2.8.12 12:46, jukka@apache.org wrote:
> Author: jukka
> Date: Thu Aug  2 11:46:37 2012
> New Revision: 1368425
>
> URL: http://svn.apache.org/viewvc?rev=1368425&view=rev
> Log:
> OAK-144: Implement observation
>
> Use a thread pool for executing background tasks.
> This solves a problem with the Timer canceling itself if a listener was added and removed
before any other listeners.
>

> Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java
> URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java?rev=1368425&r1=1368424&r2=1368425&view=diff
> ==============================================================================
> --- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java
(original)
> +++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java
Thu Aug  2 11:46:37 2012
> @@ -19,14 +19,11 @@ package org.apache.jackrabbit.oak.jcr.ob
>   import java.util.ArrayList;
>   import java.util.Iterator;
>   import java.util.List;
> -import java.util.TimerTask;
>   import java.util.concurrent.atomic.AtomicReference;
>
>   import javax.jcr.observation.Event;
>   import javax.jcr.observation.EventListener;
>
> -import com.google.common.base.Function;
> -import com.google.common.collect.Iterators;
>   import org.apache.jackrabbit.commons.iterator.EventIteratorAdapter;
>   import org.apache.jackrabbit.oak.api.ChangeExtractor;
>   import org.apache.jackrabbit.oak.api.PropertyState;
> @@ -37,15 +34,17 @@ import org.apache.jackrabbit.oak.spi.sta
>   import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
>   import org.apache.jackrabbit.oak.spi.state.NodeStateUtils;
>
> -class ChangeProcessor extends TimerTask {
> +import com.google.common.base.Function;
> +import com.google.common.collect.Iterators;
> +
> +class ChangeProcessor implements Runnable {
> +
>       private final ObservationManagerImpl observationManager;
>       private final NamePathMapper namePathMapper;
>       private final ChangeExtractor changeExtractor;
>       private final EventListener listener;
>       private final AtomicReference<ChangeFilter> filterRef;
>
> -    private volatile boolean stopped;
> -
>       public ChangeProcessor(ObservationManagerImpl observationManager, EventListener
listener, ChangeFilter filter) {
>           this.observationManager = observationManager;
>           this.namePathMapper = observationManager.getNamePathMapper();
> @@ -58,11 +57,6 @@ class ChangeProcessor extends TimerTask
>           filterRef.set(filter);
>       }
>
> -    public void stop() {
> -        cancel();
> -        stopped = true;
> -    }

This change will prevent the repository from shutting down until all 
observation events from a running diff are delivered. Depending on the 
number of changes in the tree this could delay shutdown for quite some 
time.

Michael

Mime
View raw message