com.sun.jini.fiddler
Class FiddlerImpl.DiscardedEventTask

java.lang.Object
  extended by com.sun.jini.fiddler.FiddlerImpl.DiscardedEventTask
All Implemented Interfaces:
TaskManager.Task, Runnable
Enclosing class:
FiddlerImpl

private final class FiddlerImpl.DiscardedEventTask
extends Object
implements TaskManager.Task

This class represents a Task object that is placed in the TaskManager queue for processing in the thread pool. An instance of this class is placed on the task queue when a DiscoveryEvent instance indicating a discarded event is received from the local discovery process.

The run method of this class will process event information resulting from the "discarding" of one or more lookup services (registrars), and will determine to which active registrations the appropriate RemoteDiscoveryEvent should be sent; and then sends that event.


Field Summary
 DiscoveryEvent event
          The local event sent by the discovery manager.
 
Constructor Summary
FiddlerImpl.DiscardedEventTask(DiscoveryEvent event)
          Constructs an instance of this class and stores the event
 
Method Summary
private  HashSet maybeSendDiscardedEvent(FiddlerImpl.RegistrationInfo regInfo, Map groupsMap, boolean active)
          This method determines, based on the current state of the regInfo parameter, whether or not to send a remote discarded event to the regInfo's listener, and then builds and sends the event if appropriate.
 void run()
          This method processes the local discovery event information and determines, based on the current state of each active registration, to which such registration the appropriate RemoteDiscoveryEvent should be sent.
 boolean runAfter(List tasks, int size)
          This method returns true if the current instance of this class must be run after at least one task in the input task list with an index less than the size parameter (size may be less than tasks.size()).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

event

public final DiscoveryEvent event
The local event sent by the discovery manager.

Constructor Detail

FiddlerImpl.DiscardedEventTask

public FiddlerImpl.DiscardedEventTask(DiscoveryEvent event)
Constructs an instance of this class and stores the event

Method Detail

run

public void run()
This method processes the local discovery event information and determines, based on the current state of each active registration, to which such registration the appropriate RemoteDiscoveryEvent should be sent. After making the determination, the remote event appropriate for each registration is constructed and sent.

Specified by:
run in interface Runnable

maybeSendDiscardedEvent

private HashSet maybeSendDiscardedEvent(FiddlerImpl.RegistrationInfo regInfo,
                                        Map groupsMap,
                                        boolean active)
This method determines, based on the current state of the regInfo parameter, whether or not to send a remote discarded event to the regInfo's listener, and then builds and sends the event if appropriate. This method is called in response to one of the following situations:

1 after invocation of the public discard method 2 after receipt of a "passive" discarded event from the discovery manager.

For case 1, such an event typically indicates what is referred to as an "active, communication" discarded event. This term is used in this situation because the regInfo takes the specific action of requesting that a registrar the client has determined is unreachable be discarded.

For case 2, such an event typically indicates what is referred to as a "passive, communication" discarded event. This term is used here because the discovery manager - not the client - has determined that one or more of the previously discovered registrars are now unreachable. In this case, the client remains "passive", and it is the discovery manager that discards the unreachable registrars and notifies the client(s).

Parameters:
regInfo - the data structure record corresponding to the registration whose listener will receive the event
groupsMap - mapping from the registrars referenced in the just-received event to their corresponding set of member groups
active - flag indicating whether the event is an "active" or a "passive" discarded event
Returns:
set of registrars that were discarded for the given regInfo

runAfter

public boolean runAfter(List tasks,
                        int size)
This method returns true if the current instance of this class must be run after at least one task in the input task list with an index less than the size parameter (size may be less than tasks.size()).

Note that using List.get will be more efficient than List.iterator.

Specified by:
runAfter in interface TaskManager.Task
Parameters:
tasks - the tasks to consider. A read-only List, with all elements being an instanceof Task.
size - elements with index less than size should be considered


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.