org.apache.sling.discovery.impl.cluster.voting
Class VotingHandler

java.lang.Object
  extended by org.apache.sling.discovery.impl.cluster.voting.VotingHandler
All Implemented Interfaces:
org.osgi.service.event.EventHandler

@Service(value={org.osgi.service.event.EventHandler.class,VotingHandler.class})
@Properties(value={@Property(name="service.description",value="New Voting Event Listener."),@Property(name="event.topics",value={"org/apache/sling/api/resource/Resource/ADDED","org/apache/sling/api/resource/Resource/CHANGED","org/apache/sling/api/resource/Resource/REMOVED"})})
public class VotingHandler
extends Object
implements org.osgi.service.event.EventHandler

The osgi event handler responsible for following any votings and vote accordingly


Constructor Summary
VotingHandler()
           
 
Method Summary
protected  void activate(org.osgi.service.component.ComponentContext context)
           
 void analyzeVotings(org.apache.sling.api.resource.ResourceResolver resourceResolver)
          Analyze any ongoing voting in the repository.
 void cleanupTimedoutVotings(org.apache.sling.api.resource.ResourceResolver resourceResolver)
           
 void handleEvent(org.osgi.service.event.Event event)
          handle repository changes and react to ongoing votings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VotingHandler

public VotingHandler()
Method Detail

activate

protected void activate(org.osgi.service.component.ComponentContext context)

handleEvent

public void handleEvent(org.osgi.service.event.Event event)
handle repository changes and react to ongoing votings

Specified by:
handleEvent in interface org.osgi.service.event.EventHandler

analyzeVotings

public void analyzeVotings(org.apache.sling.api.resource.ResourceResolver resourceResolver)
                    throws org.apache.sling.api.resource.PersistenceException
Analyze any ongoing voting in the repository.

SLING-2885: this method must be synchronized as it can be called concurrently by the HearbeatHandler.doCheckView and the VotingHandler.handleEvent.

Throws:
org.apache.sling.api.resource.PersistenceException

cleanupTimedoutVotings

public void cleanupTimedoutVotings(org.apache.sling.api.resource.ResourceResolver resourceResolver)


Copyright © 2007–2014 The Apache Software Foundation. All rights reserved.