com.sun.jini.fiddler
Class FiddlerImpl

java.lang.Object
  extended by com.sun.jini.fiddler.FiddlerImpl
All Implemented Interfaces:
DestroyAdmin, Fiddler, FiddlerAdmin, ServiceProxyAccessor, Remote, Administrable, JoinAdmin, ProxyAccessor, ServerProxyTrust
Direct Known Subclasses:
ActivatableFiddlerImpl, NonActivatableFiddlerImpl, TransientFiddlerImpl

 class FiddlerImpl
extends Object
implements ServerProxyTrust, ProxyAccessor, Fiddler

This class is the server side of an implementation of the lookup discovery service. Multiple client-side proxy classes are used to interact and communicate with this backend server. Those proxy classes are: FiddlerProxy (the proxy for the LookupDiscoveryService interface which defines how clients register with the lookup discovery service), FiddlerAdminProxy (the proxy for the FiddlerAdmin interface which specifies the methods through which administration duties such as joining, persistent state logging policy, and shutting down the lookup discovery service can be performed), and FiddlerRegistration (the proxy for the LookupDiscoveryRegistration interface which defines the methods through which clients can perform duties such as group and locator management, state retrieval, and discarding discovered but unavailable lookup services so they are eligible for re-discovery).

It is through the proxies that communicate with this class that clients interact with the lookup discovery service. When a client makes a method invocation on one of the proxies, the proxy makes a corresponding call on the methods specified in the Fiddler interface which are implemented in this class, ultimately executing on the backend server.

Author:
Sun Microsystems, Inc.
Implementation Specifics:
This implementation of the lookup discovery service employs a number of Loggers. The details of each such Logger are described here.

The configuration entries supported by this implementation are described here.


Nested Class Summary
private  class FiddlerImpl.AddGroupsTask
          This class represents a Task object that is placed in the TaskManager queue for processing in the thread pool.
private  class FiddlerImpl.AddLocatorsTask
          This class represents a Task object that is placed in the TaskManager queue for processing in the thread pool.
private  class FiddlerImpl.ChangedEventTask
          This class represents a Task object that is placed in the TaskManager queue for processing in the thread pool.
private  class FiddlerImpl.DestroyThread
          Thread which is used to terminate the current executing instance of the Fiddler implementation of the lookup discovery service.
private  class FiddlerImpl.DiscardedEventTask
          This class represents a Task object that is placed in the TaskManager queue for processing in the thread pool.
private  class FiddlerImpl.DiscardRegistrarTask
          This class represents a Task object that is placed in the TaskManager queue for processing in the thread pool.
private  class FiddlerImpl.DiscoveredEventTask
          This class represents a Task object that is placed in the TaskManager queue for processing in the thread pool.
private static class FiddlerImpl.FiddlerStatus
          Class which is used to communicate the status of this service to interested entities.
private static class FiddlerImpl.GroupsAddedToRegistrationLogObj
          LogObj class whose instances are recorded to the log file whenever the managed set of groups corresponding to a registration is is augmented with new elements.
private static class FiddlerImpl.GroupsRemovedFromRegistrationLogObj
          LogObj class whose instances are recorded to the log file whenever one or more elements of the managed set of groups corresponding to a registration are removed.
private static class FiddlerImpl.GroupsSetInRegistrationLogObj
          LogObj class whose instances are recorded to the log file whenever a the managed set of groups corresponding to a registration is is replaced (set) with a new set of group names.
private static class FiddlerImpl.LeaseBoundSetLogObj
          LogObj class whose instances are recorded to the log file whenever a new value is assigned to the least upper bound applied during the determination of the duration of the lease on a requested registration.
private static class FiddlerImpl.LeaseCancelledLogObj
          LogObj class whose instances are recorded to the log file whenever a lease on an existing registration (granted by the current backend server of the lookup discovery service -- the lease grantor) is cancelled.
private  class FiddlerImpl.LeaseExpireThread
          Thread which is used to monitor the current leases in effect and cancel (expire) those leases with expiration times that have exceeded the current time.
private static class FiddlerImpl.LeaseRenewedLogObj
          LogObj class whose instances are recorded to the log file whenever a lease on an existing registration (granted by the current backend server of the lookup discovery service -- the lease grantor) is renewed.
private static class FiddlerImpl.LeasesCancelledLogObj
          LogObj class whose instances are recorded to the log file whenever a set of leases from a LeaseMap are cancelled.
private static class FiddlerImpl.LeasesRenewedLogObj
          LogObj class whose instances are recorded to the log file whenever a set of leases from a LeaseMap are renewed.
private  class FiddlerImpl.LocalLogHandler
          Handler class for the persistent storage facility.
protected  class FiddlerImpl.LocatorGroupsStruct
          Data structure - associated with a ServiceRegistrar - containing the LookupLocator and the member groups of the registrar
private static class FiddlerImpl.LocsAddedToRegistrationLogObj
          LogObj class whose instances are recorded to the log file whenever the managed set of locators corresponding to a registration is is augmented with new elements.
private static class FiddlerImpl.LocsRemovedFromRegistrationLogObj
          LogObj class whose instances are recorded to the log file whenever one or more elements of the managed set of locators corresponding to a registration are removed.
private static class FiddlerImpl.LocsSetInRegistrationLogObj
          LogObj class whose instances are recorded to the log file whenever the managed set of locators corresponding to a registration is is replaced (set) with a new set of locators.
private static interface FiddlerImpl.LogRecord
          Interface defining the method(s) that must be implemented by each of the concrete LogObj classes.
private static class FiddlerImpl.LookupAttrsAddedLogObj
          LogObj class whose instances are recorded to the log file whenever new attributes are added to this service's existing set of attributes.
private static class FiddlerImpl.LookupAttrsModifiedLogObj
          LogObj class whose instances are recorded to the log file whenever the attributes currently associated with this service in the lookup services with which it is registered are modified.
private  class FiddlerImpl.LookupDiscoveryListener
          Class whose discovered() method is invoked by threads in the LookupDiscovery class whenever a new lookup service is discovered on behalf of a client registration
private static class FiddlerImpl.LookupGroupsChangedLogObj
          LogObj class whose instances are recorded to the log file whenever the set containing the names of the groups whose members are lookup services the lookup discovery service wishes to register with (join) is modified in some way; for example, through the invocation of: JoinAdmin.addLookupGroups, JoinAdmin.removeLookupGroups or JoinAdmin.setLookupGroups.
private static class FiddlerImpl.LookupLocatorsChangedLogObj
          LogObj class whose instances are recorded to the log file whenever the set containing the instances of LookupLocator that correspond to specific lookup services the lookup discovery service wishes to register with (join) is modified in some way; for example, through the invocation of: JoinAdmin.addLookupLocators, JoinAdmin.removeLookupLocators or JoinAdmin.setLookupLocators.
private  class FiddlerImpl.NewRegistrationTask
          This class represents a Task object that is placed in the TaskManager queue for processing in the thread pool.
private static class FiddlerImpl.RegistrationGrantedLogObj
          LogObj class whose instances are recorded to the log file whenever a registration is created and returned to a client.
private static class FiddlerImpl.RegistrationInfo
          This class acts as a record of one registration with the lookup discovery service; containing all of the information about that registration.
private  class FiddlerImpl.RemoveGroupsTask
          This class represents a Task object that is placed in the TaskManager queue for processing in the thread pool.
private  class FiddlerImpl.RemoveLocatorsTask
          This class represents a Task object that is placed in the TaskManager queue for processing in the thread pool.
private  class FiddlerImpl.SendEventTask
          This class represents a Task object that is placed in the TaskManager queue for processing in the thread pool.
private  class FiddlerImpl.SetGroupsTask
          This class represents a Task object that is placed in the TaskManager queue for processing in the thread pool.
private  class FiddlerImpl.SetLocatorsTask
          This class represents a Task object that is placed in the TaskManager queue for processing in the thread pool.
private  class FiddlerImpl.SnapshotThread
          Snapshot-taking thread.
private static class FiddlerImpl.SnapshotThresholdSetLogObj
          LogObj class whose instances are recorded to the log file whenever a new value is assigned to the Threshold used in the "time-to-take-a-snapshot determination" expression.
private static class FiddlerImpl.SnapshotWeightSetLogObj
          LogObj class whose instances are recorded to the log file whenever a new value is assigned to the Weight Factor applied to the Snapshot File size used in the "time-to-take-a-snapshot determination" expression.
 
Field Summary
private  ActivationID activationID
          The activation id of the current instance of the lookup discovery service, if it happens to be and activatable instance
private  ActivationSystem activationSystem
           
private  FiddlerAdminProxy adminProxy
          The admin proxy to this server
private  HashMap allDiscoveredRegs
          Map from the set of all currently discovered registrars to their corresponding [locator,member groups] pairs (locatorGroupsStuct).
private static String COMPONENT_NAME
           
private  ReadersWriter concurrentObj
          Concurrent object to control read and write access
private  Configuration config
           
private  long curEventID
          For each registration created by the lookup discovery service, an event identifier that uniquely maps the registration to the registration's listener and managed sets will be generated and associated with the registration through the EventRegistration field of the registrationInfo.
(package private) static Logger discardLogger
           
private  FiddlerImpl.LookupDiscoveryListener discoveryListener
          The listener registered for both group discovery events and locator discovery events.
private  LookupDiscoveryManager discoveryMgr
          Performs all group and locator discovery on behalf of clients
(package private) static Logger eventsLogger
           
(package private) static Logger groupsLogger
           
private  boolean initialStartup
           
private  Fiddler innerProxy
          The inner proxy (stub or dynamic proxy) to this server
private  boolean inRecovery
          Flag indicating whether system is in a state of recovery
private  JoinManager joinMgr
          Manager for discovering and registering with lookup services
private  DiscoveryManagement joinMgrLDM
          The lookup discovery manager this service's join manager will use
private  long leaseBound
          least upper bound applied to all granted lease durations
private  Thread leaseExpireThread
          Registration lease expiration thread
private  Object leaseExpireThreadSyncObj
          Object for synchronizing with the registration expire thread
(package private) static Logger leaseLogger
           
private  long leaseMax
           
private  LifeCycle lifeCycle
          Object that, if non-null, will cause the object's unregister method to be invoked during service shutdown to notify the service starter framework that the reference to this service's implementation can be 'released' for garbage collection; the framework is notified that it does not have to hold on to the service reference any longer.
private static ProxyPreparer listenerPreparer
           
(package private) static Logger locatorsLogger
           
private static ProxyPreparer locatorToDiscoverPreparer
           
private static ProxyPreparer locatorToJoinPreparer
           
private  ReliableLog log
          Reliable log object to hold persistent state of the service.
private static int LOG_VERSION
          Log format version
private  int logFileSize
          Current number of records in the Log File since the last snapshot
private  LoginContext loginContext
           
private static String MANUFACTURER
           
private static long MAX_LEASE
          When re-setting the bound on lease durations, that bound cannot be set to a value larger than this value
private  long minExpiration
          Earliest expiration time over all active registrations
private  FiddlerProxy outerProxy
          The outer (smart) proxy to this server
private  String persistDir
          The name of the directory to which the persistent modes of this service will log the service's state (using ReliableLog).
(package private) static Logger persistLogger
           
(package private) static Logger problemLogger
           
private static String PRODUCT
           
private  Uuid proxyID
          The unique identifier generated (or recovered) when an instance of this service is constructed.
private  ReadyState readyState
          Object used to prevent access to this service during the service's initialization or shutdown processing.
private static ProxyPreparer recoveredListenerPreparer
           
private static ProxyPreparer recoveredLocatorToDiscoverPreparer
           
private static ProxyPreparer recoveredLocatorToJoinPreparer
           
private  HashMap registrationByID
          Map from registrationID to registrationInfo.
private  TreeMap registrationByTime
          Map from registrationInfo to registrationInfo (that is, to itself), where the elements of the map are ordered by lease expiration time.
(package private) static Logger registrationLogger
           
private  Exporter serverExporter
           
private  ServiceID serviceID
          The service ID associated with this service when it is registered with any lookup service.
private  Thread snapshotThread
          Snapshot-taking thread
private  Object snapshotThreadSyncObj
          Object on which the snapshot-taking thread will synchronize
private  int snapshotThresh
          Log File must contain this many records before snapshot allowed
private  float snapshotWt
          Weight factor applied to snapshotSize when deciding to take snapshot
(package private) static Logger startupLogger
           
private  TaskManager taskMgr
          Task manager for sending remote discovery events
(package private) static Logger tasksLogger
           
private  Entry[] thisServicesAttrs
          The attributes to use when joining lookup service(s)
private  String[] thisServicesGroups
          Groups whose members are lookup services this service should join.
private  LookupLocator[] thisServicesLocators
          Locators of specific lookup services this service should join.
private static String VENDOR
           
private static String VERSION
           
 
Constructor Summary
FiddlerImpl(ActivationID activationID, MarshalledObject data)
          Constructs a new instance of FiddlerImpl.
FiddlerImpl(String[] configArgs, LifeCycle lifeCycle, boolean persistent)
          Constructs a new instance of FiddlerImpl.
 
Method Summary
 void addGroups(Uuid registrationID, String[] groups)
          This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.
private  void addGroupsDo(FiddlerImpl.RegistrationInfo regInfo, String[] groups)
          Called by the public method addGroups.
private  void addGroupsDo(Uuid registrationID, HashMap registrationByID, String[] groups)
          Called by the apply method of the class GroupsAddedToRegistrationLogObj (which is invoked during state recovery).
 void addLocators(Uuid registrationID, LookupLocator[] locators)
          This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.
private  void addLocatorsDo(FiddlerImpl.RegistrationInfo regInfo, LookupLocator[] locators)
          Called by the public method addLocators.
private  void addLocatorsDo(Uuid registrationID, HashMap registrationByID, LookupLocator[] locators)
          Called by the apply method of the class LocsAddedToRegistrationLogObj (which is invoked during state recovery).
private  void addLogRecord(FiddlerImpl.LogRecord rec)
          Add a state-change record to persistent storage.
 void addLookupAttributes(Entry[] attrSets)
          Adds attribute sets to the current set of attributes associated with the lookup discovery service.
 void addLookupGroups(String[] groups)
          Add new names to the set consisting of the names of groups whose members are lookup services the lookup discovery service wishes to register with (join).
 void addLookupLocators(LookupLocator[] locators)
          Add a set of LookupLocator objects to the lookup discovery service's managed set of locators.
private  void addRegistration(FiddlerImpl.RegistrationInfo regInfo)
          Places the registration corresponding to the regInfo parameter in both the registrationByID map and the registrationByTime map.
private static Object[] appendArray(Object[] array, Object elt)
          Return a new array containing the elements of the input array parameter with the input element parameter appended to the end of the array.
private static long applyBoundToLeaseDuration(long leaseDuration, long bound)
          Bounds the duration by the value of the bound parameter, and checks for negative value.
private  RemoteDiscoveryEvent buildEvent(FiddlerImpl.RegistrationInfo regInfo, Map groupsMap, boolean discarded)
          This method constructs the appropriate remote discovery event from the information contained in the input parameters.
 void cancelLease(Uuid registrationID, Uuid leaseID)
          This method is the "backend" server counterpart to the cancel method specified by the Lease interface and implemented in the FiddlerLease class; an instance of which is returned by the getLease method of the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.
private  void cancelLeaseDo(FiddlerImpl.RegistrationInfo regInfo, Uuid leaseID)
          Called by the public method cancelLease.
private  void cancelLeaseDo(Uuid registrationID, HashMap registrationByID, Uuid leaseID)
          Called by the apply method of the class LeaseCancelledLogObj (which is invoked during state recovery).
 Exception[] cancelLeases(Uuid[] registrationIDs, Uuid[] leaseIDs)
          Cancels all leases from a LeaseMap.
private  Exception[] cancelLeasesDo(Uuid[] registrationIDs, Uuid[] leaseIDs)
          Called by the public method cancelLeases to the cancel all of the leases from a LeaseMap that correspond to the elements of the registrationIDs and leaseIDs parameters.
private  void cleanupInitFailure()
           
private static boolean containsNullElement(Object[] arr)
          Determines if any element in the input array is null.
 void destroy()
          Destroy the lookup discovery service, if possible, including its persistent storage.
private  void destroyDo()
          Called by the public method destroy as well as by the apply method in the various LogObj classes that, during recovery, modify the managed sets of the discovery manager; and, while doing so, experience an IOException when the multicast request protocol fails to start during recovery (an un-recoverable exception).
 void discard(Uuid registrationID, ServiceRegistrar registrar)
          This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.
private  void doInit(Configuration config, boolean persistent)
          Initialization common to all modes in which instances of this service runs: activatable/persistent, non-activatable/persistent, and transient (non-activatable /non-persistent).
private  FiddlerImpl.RegistrationInfo externalDiscardRequest()
          Examines the discardFlag for each active registration until a value of true is encountered or the set of registrations is exhausted.
 Object getAdmin()
          Returns a proxy to the current instance of this class through which a client may administer the lookup discovery service
private  HashMap getDesiredRegsByGroup(FiddlerImpl.RegistrationInfo regInfo)
          This method returns a registrar-to-data-structure map in which each registrar key in the returned map is one of the keys from the the global map allDiscoveredRegs, and the corresponding value is the (locator,groups) pair that corresponds to that registrar key in allDiscoveredRegs An element of allDiscoveredRegs is selected to have its registrar and associated (locator,groups) pair be included in the returned mapping if and only if the key value of the element is a registrar that belongs to at least one of the desired groups of the given registration (regInfo parameter).
private  HashMap getDesiredRegsByLocator(FiddlerImpl.RegistrationInfo regInfo)
          This method returns a registrar-to-data-structure map in which each registrar key in the returned map is one of the keys from the the global map allDiscoveredRegs, and the corresponding value is the (locator,groups) pair that corresponds to that registrar key in allDiscoveredRegs An element of allDiscoveredRegs is selected to have its registrar and associated (locator,groups) pair be included in the returned mapping if and only if the key value under consideration is a registrar whose locator equals one of the desired locators of the given registration (regInfo parameter).
 String[] getGroups(Uuid registrationID)
          This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.
private  String[] getGroupsFromAllRegs()
          Builds a set containing the groups from all registrations.
 long getLeaseBound()
          Retrieves the least upper bound applied to all lease durations granted by the lookup discovery service.
 LookupLocator[] getLocators(Uuid registrationID)
          This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.
private  LookupLocator[] getLocatorsFromAllRegs()
          Builds a set containing the locators from all registrations.
 Entry[] getLookupAttributes()
          Returns the current attribute sets for the lookup discovery service.
 String[] getLookupGroups()
          Get the names of the groups whose members are lookup services the lookup discovery services wishes to register with (join).
 LookupLocator[] getLookupLocators()
          Get the lookup discovery service's managed set of locators.
 int getPersistenceSnapshotThreshold()
          Retrieve the value of the size threshold of the snapshot; which is employed by the lookup discovery service in the test to determine whether or not to take a "snapshot" of the system state.
 float getPersistenceSnapshotWeight()
          Retrieve the weight factor applied by the lookup discovery service to the snapshot size during the test to determine whether or not to take a "snapshot" of the system state.
 Object getProxy()
          Public method that facilitates the use of the mechanism provided by ServiceStarter to create an activatable instance of this server.
 Uuid getProxyID()
          Returns the unique identifier generated (or recovered) by the backend implementation of the lookup discovery service when an instance of that service is constructed.
 TrustVerifier getProxyVerifier()
          Returns a TrustVerifier specific to this service which can be used to verify that a given proxy to this service can be trusted.
 MarshalledObject[] getRegistrars(Uuid registrationID)
          This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.
 Object getServiceProxy()
          Public method that facilitates the use of the mechanism provided by ServiceStarter to create an activatable instance of this server.
private static HashMap getUndesiredRegsByGroup(Map regMap, FiddlerImpl.RegistrationInfo regInfo)
          This method returns a mapping in which the key values are registrars, and the map values are the member groups of the corresponding registrar key.
private static Map getUndesiredRegsByLocator(Map regMap, FiddlerImpl.RegistrationInfo regInfo)
          This method returns a subset of the given registrar-to-locators mapping (regMap).
private  void handleActivatableInitThrowable(Throwable t)
           
private  void handleInitThrowable(Throwable t)
           
private  void init(String[] configArgs, boolean persistent)
          Common entry point for initialization of the service in any of its possible modes: transient, non-activatable-persistent, or activatable-persistent; with or without performing a JAAS login.
private  void initWithLogin(Configuration config, boolean persistent, LoginContext loginContext)
          Initialization with JAAS login as the Subject referenced in the given loginContext.
private static boolean interested(LookupLocator regLoc, String[] regGroups, Set desiredLocators, Set desiredGroups)
          This method determines if a particular registration (regInfo) is interested in discovering, through either locator discovery or group discovery, the registrar having a given locator and belonging to a given set of member groups.
private static boolean interested(String[] regGroups, Set desiredGroups)
          This method determines if a particular registration (regInfo) is interested in discovering, through group discovery, the registrar belonging to a given set of member groups.
private  ServiceRegistrar[] intersectRegSets(ServiceRegistrar[] regs0, ServiceRegistrar[] regs1)
          Returns the set of registrars common to both input parameters
private static boolean locSetContainsLoc(Set locSet, LookupLocator loc)
          Searches the given set of locators for the given individual locator, returning true if the indicated locator is found in the set; false otherwise.
private  void logInfoAddLogRecord(FiddlerImpl.LogRecord rec)
           
private  void logInfoDiscard(String str)
           
private  void logInfoDiscard(String str, Uuid regID)
           
private  void logInfoEvents(Map groupsMap, long eventID, long seqNum, MarshalledObject handback, boolean discarded, Logger logger, Level level)
           
private  void logInfoEvents(String str)
           
private  void logInfoGroups()
           
private  void logInfoGroups(String headerStr)
           
private  void logInfoLease(String str, Uuid regID, Uuid leaseID)
           
private  void logInfoLocators()
           
private static void logInfoPersist(String str)
           
private  void logInfoRegistration(String str, Object regInfo)
           
private  void logInfoShutdown()
           
private  void logInfoStartup()
           
private  void logInfoTasks(String str)
           
private  HashMap mapRegToGroups(ServiceRegistrar reg, String[] groups)
          Convenience method that creates and returns a mapping of a single ServiceRegistrar instance to a set of groups.
private static MarshalledObject[] marshalAttributes(FiddlerImpl fiddlerImpl, Entry[] attrs)
          Marshals each element of the Entry[] array parameter.
private  void maybeRemoveDiscardedRegFromGlobalSet(Object dReg)
          Given a registrar that has just been discarded, this method determines if that registrar is contained in none of the discovered sets of the active registrations; and then removes that registrar from the global maps of registrars that are maintained across all registrations.
private  void maybeRemoveDiscardedRegsFromGlobalSet(Set discardedRegs)
          Given a set of registrars that have just been discarded, this method determines which of those registrars are contained in none of the discovered sets of the active registrations; and then removes those registrars from the global maps of registrars that are maintained across all registrations.
private  void maybeSendDiscoveredEvent(FiddlerImpl.RegistrationInfo regInfo, Map regsMap)
          This method determines which of the registrars in the regsMap parameter belong to the set of registrars the given regInfo parameter wishes to discover.
 void modifyLookupAttributes(Entry[] attrSetTemplates, Entry[] attrSets)
          Modifies the current set of attributes associated with the lookup discovery service.
private static void prepareNewLocators(ProxyPreparer preparer, LookupLocator[] locators)
          Using the given ProxyPreparer, attempts to prepare each element of the given LookupLocator array; replacing the original element of the array with the result of the call to the method ProxyPreparer.prepareProxy.
private static LookupLocator[] prepareOldLocators(ProxyPreparer preparer, LookupLocator[] locators)
          Using the given ProxyPreparer, attempts to prepare each element of the given LookupLocator array; and returns a new array containing the prepared locators.
private static Set prepareOldLocators(ProxyPreparer preparer, Set locators)
          Using the given ProxyPreparer, attempts to prepare each element of the given Set of LookupLocator instances; and returns a new Set containing the prepared locators.
private  void queueEvent(FiddlerImpl.RegistrationInfo regInfo, RemoteDiscoveryEvent event)
          This method simply queues a new SendEventTask instance that will send the given remote event to the given registration's listener.
private  void recoverSnapshot(InputStream in)
          Retrieve the contents of the snapshot file and reconstitute the 'base' state of this service from the retrieved data.
private  boolean regIsElementOfRegSet(ServiceRegistrar reg, ServiceRegistrar[] regSet)
          Returns true if the input registrar is an element of the given array
 LookupDiscoveryRegistration register(String[] groups, LookupLocator[] locators, RemoteEventListener listener, MarshalledObject handback, long leaseDuration)
          Registers with the lookup discovery service.
private  LookupDiscoveryRegistration registerDo(String[] groups, LookupLocator[] locators, RemoteEventListener listener, MarshalledObject handback, long leaseDuration)
          This method is called by the public method register.
 void removeGroups(Uuid registrationID, String[] groups)
          This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.
private  void removeGroupsDo(FiddlerImpl.RegistrationInfo regInfo, String[] groups)
          Called by the public method removeGroups.
private  void removeGroupsDo(Uuid registrationID, HashMap registrationByID, String[] groups)
          Called by the apply method of the class GroupsRemovedFromRegistrationLogObj (which is invoked during state recovery).
 void removeLocators(Uuid registrationID, LookupLocator[] locators)
          This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.
private  void removeLocatorsDo(FiddlerImpl.RegistrationInfo regInfo, LookupLocator[] locators)
          Called by the public method removeLocators.
private  void removeLocatorsDo(Uuid registrationID, HashMap registrationByID, LookupLocator[] locators)
          Called by the apply method of the class LocsRemovedFromRegistrationLogObj (which is invoked during state recovery).
 void removeLookupGroups(String[] groups)
          Remove a set of group names from lookup discovery service's managed set of groups (the set consisting of the names of groups whose members are lookup services the lookup discovery service wishes to join).
 void removeLookupLocators(LookupLocator[] locators)
          Remove a set of LookupLocator objects from the lookup discovery service's managed set of locators.
private  void removeRegistration(FiddlerImpl.RegistrationInfo regInfo)
          Removes the registration corresponding to the regInfo parameter from this service's state.
 long renewLease(Uuid registrationID, Uuid leaseID, long duration)
          This method is the "backend" server counterpart to the renew method specified by the Lease interface, implemented in the com.sun.jini.lease.AbstractLease class, and invoked by way of the doRenew method of the FiddlerLease class; an instance of which is returned by the getLease method of the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.
private  void renewLeaseAbs(FiddlerImpl.RegistrationInfo regInfo, Uuid leaseID, long expiration)
          This method performs the final steps in the process of renewing the lease on the registration corresponding to the regInfo and leaseID parameters, granting a requested absolute expiration time for that lease.
private  void renewLeaseAbs(Uuid registrationID, HashMap registrationByID, Uuid leaseID, long expiration)
          Called by the apply method of the class LeaseRenewedLogObj (which is invoked during state recovery).
private  long renewLeaseDo(FiddlerImpl.RegistrationInfo regInfo, Uuid leaseID, long duration)
          Called by the public method renewLease.
private  long renewLeaseInt(FiddlerImpl.RegistrationInfo regInfo, Uuid leaseID, long duration, long curTime)
          Called by the method renewLeaseDo.
 FiddlerRenewResults renewLeases(Uuid[] registrationIDs, Uuid[] leaseIDs, long[] durations)
          This methods renews all leases from a LeaseMap, where each element of the map is a lease on a registration with ID corresponding to an element of the registrationIDs parameter.
private  void renewLeasesAbs(Uuid[] registrationIDs, Uuid[] leaseIDs, long[] expirations)
          Using the absolute expiration times contained in the expirations parameter, renews all of the leases from a LeaseMap that correspond to the elements of the registrationIDs and leaseIDs parameters; skipping any negative expiration times.
private  FiddlerRenewResults renewLeasesDo(Uuid[] registrationIDs, Uuid[] leaseIDs, long[] durations)
          Called by the public method renewLeases to renew all of the leases from a LeaseMap that correspond to the elements of the registrationIDs and leaseIDs parameters, granting as new durations the corresponding elements of the duration parameter.
 void setGroups(Uuid registrationID, String[] groups)
          This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.
private  void setGroupsDo(FiddlerImpl.RegistrationInfo regInfo, String[] groups)
          Called by the public method setGroups.
private  void setGroupsDo(Uuid registrationID, HashMap registrationByID, String[] groups)
          Called by the apply method of the class GroupsSetInRegistrationLogObj (which is invoked during state recovery).
 void setLeaseBound(long newBound)
          Changes the least upper bound applied to all lease durations granted by the lookup discovery service.
 void setLocators(Uuid registrationID, LookupLocator[] locators)
          This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.
private  void setLocatorsDo(FiddlerImpl.RegistrationInfo regInfo, LookupLocator[] locators)
          Called by the public method setLocators.
private  void setLocatorsDo(Uuid registrationID, HashMap registrationByID, LookupLocator[] locators)
          Called by the apply method of the class LocsSetInRegistrationLogObj (which is invoked during state recovery).
 void setLookupGroups(String[] groups)
          Replace the lookup discovery service's managed set of groups with a new set of group names.
 void setLookupLocators(LookupLocator[] locators)
          Replace the lookup discovery service's managed set of locators with a new set of locators.
 void setPersistenceSnapshotThreshold(int threshold)
          Change the value of the size threshold of the snapshot; which is employed by the lookup discovery service in the test to determine whether or not to take a "snapshot" of the system state.
 void setPersistenceSnapshotWeight(float weight)
          Change the weight factor applied by the lookup discovery service to the snapshot size during the test to determine whether or not to take a "snapshot" of the system state.
private  void takeSnapshot(OutputStream out)
          Writes the current state of this service to persistent storage.
private static Entry[] unmarshalAttributes(FiddlerImpl fiddlerImpl, MarshalledObject[] marshalledAttrs)
          Unmarshals each element of the MarshalledObject[] array parameter.
private  void updateDiscoveryMgrGroups()
          Modifies the discovery manager's managed set of groups in the appropriate way; that is, adds to the discovery manager's managed set of groups, any new groups-of-interest, across all registrations, and removes any groups that are no longer of interest to any of the registrations.
private  void updateDiscoveryMgrLocators()
          Modifies the discovery manager's managed set of locators in the appropriate way; that is, adds to the discovery manager's managed set of locators, any new locators-of-interest, across all registrations, and removes any locators that are no longer of interest to any of the registrations.
private  void updateGroupsInGlobalSet(Map groupsMap)
          For each registrar referenced in the global map allDiscoveredRegs, this method replaces the associated set of member groups with the corresponding set in the given registrars-to-groups map.
private static void writeArrayElements(Object[] arr, Logger logger, Level level)
           
private static String writeArrayElementsToString(Object[] arr)
           
private static void writeAttribute(Entry attr, Logger logger, Level level)
           
private static void writeAttributes(Entry[] attrs, Logger logger, Level level)
           
private static void writeGroupArray(String[] groups, Logger logger, Level level)
           
private static String writeGroupArrayToString(String[] groups)
           
private static void writeRegistrarsArray(ServiceRegistrar[] regs, Logger logger, Level level)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPONENT_NAME

private static final String COMPONENT_NAME
See Also:
Constant Field Values

problemLogger

static final Logger problemLogger

startupLogger

static final Logger startupLogger

tasksLogger

static final Logger tasksLogger

eventsLogger

static final Logger eventsLogger

groupsLogger

static final Logger groupsLogger

locatorsLogger

static final Logger locatorsLogger

discardLogger

static final Logger discardLogger

leaseLogger

static final Logger leaseLogger

registrationLogger

static final Logger registrationLogger

persistLogger

static final Logger persistLogger

PRODUCT

private static final String PRODUCT
See Also:
Constant Field Values

MANUFACTURER

private static final String MANUFACTURER
See Also:
Constant Field Values

VENDOR

private static final String VENDOR
See Also:
Constant Field Values

VERSION

private static final String VERSION
See Also:
Constant Field Values

MAX_LEASE

private static final long MAX_LEASE
When re-setting the bound on lease durations, that bound cannot be set to a value larger than this value

See Also:
Constant Field Values

LOG_VERSION

private static final int LOG_VERSION
Log format version

See Also:
Constant Field Values

outerProxy

private FiddlerProxy outerProxy
The outer (smart) proxy to this server


innerProxy

private Fiddler innerProxy
The inner proxy (stub or dynamic proxy) to this server


adminProxy

private FiddlerAdminProxy adminProxy
The admin proxy to this server


serviceID

private ServiceID serviceID
The service ID associated with this service when it is registered with any lookup service.


activationID

private ActivationID activationID
The activation id of the current instance of the lookup discovery service, if it happens to be and activatable instance


activationSystem

private ActivationSystem activationSystem

proxyID

private Uuid proxyID
The unique identifier generated (or recovered) when an instance of this service is constructed. This ID is typically used to determine equality between the proxies of any two instances of this service.


allDiscoveredRegs

private final HashMap allDiscoveredRegs
Map from the set of all currently discovered registrars to their corresponding [locator,member groups] pairs (locatorGroupsStuct).


registrationByID

private final HashMap registrationByID
Map from registrationID to registrationInfo. Every registration is in this map under its registrationID.


registrationByTime

private final TreeMap registrationByTime
Map from registrationInfo to registrationInfo (that is, to itself), where the elements of the map are ordered by lease expiration time.


discoveryMgr

private LookupDiscoveryManager discoveryMgr
Performs all group and locator discovery on behalf of clients


discoveryListener

private final FiddlerImpl.LookupDiscoveryListener discoveryListener
The listener registered for both group discovery events and locator discovery events.


curEventID

private long curEventID
For each registration created by the lookup discovery service, an event identifier that uniquely maps the registration to the registration's listener and managed sets will be generated and associated with the registration through the EventRegistration field of the registrationInfo. This event ID is unique across all registrations with the current instance of the lookup discovery service.


minExpiration

private long minExpiration
Earliest expiration time over all active registrations


joinMgrLDM

private DiscoveryManagement joinMgrLDM
The lookup discovery manager this service's join manager will use


joinMgr

private JoinManager joinMgr
Manager for discovering and registering with lookup services


taskMgr

private TaskManager taskMgr
Task manager for sending remote discovery events


leaseExpireThread

private Thread leaseExpireThread
Registration lease expiration thread


snapshotThread

private Thread snapshotThread
Snapshot-taking thread


concurrentObj

private final ReadersWriter concurrentObj
Concurrent object to control read and write access


leaseExpireThreadSyncObj

private final Object leaseExpireThreadSyncObj
Object for synchronizing with the registration expire thread


snapshotThreadSyncObj

private final Object snapshotThreadSyncObj
Object on which the snapshot-taking thread will synchronize


log

private ReliableLog log
Reliable log object to hold persistent state of the service. This object is also used as a flag: non-null ==> persistent service null ==> non-persistent service


inRecovery

private boolean inRecovery
Flag indicating whether system is in a state of recovery


logFileSize

private int logFileSize
Current number of records in the Log File since the last snapshot


persistDir

private String persistDir
The name of the directory to which the persistent modes of this service will log the service's state (using ReliableLog).


leaseBound

private long leaseBound
least upper bound applied to all granted lease durations


snapshotWt

private float snapshotWt
Weight factor applied to snapshotSize when deciding to take snapshot


snapshotThresh

private int snapshotThresh
Log File must contain this many records before snapshot allowed


thisServicesGroups

private String[] thisServicesGroups
Groups whose members are lookup services this service should join. Unless configured otherwise, this service will initially join the un-named public group. The desired join groups for this service can be set administratively after start up.


thisServicesLocators

private LookupLocator[] thisServicesLocators
Locators of specific lookup services this service should join. This service will initially join no lookups found through locator discovery. The locators of the specific lookup services that are desired for this service to join should be set administratively after start up.


thisServicesAttrs

private Entry[] thisServicesAttrs
The attributes to use when joining lookup service(s)


config

private Configuration config

loginContext

private LoginContext loginContext

serverExporter

private Exporter serverExporter

leaseMax

private long leaseMax

initialStartup

private boolean initialStartup

lifeCycle

private LifeCycle lifeCycle
Object that, if non-null, will cause the object's unregister method to be invoked during service shutdown to notify the service starter framework that the reference to this service's implementation can be 'released' for garbage collection; the framework is notified that it does not have to hold on to the service reference any longer. Note hat this object is used only in the non-activatable case.


listenerPreparer

private static ProxyPreparer listenerPreparer

recoveredListenerPreparer

private static ProxyPreparer recoveredListenerPreparer

locatorToJoinPreparer

private static ProxyPreparer locatorToJoinPreparer

recoveredLocatorToJoinPreparer

private static ProxyPreparer recoveredLocatorToJoinPreparer

locatorToDiscoverPreparer

private static ProxyPreparer locatorToDiscoverPreparer

recoveredLocatorToDiscoverPreparer

private static ProxyPreparer recoveredLocatorToDiscoverPreparer

readyState

private final ReadyState readyState
Object used to prevent access to this service during the service's initialization or shutdown processing.

Constructor Detail

FiddlerImpl

FiddlerImpl(ActivationID activationID,
            MarshalledObject data)
      throws IOException,
             ActivationException,
             ConfigurationException,
             LoginException,
             ClassNotFoundException
Constructs a new instance of FiddlerImpl. This version of the constructor is used to create an activatable instance of the lookup discovery service that logs its state information to persistent storage.

A constructor having this signature is required for the class to be activatable. This constructor is automatically called by the activation group when the lookup discovery service is activated.

Parameters:
activationID - the activation ID generated by the activation system and assigned to the instance of the server being activated
data - state data (represented as a MarshalledObject) which is needed to re-activate this server
Throws:
IOException - this exception can occur when there is a problem recovering data from disk, exporting the server that's being activated, or when unmarshalling the given data parameter.
ConfigurationException - this exception can occur when a problem occurs while retrieving an item from the Configuration generated from the contents of the given data parameter
ActivationException - this exception can occur when a problem occurs while activating the service
LoginException - this exception occurs when authentication fails while performing a JAAS login for this service
ClassNotFoundException - this exception can occur while unmarshalling the given data parameter; when a class needed in the unmarshalling process cannot be found.
ClassCastException - this exception can occur while unmarshalling the given data parameter; when the contents of that parameter is not a String array.

FiddlerImpl

FiddlerImpl(String[] configArgs,
            LifeCycle lifeCycle,
            boolean persistent)
      throws IOException,
             ConfigurationException,
             LoginException
Constructs a new instance of FiddlerImpl. This version of the constructor is used to create a NON-activatable instance of the lookup discovery service.

Parameters:
configArgs - String array whose elements are the arguments to use when creating this version of the server
lifeCycle - instance of LifeCycle that, if non-null, will cause this object's unregister method to be invoked during shutdown to notify the service starter framework that the reference to this service's implementation can be 'released' for garbage collection. A value of null for this argument is allowed.
persistent - if true, then the service should persist its state.
Throws:
IOException - this exception can occur when there is a problem recovering data from disk, or while exporting the server that's being created.
ConfigurationException - this exception can occur when an problem occurs while retrieving an item from the Configuration generated from the contents of the given configArgs parameter
LoginException - this exception occurs when authentication fails while performing a JAAS login for this service
Method Detail

getProxyVerifier

public TrustVerifier getProxyVerifier()
                               throws NoSuchObjectException
Returns a TrustVerifier specific to this service which can be used to verify that a given proxy to this service can be trusted.

The verifier returned by this method contains the method isTrustedObject. That method can be called with a candidate proxy as the first argument, and TrustVerifier.Context as the second argument. When called in this way, the isTrustedObject determines whether or not the input proxy is trusted. Thus, the verifier returned by this method should be able to verify as trusted, all proxies to this service; including proxies such as leases, event registrations, and administrative proxies.

Specified by:
getProxyVerifier in interface ServerProxyTrust
Returns:
a TrustVerifier which can be used to verify that a given proxy to this service can be trusted.
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
UnsupportedOperationException - if the server proxy does not implement both RemoteMethodControl and TrustEquivalence
See Also:
ServerProxyTrust.getProxyVerifier()

getProxy

public Object getProxy()
Public method that facilitates the use of the mechanism provided by ServiceStarter to create an activatable instance of this server.

Specified by:
getProxy in interface ProxyAccessor
Returns:
the inner proxy (stub or dynamic proxy) for the server

getAdmin

public Object getAdmin()
                throws NoSuchObjectException,
                       RemoteException
Returns a proxy to the current instance of this class through which a client may administer the lookup discovery service

Specified by:
getAdmin in interface Administrable
Returns:
a proxy object through which the lookup discovery service may be administered.
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the server. see com.sun.jini.fiddler.FiddlerAdminProxy#getAdmin (?)
See Also:
Administrable.getAdmin()

getLookupAttributes

public Entry[] getLookupAttributes()
                            throws NoSuchObjectException,
                                   RemoteException
Returns the current attribute sets for the lookup discovery service.

Specified by:
getLookupAttributes in interface JoinAdmin
Returns:
array of net.jini.core.entry.Entry containing the current attribute sets for the lookup discovery service
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service.
See Also:
FiddlerAdminProxy.getLookupAttributes(), JoinAdmin.getLookupAttributes()

addLookupAttributes

public void addLookupAttributes(Entry[] attrSets)
                         throws NoSuchObjectException,
                                RemoteException
Adds attribute sets to the current set of attributes associated with the lookup discovery service. The resulting set will be used for all future registrations with lookup services. The new attribute sets are also added to the lookup discovery service's attributes on each lookup service with which the lookup discovery service is currently registered.

Specified by:
addLookupAttributes in interface JoinAdmin
Parameters:
attrSets - array of net.jini.core.entry.Entry containing the attribute sets to add
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the attributes may or may not have been added successfully.
See Also:
FiddlerAdminProxy.addLookupAttributes(net.jini.core.entry.Entry[]), JoinAdmin.addLookupAttributes(net.jini.core.entry.Entry[])

modifyLookupAttributes

public void modifyLookupAttributes(Entry[] attrSetTemplates,
                                   Entry[] attrSets)
                            throws NoSuchObjectException,
                                   RemoteException
Modifies the current set of attributes associated with the lookup discovery service. The resulting set will be used for all future registrations with lookup services. The same modifications are also made to the lookup discovery service's attributes on each lookup service with which the lookup discovery service is currently registered.

Specified by:
modifyLookupAttributes in interface JoinAdmin
Parameters:
attrSetTemplates - array of net.jini.core.entry.Entry containing the templates to use for selecting the attributes (contained within the set of existing attributes) that are to be modified
attrSets - array of net.jini.core.entry.Entry containing the modifications to make to matching sets
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the attributes may or may not have been modified successfully.
See Also:
FiddlerAdminProxy.modifyLookupAttributes(net.jini.core.entry.Entry[], net.jini.core.entry.Entry[]), JoinAdmin.modifyLookupAttributes(net.jini.core.entry.Entry[], net.jini.core.entry.Entry[])

getLookupGroups

public String[] getLookupGroups()
                         throws NoSuchObjectException,
                                RemoteException
Get the names of the groups whose members are lookup services the lookup discovery services wishes to register with (join).

Specified by:
getLookupGroups in interface JoinAdmin
Returns:
String array containing the names of the groups whose members are lookup services the lookup discovery service wishes to join.

If the array returned is empty, the lookup discovery service is configured to join no groups. If null is returned, the lookup discovery service is configured to join all groups.

Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service.
See Also:
FiddlerAdminProxy.getLookupGroups(), JoinAdmin.getLookupGroups()

addLookupGroups

public void addLookupGroups(String[] groups)
                     throws NoSuchObjectException,
                            RemoteException
Add new names to the set consisting of the names of groups whose members are lookup services the lookup discovery service wishes to register with (join). Any lookup services belonging to the new groups that the lookup discovery service has not yet registered with, will be discovered and joined.

Specified by:
addLookupGroups in interface JoinAdmin
Parameters:
groups - String array containing the names of the groups to add
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the group names may or may not have been added successfully.
See Also:
FiddlerAdminProxy.addLookupGroups(java.lang.String[]), JoinAdmin.addLookupGroups(java.lang.String[])

removeLookupGroups

public void removeLookupGroups(String[] groups)
                        throws NoSuchObjectException,
                               RemoteException
Remove a set of group names from lookup discovery service's managed set of groups (the set consisting of the names of groups whose members are lookup services the lookup discovery service wishes to join). Any leases granted to the lookup discovery service by lookup services that are not members of the groups whose names remain in the managed set will be cancelled at those lookup services.

Specified by:
removeLookupGroups in interface JoinAdmin
Parameters:
groups - String array containing the names of the groups to remove
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the group names may or may not have been removed successfully.
See Also:
FiddlerAdminProxy.removeLookupGroups(java.lang.String[]), JoinAdmin.removeLookupGroups(java.lang.String[])

setLookupGroups

public void setLookupGroups(String[] groups)
                     throws NoSuchObjectException,
                            RemoteException
Replace the lookup discovery service's managed set of groups with a new set of group names. Any leases granted to the lookup discovery service by lookup services that are not members of the groups whose names are in the new managed set will be cancelled at those lookup services. Lookup services that are members of groups reflected in the new managed set will be discovered and joined.

Specified by:
setLookupGroups in interface JoinAdmin
Parameters:
groups - String array containing the names of the new groups
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the group names may or may not have been replaced successfully.
See Also:
FiddlerAdminProxy.setLookupGroups(java.lang.String[]), JoinAdmin.setLookupGroups(java.lang.String[])

getLookupLocators

public LookupLocator[] getLookupLocators()
                                  throws NoSuchObjectException,
                                         RemoteException
Get the lookup discovery service's managed set of locators. The managed set of locators is the set of LookupLocator objects corresponding to the specific lookup services with which the lookup discovery service wishes to register (join).

Specified by:
getLookupLocators in interface JoinAdmin
Returns:
array of objects of type net.jini.core.discovery.LookupLocator, each of which corresponds to a specific lookup service the lookup discovery service wishes to join.
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service.
See Also:
FiddlerAdminProxy.getLookupLocators(), JoinAdmin.getLookupLocators()

addLookupLocators

public void addLookupLocators(LookupLocator[] locators)
                       throws NoSuchObjectException,
                              RemoteException
Add a set of LookupLocator objects to the lookup discovery service's managed set of locators. The managed set of locators is the set of LookupLocator objects corresponding to the specific lookup services with which the lookup discovery service wishes to register (join).

Any lookup services corresponding to the new locators that the lookup discovery service has not yet joined, will be discovered and joined.

Specified by:
addLookupLocators in interface JoinAdmin
Parameters:
locators - array of net.jini.core.discovery.LookupLocator objects to add to the managed set of locators
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the new locators may or may not have been added successfully.
See Also:
FiddlerAdminProxy.addLookupLocators(net.jini.core.discovery.LookupLocator[]), JoinAdmin.addLookupLocators(net.jini.core.discovery.LookupLocator[])

removeLookupLocators

public void removeLookupLocators(LookupLocator[] locators)
                          throws NoSuchObjectException,
                                 RemoteException
Remove a set of LookupLocator objects from the lookup discovery service's managed set of locators. The managed set of locators is the set of LookupLocator objects corresponding to the specific lookup services with which the lookup discovery service wishes to register (join).

Note that any leases granted to the lookup discovery service by lookup services that do not correspond to any of the locators remaining in the managed set will be cancelled at those lookup services.

Specified by:
removeLookupLocators in interface JoinAdmin
Parameters:
locators - array of net.jini.core.discovery.LookupLocator objects to remove from the managed set of locators
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the new locators may or may not have been removed successfully.
See Also:
FiddlerAdminProxy.removeLookupLocators(net.jini.core.discovery.LookupLocator[]), JoinAdmin.removeLookupLocators(net.jini.core.discovery.LookupLocator[])

setLookupLocators

public void setLookupLocators(LookupLocator[] locators)
                       throws NoSuchObjectException,
                              RemoteException
Replace the lookup discovery service's managed set of locators with a new set of locators. The managed set of locators is the set of LookupLocator objects corresponding to the specific lookup services with which the lookup discovery service wishes to register (join).

Note that any leases granted to the lookup discovery service by lookup services whose corresponding locator is removed from the managed set will be cancelled at those lookup services. The lookup services corresponding to the new locators in the managed set will be discovered and joined.

Specified by:
setLookupLocators in interface JoinAdmin
Parameters:
locators - array of net.jini.core.discovery.LookupLocator objects with which to replace the current managed set of locators remove from the managed set of locators
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the locators in the managed set may or may not have been replaced successfully.
See Also:
FiddlerAdminProxy.setLookupLocators(net.jini.core.discovery.LookupLocator[]), JoinAdmin.setLookupLocators(net.jini.core.discovery.LookupLocator[])

destroy

public void destroy()
             throws NoSuchObjectException,
                    RemoteException
Destroy the lookup discovery service, if possible, including its persistent storage. This method will typically spawn a separate thread to do the actual work asynchronously, so a successful return from this method usually does not mean that the service has been destroyed.

Specified by:
destroy in interface DestroyAdmin
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the lookup discovery service may or may not have been successfully destroyed.
See Also:
FiddlerAdminProxy.destroy(), DestroyAdmin.destroy()

setLeaseBound

public void setLeaseBound(long newBound)
                   throws NoSuchObjectException,
                          RemoteException
Changes the least upper bound applied to all lease durations granted by the lookup discovery service.

This method is a mechanism for an entity with the appropriate privileges to administratively change the value of the least upper bound that will be applied by the Fiddler implementation of the lookup discovery service when determining the duration to assign to the lease on a requested registration.

Specified by:
setLeaseBound in interface FiddlerAdmin
Parameters:
newBound - long value representing the new least upper bound (in milliseconds) on the set of all possible lease durations that may be granted
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the bound value may or may not have been changed successfully.
See Also:
FiddlerAdminProxy.setLeaseBound(long), FiddlerAdmin.setLeaseBound(long)

getLeaseBound

public long getLeaseBound()
                   throws NoSuchObjectException,
                          RemoteException
Retrieves the least upper bound applied to all lease durations granted by the lookup discovery service.

Specified by:
getLeaseBound in interface FiddlerAdmin
Returns:
long value representing the current least upper bound (in milliseconds) on the set of all possible lease durations that may be granted
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service.
See Also:
FiddlerAdminProxy.getLeaseBound(), FiddlerAdmin.getLeaseBound()

setPersistenceSnapshotWeight

public void setPersistenceSnapshotWeight(float weight)
                                  throws NoSuchObjectException,
                                         RemoteException
Change the weight factor applied by the lookup discovery service to the snapshot size during the test to determine whether or not to take a "snapshot" of the system state.

Specified by:
setPersistenceSnapshotWeight in interface FiddlerAdmin
Parameters:
weight - weight factor for snapshot size
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the weight factor may or may not have been changed successfully.
See Also:
FiddlerAdminProxy.setPersistenceSnapshotWeight(float), FiddlerAdmin.setPersistenceSnapshotWeight(float)

getPersistenceSnapshotWeight

public float getPersistenceSnapshotWeight()
                                   throws NoSuchObjectException,
                                          RemoteException
Retrieve the weight factor applied by the lookup discovery service to the snapshot size during the test to determine whether or not to take a "snapshot" of the system state.

Specified by:
getPersistenceSnapshotWeight in interface FiddlerAdmin
Returns:
float value corresponding to the weight factor for snapshot size
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service.
See Also:
FiddlerAdminProxy.getPersistenceSnapshotWeight(), FiddlerAdmin.getPersistenceSnapshotWeight()

setPersistenceSnapshotThreshold

public void setPersistenceSnapshotThreshold(int threshold)
                                     throws NoSuchObjectException,
                                            RemoteException
Change the value of the size threshold of the snapshot; which is employed by the lookup discovery service in the test to determine whether or not to take a "snapshot" of the system state.

Specified by:
setPersistenceSnapshotThreshold in interface FiddlerAdmin
Parameters:
threshold - size threshold for taking a snapshot
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the threshold may or may not have been changed successfully.
See Also:
#setPersistenceSnapshotThreshold, FiddlerAdmin.setPersistenceSnapshotThreshold(int)

getPersistenceSnapshotThreshold

public int getPersistenceSnapshotThreshold()
                                    throws NoSuchObjectException,
                                           RemoteException
Retrieve the value of the size threshold of the snapshot; which is employed by the lookup discovery service in the test to determine whether or not to take a "snapshot" of the system state.

Specified by:
getPersistenceSnapshotThreshold in interface FiddlerAdmin
Returns:
int value corresponding to the size threshold of the snapshot
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service.
See Also:
#getPersistenceSnapshotThreshold, FiddlerAdmin.getPersistenceSnapshotThreshold()

getServiceProxy

public Object getServiceProxy()
                       throws NoSuchObjectException
Public method that facilitates the use of the mechanism provided by ServiceStarter to create an activatable instance of this server.

Specified by:
getServiceProxy in interface ServiceProxyAccessor
Returns:
the outer (smart) proxy for the server
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing

getProxyID

public Uuid getProxyID()
                throws NoSuchObjectException,
                       RemoteException
Returns the unique identifier generated (or recovered) by the backend implementation of the lookup discovery service when an instance of that service is constructed. This ID is typically used to determine equality between the proxies of any two instances of the lookup discovery service.

Specified by:
getProxyID in interface Fiddler
Returns:
the unique ID that was generated (or recovered) by the backend implementation of the lookup discovery service at creation time
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the server. When this exception does occur, the registration may or may not have completed successfully.

register

public LookupDiscoveryRegistration register(String[] groups,
                                            LookupLocator[] locators,
                                            RemoteEventListener listener,
                                            MarshalledObject handback,
                                            long leaseDuration)
                                     throws NoSuchObjectException,
                                            RemoteException
Registers with the lookup discovery service. When a client invokes this method, it requests that the lookup discovery service perform discovery processing on its behalf.

Specified by:
register in interface Fiddler
Parameters:
groups - String array, none of whose elements may be null, consisting of zero or more names of groups to which lookup services to discover belong. A null value or an empty array (DiscoveryGroupManagement.ALL_GROUPS or DiscoveryGroupManagement.NO_GROUPS) are both acceptable.
locators - array of zero or more non-null LookupLocator objects, each corresponding to a specific lookup service to discover. If either the empty array or null is passed to this argument, then no locator discovery will be performed for the associated registration.
listener - a non-null instance of RemoteEventListener. This argument specifies the entity that will receive events notifying the registration that a lookup service of interest has been discovered. A non-null value must be passed to this argument, otherwise a NullPointerException will be thrown and the registration.
handback - null or an instance of MarshalledObject. This argument specifies an object that will be included in the notification event that the lookup discovery service sends to the registered listener.
leaseDuration - long value representing the amount of time (in milliseconds) for which the resources of the lookup discovery service are being requested.
Returns:
an instance of FiddlerRegistration which implements the LookupDiscoveryRegistration interface, and acts as a proxy to the registration-related methods of the backend server of the Fiddler implementation of the lookup discovery service
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the server. When this exception does occur, the registration may or may not have completed successfully.
NullPointerException - this exception occurs when null is input to the listener parameter, as well as when one or more of the elements of the groups parameter is null.
IllegalArgumentException - this exception occurs when the value input to the leaseDuration parameter is neither positive, Lease.FOREVER, nor Lease.ANY.
See Also:
LookupDiscoveryService

getRegistrars

public MarshalledObject[] getRegistrars(Uuid registrationID)
                                 throws NoSuchObjectException,
                                        RemoteException,
                                        ThrowThis
This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.

This method returns an array consisting of proxies to the lookup service(s) that have already been discovered for the registration corresponding to the registrationID input parameter. Each element of the return set is a marshalled instance of the ServiceRegistrar interface.

Specified by:
getRegistrars in interface Fiddler
Parameters:
registrationID - unique identifier assigned to the registration from which the set of registrars is being retrieved
Returns:
an array of MarshalledObject objects where each element is is a marshalled instance of ServiceRegistrar.
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service.
ThrowThis - which is a non-remote "wrapper" class used to wrap various remote exceptions (for example, NoSuchObjectException) that this method wishes to throw. When a service is implemented as a smart proxy with a backend server, and a method on the backend which was invoked through the proxy wishes to explicitly throw a particular remote exception, it cannot simply throw that exception if it wishes that exception to be visible to the proxy running on the "client side". This is because when the backend throws any remote exception, the RMI sub-system automatically wraps that exception in a java.rmi.ServerException. Thus, the proxy will only be able to "see" the ServerException (the actual exception that the backend tried to throw is "buried" in the detail field of the ServerException). Thus, in order to allow the proxy access to the actual remote exception this method throws, that exception wraps the desired remote exception in the non-remote exception ThrowThis; which will not be wrapped in a ServerException. This method throws a NoSuchObjectException wrapped in a ThrowThis exception whenever the registrationID parameter references an invalid or non-existent registration.
See Also:
FiddlerRegistration.getRegistrars(), LookupDiscoveryRegistration.getRegistrars()

getGroups

public String[] getGroups(Uuid registrationID)
                   throws NoSuchObjectException,
                          RemoteException,
                          ThrowThis
This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.

This method returns an array consisting of the names of the groups whose members are lookup services the lookup discovery service will attempt to discover for the registration corresponding to the current instance of this class. This set of group names is referred to as the registration's 'managed set of groups'.

If the registration's managed set of groups is currently empty, then the empty array is returned. If the lookup discovery service currently has no managed set of groups for the registration through which the request is being made, then null will be returned.

Specified by:
getGroups in interface Fiddler
Parameters:
registrationID - unique identifier assigned to the registration from which the set of groups is being retrieved
Returns:
a String array containing the elements of the managed set of groups for the registration.
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service.
NoSuchObjectException - wrapped in an instance of com.sun.jini.proxy.ThrowThis exception whenever the registrationID parameter references an invalid or non-existent registration. Refer to the description of the getRegistrars method for more information on this exception.
ThrowThis
See Also:
FiddlerRegistration.getGroups(), LookupDiscoveryRegistration.getGroups()

getLocators

public LookupLocator[] getLocators(Uuid registrationID)
                            throws NoSuchObjectException,
                                   RemoteException,
                                   ThrowThis
This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.

This method returns an array consisting of the the LookupLocator objects corresponding to specific lookup services the lookup discovery service will attempt to discover for for the registration corresponding to the current instance of this class. This set of locators is referred to as the registration's 'managed set of locators'.

If the registration's managed set of locators is currently empty, then the empty array is returned. If the lookup discovery service currently has no managed set of locators for the registration through which the request is being made, then null will be returned.

Specified by:
getLocators in interface Fiddler
Parameters:
registrationID - unique identifier assigned to the registration from which the set of locators is being retrieved
Returns:
array consisting of net.jini.core.discovery.LookupLocator objects corresponding to the elements of the managed set of locators for the registration.
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service.
NoSuchObjectException - wrapped in an instance of com.sun.jini.proxy.ThrowThis exception whenever the registrationID parameter references an invalid or non-existent registration. Refer to the description of the getRegistrars method for more information on this exception.
ThrowThis
See Also:
FiddlerRegistration.getLocators(), LookupDiscoveryRegistration.getLocators()

addGroups

public void addGroups(Uuid registrationID,
                      String[] groups)
               throws NoSuchObjectException,
                      RemoteException,
                      ThrowThis
This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.

This method first tests the input set of group names for validity and throws the appropriate exception should any irregularities be found. It then adds the input set of group names to the managed set of groups associated with the registration.

Specified by:
addGroups in interface Fiddler
Parameters:
registrationID - unique identifier assigned to the registration to which the set of groups being augmented corresponds
groups - a String array, none of whose elements may be null, consisting of the group names with which to augment the registration's managed set of groups.

If any element of this parameter duplicates any other element of this parameter, the duplicate will be ignored. If any element of this parameter duplicates any element of the registration's current managed set of groups, the duplicate will be ignored.

If the empty set is input, then the registration's managed set of groups will not change. If null is input, this method will throw a NullPointerException.

Throws:
IllegalStateException - this exception occurs when the addGroups method of the discovery manager is invoked after the terminate method of that manager is called. When this happens, in addition to propagating this exception, this method also registers an ERROR status attribute (along with a Comment attribute describing the nature of the problem) with all lookup services with which this service is registered. Administrative clients, as well as clients that use this service should register for notification of the existence of this attribute.
UnsupportedOperationException - this exception occurs when the registration corresponding to the registrationID parameter has no managed set of groups to which to add the elements of the input parameter. That is, the registration's current managed set of groups is null. When a registration's managed set of groups is null, it means that all groups are being discovered for that registration; thus, requesting that a set of groups be added to the set of all groups makes no sense.
NullPointerException - this exception occurs when either null is input to the groups parameter, or one or more of the elements of the groups parameter is null. If a null groups parameter is input, the registration is requesting that all groups be added to its current managed set of groups; which is not allowed. (Note that if a registration wishes to change its managed set of groups from a finite set of names to "all groups", it should invoke setGroups with a null input.)
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the registration's managed set of groups may or may not have been successfully augmented.
NoSuchObjectException - wrapped in an instance of com.sun.jini.proxy.ThrowThis exception whenever the registrationID parameter references an invalid or non-existent registration. Refer to the description of the getRegistrars method for more information on this exception.
ThrowThis
See Also:
FiddlerRegistration.addGroups(java.lang.String[]), LookupDiscoveryRegistration.addGroups(java.lang.String[])

setGroups

public void setGroups(Uuid registrationID,
                      String[] groups)
               throws NoSuchObjectException,
                      RemoteException,
                      ThrowThis
This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.

This method first tests the input set of group names for validity and throws the appropriate exception should any irregularities be found. It then queues a SetGroupsTask which performs the actual replacement.

Specified by:
setGroups in interface Fiddler
Parameters:
registrationID - unique identifier assigned to the registration to which the set of groups being replaced corresponds
groups - a String array, none of whose elements may be null, consisting of the group names with which to replace the names in this registration's managed set of groups.

If any element of this parameter duplicates any other element of this parameter, the duplicate will be ignored.

If the empty set is input, then group discovery for the registration will cease. If null is input, the lookup discovery service will attempt to discover all as yet undiscovered lookup services located within its multicast radius and, upon discovery of any such lookup service, will send to the registration's listener an event signaling that discovery.

Throws:
NullPointerException - this exception occurs when one or more of the elements of the groups parameter is null.
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the registration's managed set of groups may or may not have been successfully replaced.
NoSuchObjectException - wrapped in an instance of com.sun.jini.proxy.ThrowThis exception whenever the registrationID parameter references an invalid or non-existent registration. Refer to the description of the getRegistrars method for more information on this exception.
ThrowThis
See Also:
FiddlerRegistration.setGroups(java.lang.String[]), LookupDiscoveryRegistration.setGroups(java.lang.String[])

removeGroups

public void removeGroups(Uuid registrationID,
                         String[] groups)
                  throws NoSuchObjectException,
                         RemoteException,
                         ThrowThis
This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.

This method first tests the input set of group names for validity and throws the appropriate exception should any irregularities be found. It then queues a RemoveGroupsTask which performs the actual removal.

Specified by:
removeGroups in interface Fiddler
Parameters:
registrationID - unique identifier assigned to the registration to which the set of groups being removed corresponds
groups - a String array, none of whose elements may be null, consisting of the group names to delete from the registration's managed set of groups.

If any element of this parameter duplicates any other element of this parameter, the duplicate will be ignored. If any element of this parameter is not currently contained in the registration's managed set, no action is taken with respect to that element.

If the empty set is input, the registration's managed set of groups will not change. If null is input, this method will throw a NullPointerException.

Throws:
UnsupportedOperationException - this exception occurs when the registration corresponding to the registrationID parameter has no managed set of groups from which to remove elements of the input parameter. That is, the registration's current managed set of groups is null. Thus, requesting that a set of groups be removed from null set makes no sense.
NullPointerException - this exception occurs when either null is input to the groups parameter, or one or more of the elements of the groups parameter is null. If a null groups parameter is input, the registration is requesting that all groups be removed from its current managed set of groups; which is not allowed. (Note that if a registration wishes to change its managed set of groups from "all groups" to "no groups", it it should invoke setGroups with a zero length String input.)
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the registration's managed set of groups may or may not have been successfully modified.
NoSuchObjectException - wrapped in an instance of com.sun.jini.proxy.ThrowThis exception whenever the registrationID parameter references an invalid or non-existent registration. Refer to the description of the getRegistrars method for more information on this exception.
ThrowThis
See Also:
FiddlerRegistration.removeGroups(java.lang.String[]), LookupDiscoveryRegistration.removeGroups(java.lang.String[])

addLocators

public void addLocators(Uuid registrationID,
                        LookupLocator[] locators)
                 throws NoSuchObjectException,
                        RemoteException,
                        ThrowThis
This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.

This method first tests the input set of group names for validity and throws the appropriate exception should any irregularities be found. It then adds the input set of LookupLocator objects to the managed set of locators associated with the registration.

Specified by:
addLocators in interface Fiddler
Parameters:
registrationID - unique identifier assigned to the registration to which the set of locators being augmented corresponds
locators - an array, none of whose elements may be null, consisting of the LookupLocator objects with which to augment the registration's managed set of locators.

If any element of this parameter duplicates any other element of this parameter, the duplicate will be ignored. If any element of this parameter duplicates any element of the registration's managed set of locators, the duplicate will be ignored.

If the empty set is input, then the registration's managed set of locators will not change. If null is input, this method will throw a NullPointerException.

Throws:
IllegalStateException - this exception occurs when the addLocators method of the discovery manager is invoked after the terminate method of that manager is called. When this happens, in addition to propagating this exception, this method also registers an ERROR status attribute (along with a Comment attribute describing the nature of the problem) with all lookup services with which this service is registered. Administrative clients, as well as clients that use this service should register for notification of the existence of this attribute.
NullPointerException - this exception occurs when either null is input to the locators parameter, or one or more of the elements of the locators parameter is null.
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the registration's managed set of locators may or may not have been successfully augmented.
NoSuchObjectException - wrapped in an instance of com.sun.jini.proxy.ThrowThis exception whenever the registrationID parameter references an invalid or non-existent registration. Refer to the description of the getRegistrars method for more information on this exception.
ThrowThis
See Also:
FiddlerRegistration.addLocators(net.jini.core.discovery.LookupLocator[]), LookupDiscoveryRegistration.addLocators(net.jini.core.discovery.LookupLocator[])

setLocators

public void setLocators(Uuid registrationID,
                        LookupLocator[] locators)
                 throws NoSuchObjectException,
                        RemoteException,
                        ThrowThis
This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.

This method first tests the input set of locators for validity and throws the appropriate exception should any irregularities be found. It then queues a SetLocatorsTask which performs the actual replacement.

Specified by:
setLocators in interface Fiddler
Parameters:
registrationID - unique identifier assigned to the registration to which the set of locators being replaced corresponds
locators - an array, none of whose elements may be null, consisting of the LookupLocator objects with which to replace the locators in the registration's managed set of locators.

If any element of this parameter duplicates any other element of this parameter, the duplicate will be ignored.

If the empty array is input, then locator discovery for the registration will cease. If null is input, this method will throw a NullPointerException.

Throws:
NullPointerException - this exception occurs when either null is input to the locators parameter, or one or more of the elements of the locators parameter is null.
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the registration's managed set of locators may or may not have been successfully replaced.
NoSuchObjectException - wrapped in an instance of com.sun.jini.proxy.ThrowThis exception whenever the registrationID parameter references an invalid or non-existent registration. Refer to the description of the getRegistrars method for more information on this exception.
ThrowThis
See Also:
FiddlerRegistration.setLocators(net.jini.core.discovery.LookupLocator[]), LookupDiscoveryRegistration.setLocators(net.jini.core.discovery.LookupLocator[])

removeLocators

public void removeLocators(Uuid registrationID,
                           LookupLocator[] locators)
                    throws NoSuchObjectException,
                           RemoteException,
                           ThrowThis
This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.

This method first tests the input set of locators for validity and throws the appropriate exception should any irregularities be found. It then queues a RemoveLocatorsTask which performs the actual removal.

Specified by:
removeLocators in interface Fiddler
Parameters:
registrationID - unique identifier assigned to the registration to which the set of locators being removed corresponds
locators - an array, none of whose elements may be null, consisting of the LookupLocator objects to remove from the registration's managed set of locators.

If any element of this parameter duplicates any other element of this parameter, the duplicate will be ignored.

If the empty set is input, the managed set of locators will not change. If null is input, this method will throw a NullPointerException.

Throws:
NullPointerException - this exception occurs when either null is input to the locators parameter, or one or more of the elements of the locators parameter is null.
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the registration's managed set of locators may or may not have been successfully modified.
NoSuchObjectException - wrapped in an instance of com.sun.jini.proxy.ThrowThis exception whenever the registrationID parameter references an invalid or non-existent registration. Refer to the description of the getRegistrars method for more information on this exception.
ThrowThis
See Also:
FiddlerRegistration.removeLocators(net.jini.core.discovery.LookupLocator[]), LookupDiscoveryRegistration.removeLocators(net.jini.core.discovery.LookupLocator[])

discard

public void discard(Uuid registrationID,
                    ServiceRegistrar registrar)
             throws NoSuchObjectException,
                    RemoteException,
                    ThrowThis
This method is the "backend" server counterpart to the method of the same name provided by the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.

This method informs the lookup discovery service of the existence of an unavailable lookup service and requests that the lookup discovery service discard the unavailable lookup service and make it eligible to be re-discovered.

Specified by:
discard in interface Fiddler
Parameters:
registrationID - unique identifier assigned to the registration making the current discard request
registrar - a reference to the lookup service that the lookup discovery service is being asked to discard.

If this parameter equals none of the lookup services contained in the managed set of lookup services for this registration, no action will be taken.

Throws:
NullPointerException - this exception occurs when null is input to the registrar parameter.
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the lookup discovery service. When this exception does occur, the lookup service may or may not have been successfully discarded.
NoSuchObjectException - wrapped in an instance of com.sun.jini.proxy.ThrowThis exception whenever the registrationID parameter references an invalid or non-existent registration. Refer to the description of the getRegistrars method for more information on this exception.
ThrowThis
See Also:
FiddlerRegistration.discard(net.jini.core.lookup.ServiceRegistrar), LookupDiscoveryRegistration.discard(net.jini.core.lookup.ServiceRegistrar)

renewLease

public long renewLease(Uuid registrationID,
                       Uuid leaseID,
                       long duration)
                throws UnknownLeaseException,
                       NoSuchObjectException,
                       RemoteException
This method is the "backend" server counterpart to the renew method specified by the Lease interface, implemented in the com.sun.jini.lease.AbstractLease class, and invoked by way of the doRenew method of the FiddlerLease class; an instance of which is returned by the getLease method of the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.

This method renews the lease corresponding to the given registrationID and leaseID parameters, granting a new duration that is less than or equal to the requested duration value contained in the duration parameter.

Specified by:
renewLease in interface Fiddler
Parameters:
registrationID - unique identifier assigned to the registration to which the lease being renewed corresponds
leaseID - identifier assigned by the lease grantor to the lease being renewed
duration - the requested duration for the lease being renewed
Returns:
long value representing the actual duration that was granted for the renewed lease. Note that the actual duration granted and returned by this method may be less than the duration requested.
Throws:
UnknownLeaseException - this exception occurs when the lease being renewed does not exist, or is unknown to the lease grantor; typically because the lease has expired.
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the server. When this exception does occur, the lease may or may not have been renewed successfully.
See Also:
Lease.renew(long), AbstractLease.renew(long), AbstractLease.doRenew(long), FiddlerLease.doRenew(long)

renewLeases

public FiddlerRenewResults renewLeases(Uuid[] registrationIDs,
                                       Uuid[] leaseIDs,
                                       long[] durations)
                                throws NoSuchObjectException,
                                       RemoteException
This methods renews all leases from a LeaseMap, where each element of the map is a lease on a registration with ID corresponding to an element of the registrationIDs parameter.

This method is the "backend" server counterpart to the renewAll method specified by the LeaseMap interface, implemented in the com.sun.jini.lease.AbstractLeaseMap class, and invoked by way of the renewAll method of the FiddlerLease class; an instance of which is returned by the getLease method of the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.

Specified by:
renewLeases in interface Fiddler
Parameters:
registrationIDs - array containing the unique identifiers assigned to the each registration to which each lease to be renewed corresponds
leaseIDs - array containing the identifiers assigned by the lease grantor to each lease being renewed
durations - array containing the requested durations for each lease being renewed
Returns:
an instance of FiddlerRenewResults containing data corresponding to the results (granted durations or exceptions) of each renewal attempt
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the server. When this exception does occur, this method may or may not have complete its processing successfully.
See Also:
LeaseMap.renewAll()

cancelLease

public void cancelLease(Uuid registrationID,
                        Uuid leaseID)
                 throws UnknownLeaseException,
                        NoSuchObjectException,
                        RemoteException
This method is the "backend" server counterpart to the cancel method specified by the Lease interface and implemented in the FiddlerLease class; an instance of which is returned by the getLease method of the LookupDiscoveryRegistration proxy (an instance of FiddlerRegistration) that is returned by this service when a client requests a registration.

This method cancels the lease corresponding to the given registrationID and leaseID parameters. The cancellation of a lease typically involves the modification of the managed sets in the discovery manager, which usually involves starting the discovery protocol. An IOException can occur when the discovery protocol fails to start. When such an exception does occur, this method registers an ERROR status attribute (along with a Comment attribute describing the nature of the problem) to all lookup services with which this service is registered. Administrative clients, as well as clients that use this service should have registered for notification of the existence of this attribute.

Specified by:
cancelLease in interface Fiddler
Parameters:
registrationID - unique identifier assigned to the registration to which the lease being cancelled corresponds
leaseID - identifier assigned by the lease grantor to the lease that is to be cancelled
Throws:
UnknownLeaseException - this exception occurs when the lease being cancelled is unknown to the lease grantor.
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the server. When this exception does occur, the lease may or may not have been cancelled successfully.
See Also:
Lease.cancel()

cancelLeases

public Exception[] cancelLeases(Uuid[] registrationIDs,
                                Uuid[] leaseIDs)
                         throws NoSuchObjectException,
                                RemoteException
Cancels all leases from a LeaseMap.

For each element in the registrationIDs parameter, this method will cancel the corresponding element in the leaseIDs parameter.

Specified by:
cancelLeases in interface Fiddler
Parameters:
registrationIDs - array containing the unique identifiers assigned to the each registration to which each lease to be cancelled corresponds
leaseIDs - array containing the identifiers assigned by the lease grantor to each lease being cancelled
Returns:
array consisting of any exceptions that may have occurred while attempting to cancel one of the leases in the map.
Throws:
NoSuchObjectException - if this method is called during service initialization or shutdown processing
RemoteException - typically, this exception occurs when there is a communication failure between the client and the server. When this exception does occur, this method may or may not have complete its processing successfully.
See Also:
LeaseMap.cancelAll()

appendArray

private static Object[] appendArray(Object[] array,
                                    Object elt)
Return a new array containing the elements of the input array parameter with the input element parameter appended to the end of the array.


applyBoundToLeaseDuration

private static long applyBoundToLeaseDuration(long leaseDuration,
                                              long bound)
Bounds the duration by the value of the bound parameter, and checks for negative value.


containsNullElement

private static boolean containsNullElement(Object[] arr)
Determines if any element in the input array is null.

Parameters:
arr - Object array to examine for null elements
Returns:
true if any element is found to be null, false otherwise. Note that this means that if the array itself is null or has a non-positive length, false is returned (because the input parameter still does not contain a null element).

interested

private static boolean interested(String[] regGroups,
                                  Set desiredGroups)
This method determines if a particular registration (regInfo) is interested in discovering, through group discovery, the registrar belonging to a given set of member groups.

Parameters:
regGroups - array of the member groups from the registrar (cannot be null)
desiredGroups - groups the registration wishes to discover (can be null = ALL_GROUPS)
Returns:
true if at least one of the registrar's member groups is contained in the registration's set of groups to discover; false otherwise

interested

private static boolean interested(LookupLocator regLoc,
                                  String[] regGroups,
                                  Set desiredLocators,
                                  Set desiredGroups)
This method determines if a particular registration (regInfo) is interested in discovering, through either locator discovery or group discovery, the registrar having a given locator and belonging to a given set of member groups.

Parameters:
regLoc - locator of the registrar (cannot be null)
regGroups - array of the member groups from the registrar (cannot be null)
desiredLocators - locators the registration wishes to discover
desiredGroups - groups the registration wishes to discover (can be null = ALL_GROUPS)
Returns:
true if either the registrar's locator is contained in the registration's set of locators to discover, or at least one of the registrar's member groups is contained in the registration's set of groups to discover; false otherwise

getUndesiredRegsByGroup

private static HashMap getUndesiredRegsByGroup(Map regMap,
                                               FiddlerImpl.RegistrationInfo regInfo)
This method returns a mapping in which the key values are registrars, and the map values are the member groups of the corresponding registrar key. The registrar and member groups from the input map are selected to be included in the returned mapping if and only if the key value under consideration is a registrar that belongs to none of the desired groups of the given registration (regInfo). That is, the registrars referenced in the returned mapping are the registrars that are no longer of interest - through group discovery - to the given registration.

Parameters:
regMap - map whose key values are registrars, and whose map values are data structures of type LocatorGroupsStruct that contain the associated locator and member groups of the corresponding registrar key; the elements of the return map are selected from this mapping
regInfo - the data structure record corresponding to the registration whose groups-to-discover will be used to select the elements from regMap to include in the return mapping
Returns:
a registrar-to-groups map in which each registrar in the map is from the regMap parameter, and belongs to none of the desired groups referenced in the regInfo parameter

getUndesiredRegsByLocator

private static Map getUndesiredRegsByLocator(Map regMap,
                                             FiddlerImpl.RegistrationInfo regInfo)
This method returns a subset of the given registrar-to-locators mapping (regMap). An element of the given mapping is selected to be included in the returned mapping if and only if the key value of the element is a registrar whose locator equals none of the desired locators of the given registration (regInfo). That is, the registrars referenced in the returned mapping are the registrars that are no longer of interest - through locator discovery - to the given registration. This method returns a mapping in which the key values are registrars, and the map values are the locators of the corresponding registrar key. The registrar and locators from the input map are selected to be included in the returned mapping if and only if the key value under consideration is a registrar whose locator equals none of the desired locators of the given registration (regInfo). That is, the registrars referenced in the returned mapping are the registrars that are no longer of interest - through locator discovery - to the given registration.

Parameters:
regMap - map whose key values are registrars, and whose map values are data structures of type LocatorGroupsStruct that contain the associated locator and member groups of the corresponding registrar key; the elements of the return map are selected from this mapping
regInfo - the data structure record corresponding to the registration whose locators-to-discover will be used to select the elements from regMap to include in the return mapping
Returns:
a registrars-to-locators map in which each registrar key in the map is from the regMap parameter, and has a locator equal to none of the desired locators referenced in the regInfo parameter

marshalAttributes

private static MarshalledObject[] marshalAttributes(FiddlerImpl fiddlerImpl,
                                                    Entry[] attrs)
Marshals each element of the Entry[] array parameter. This method is static so that it may called from the static LogRecord classes when a set of attributes is being logged to persistent storage.

Parameters:
fiddlerImpl - reference to the current instance of this service
attrs - Entry[] array consisting of the attributes to marshal
Returns:
array of MarshalledObject[], where each element corresponds to an attribute in marshalled form

unmarshalAttributes

private static Entry[] unmarshalAttributes(FiddlerImpl fiddlerImpl,
                                           MarshalledObject[] marshalledAttrs)
Unmarshals each element of the MarshalledObject[] array parameter. This method is static so that it may called from the static LogRecord classes when a set of attributes is being recovered from persistent storage.

Parameters:
fiddlerImpl - reference to the current instance of this service
marshalledAttrs - MarshalledObject[] array consisting of the attributes to unmarshal
Returns:
array of Entry[], where each element corresponds to an attribute that was successfully unmarshalled

prepareNewLocators

private static void prepareNewLocators(ProxyPreparer preparer,
                                       LookupLocator[] locators)
                                throws RemoteException
Using the given ProxyPreparer, attempts to prepare each element of the given LookupLocator array; replacing the original element of the array with the result of the call to the method ProxyPreparer.prepareProxy. If any attempt to prepare an element of the given array fails due to an exception, this method will propagate that exception. This method is a convenience method that is typically used to prepare new locators the service should discover and join that are inserted into, or removed from, the service's state through the use of one of the following methods:

Parameters:
preparer - the preparer to use to prepare each element of the input array
locators - array of LookupLocator instances in which each element will be prepared.
Throws:
RemoteException - when preparation of any of the elements of the input array fails because of a RemoteException
SecurityException - when preparation of any of the elements of the input array fails because of a SecurityException

prepareOldLocators

private static LookupLocator[] prepareOldLocators(ProxyPreparer preparer,
                                                  LookupLocator[] locators)
Using the given ProxyPreparer, attempts to prepare each element of the given LookupLocator array; and returns a new array containing the prepared locators. If any attempt to prepare an element of the given array fails due to an exception, this method will skip to the next locator in that input array. This method is a convenience method that is typically used to re-prepare the previously prepared locators that are retrieved from the service's persisted state during recovery.

Parameters:
preparer - the preparer to use to prepare each element of the input array
locators - array of LookupLocator instances in which each element will be prepared.
Returns:
array of LookupLocator instances in which each element of the returned array is the result of successful proxy preparation of the corresponding element of the input array

prepareOldLocators

private static Set prepareOldLocators(ProxyPreparer preparer,
                                      Set locators)
Using the given ProxyPreparer, attempts to prepare each element of the given Set of LookupLocator instances; and returns a new Set containing the prepared locators. If any attempt to prepare an element of the given Set fails due to an exception, this method will skip to the next locator in that input Set. This method is a convenience method that is typically used to re-prepare the previously prepared locators that are retrieved from the service's persisted state during recovery.

Parameters:
preparer - the preparer to use to prepare each element of the input array
locators - Set of LookupLocator instances in which each element will be prepared.
Returns:
Set of LookupLocator instances in which each element of the returned Set is the result of successful proxy preparation of the corresponding element of the input Set

locSetContainsLoc

private static boolean locSetContainsLoc(Set locSet,
                                         LookupLocator loc)
Searches the given set of locators for the given individual locator, returning true if the indicated locator is found in the set; false otherwise. This method is a convenience method that is called instead of calling only the contains method on the Set parameter. This is necessary because the equals method on LookupLocator performs a simple String compare of the host names referenced by the locators being compared. Such a comparison can result in a "false negative" when the hostname returned by a remote system provides a fully-qualified hostname (ex. "myhost.subdomain.mycompany.com"), but clients of this service indicate interest in a locator using only the unqualified hostname (ex. "myhost"). In this case, both host names are legal and functionally equivalent, but the equals method on LookupLocator will interpret them as unequal; resulting in failure to discover locators that actually should be discovered. To address the problem described above, this method will do the following when attempting to determine whether the given locator is contained in the given set of locators: 1. Apply Set.contains which uses LookupLocator.equals to determine if the given locator is an element of the given set of locators. 2. If the Set.contains method returns false, then iterate through the elements of the given set, retrieving and comparing the port and InetAddress of each element to the port and InetAddress of the given locator.

Parameters:
locSet - this method will determine whether or not the given locator is contained in this Set of LookupLocators.
loc - this method will determine whether or not this LookupLocator is contained in the given set.
Returns:
true if the given set of locators contains the given locator; false otherwise.

init

private void init(String[] configArgs,
                  boolean persistent)
           throws IOException,
                  ConfigurationException,
                  LoginException
Common entry point for initialization of the service in any of its possible modes: transient, non-activatable-persistent, or activatable-persistent; with or without performing a JAAS login.

Throws:
IOException
ConfigurationException
LoginException

initWithLogin

private void initWithLogin(Configuration config,
                           boolean persistent,
                           LoginContext loginContext)
                    throws IOException,
                           ConfigurationException,
                           LoginException
Initialization with JAAS login as the Subject referenced in the given loginContext.

Throws:
IOException
ConfigurationException
LoginException

doInit

private void doInit(Configuration config,
                    boolean persistent)
             throws IOException,
                    ConfigurationException
Initialization common to all modes in which instances of this service runs: activatable/persistent, non-activatable/persistent, and transient (non-activatable /non-persistent).

Throws:
IOException
ConfigurationException

cleanupInitFailure

private void cleanupInitFailure()

handleActivatableInitThrowable

private void handleActivatableInitThrowable(Throwable t)
                                     throws IOException,
                                            ActivationException,
                                            ConfigurationException,
                                            LoginException,
                                            ClassNotFoundException
Throws:
IOException
ActivationException
ConfigurationException
LoginException
ClassNotFoundException

handleInitThrowable

private void handleInitThrowable(Throwable t)
                          throws IOException,
                                 ConfigurationException,
                                 LoginException
Throws:
IOException
ConfigurationException
LoginException

destroyDo

private void destroyDo()
Called by the public method destroy as well as by the apply method in the various LogObj classes that, during recovery, modify the managed sets of the discovery manager; and, while doing so, experience an IOException when the multicast request protocol fails to start during recovery (an un-recoverable exception). This method destroys the lookup discovery service, if possible, including its persistent storage. This method spawns a separate thread to do the actual work asynchronously, so a successful return from this method usually does not mean that the service has been destroyed.

See Also:
destroy()

registerDo

private LookupDiscoveryRegistration registerDo(String[] groups,
                                               LookupLocator[] locators,
                                               RemoteEventListener listener,
                                               MarshalledObject handback,
                                               long leaseDuration)
                                        throws RemoteException,
                                               IOException
This method is called by the public method register. This method creates a registration object that is an instance of FiddlerRegistration which implements the interface LookupDiscoveryRegistration, and acts as a proxy to the registration-related methods of the backend server of the Fiddler implementation of the lookup discovery service.

This method also associates with the registration all information needed by the registration to participate in the lookup discovery service, information such as: IDs, lease information, event information.

Parameters:
groups - names of groups whose members are the lookup services to discover.
locators - instances of LookupLocator, each corresponding to a specific lookup service to discover.
listener - the entity that will receive events notifying the registration that a lookup service of interest has been discovered.
handback - the object that will be included in every notification event sent to the registered listener.
leaseDuration - long value representing the amount of time (in milliseconds) for which the resources of the lookup discovery service are being requested.
Returns:
an instance of FiddlerRegistration which implements the LookupDiscoveryRegistration interface, and acts as a proxy to the registration-related methods of the backend server of the Fiddler implementation of the lookup discovery service
Throws:
IOException - this exception occurs when the multicast request protocol fails to start.
RemoteException - this exception occurs when the attempt to prepare the listener fails due to a RemoteException
SecurityException - this exception occurs when the attempt to prepare the listener fails due to a SecurityException
See Also:
register(java.lang.String[], net.jini.core.discovery.LookupLocator[], net.jini.core.event.RemoteEventListener, java.rmi.MarshalledObject, long)

addRegistration

private void addRegistration(FiddlerImpl.RegistrationInfo regInfo)
                      throws IOException
Places the registration corresponding to the regInfo parameter in both the registrationByID map and the registrationByTime map. This method also updates the managed sets in the discovery manager in the appropriate way. This should be called whenever a new registration has been created and needs to be added to the data base (for example, the methods registerDo, recoverSnapshot and the apply method of the RegistrationGrantedLogObj class all call this method).

Parameters:
regInfo - the data structure record corresponding to the registration that is to be added to the data base
Throws:
IOException - this exception occurs when the multicast request protocol fails to start.
See Also:
registerDo(java.lang.String[], net.jini.core.discovery.LookupLocator[], net.jini.core.event.RemoteEventListener, java.rmi.MarshalledObject, long), recoverSnapshot(java.io.InputStream)

removeRegistration

private void removeRegistration(FiddlerImpl.RegistrationInfo regInfo)
                         throws IOException
Removes the registration corresponding to the regInfo parameter from this service's state. Removes the registration from both the registrationByID map and the registrationByTime map. This method also updates the managed sets in the discovery manager in the appropriate way. This should be called whenever a current registration needs to be removed from the data base (for example, when the registration's lease is is expired in the LeaseExpireThread, and when the registration's lease is cancelled in the cancelLeaseDo method).

Parameters:
regInfo - the data structure record corresponding to the registration that is to be removed from the data base
Throws:
IOException - this exception occurs when the multicast request protocol fails to start.
See Also:
cancelLeaseDo(com.sun.jini.fiddler.FiddlerImpl.RegistrationInfo, net.jini.id.Uuid)

addGroupsDo

private void addGroupsDo(FiddlerImpl.RegistrationInfo regInfo,
                         String[] groups)
Called by the public method addGroups. This method queues an AddGroupsTask which performs the actual augmentation of the given registration's desired groups.

Parameters:
regInfo - the data structure record corresponding to the registration whose managed set of groups is to be augmented
groups - a String array, none of whose elements may be null, consisting of the group names with which to augment the registration's managed set of groups.
See Also:
addGroups(net.jini.id.Uuid, java.lang.String[]), FiddlerRegistration.addGroups(java.lang.String[]), LookupDiscoveryRegistration.addGroups(java.lang.String[])

addGroupsDo

private void addGroupsDo(Uuid registrationID,
                         HashMap registrationByID,
                         String[] groups)
Called by the apply method of the class GroupsAddedToRegistrationLogObj (which is invoked during state recovery). This method queues an AddGroupsTask which performs the actual augmentation of the given registration's desired groups.

Parameters:
registrationID - the ID of the data structure record corresponding to the registration whose managed set of groups is to be augmented
registrationByID - the map containing all active registrations managed by this service
groups - a String array, none of whose elements may be null, consisting of the group names with which to augment the registration's managed set of groups.
See Also:
addGroupsDo(com.sun.jini.fiddler.FiddlerImpl.RegistrationInfo, java.lang.String[]), addGroups(net.jini.id.Uuid, java.lang.String[]), FiddlerRegistration.addGroups(java.lang.String[]), LookupDiscoveryRegistration.addGroups(java.lang.String[])

setGroupsDo

private void setGroupsDo(FiddlerImpl.RegistrationInfo regInfo,
                         String[] groups)
Called by the public method setGroups. This method queues a SetGroupsTask which performs the actual replacement.

Parameters:
regInfo - the data structure record corresponding to the registration whose managed set of groups is to be replaced
groups - a String array, none of whose elements may be null, consisting of the group names with which to replace the registration's managed set of groups.
See Also:
setGroups(net.jini.id.Uuid, java.lang.String[]), FiddlerRegistration.setGroups(java.lang.String[]), LookupDiscoveryRegistration.setGroups(java.lang.String[])

setGroupsDo

private void setGroupsDo(Uuid registrationID,
                         HashMap registrationByID,
                         String[] groups)
Called by the apply method of the class GroupsSetInRegistrationLogObj (which is invoked during state recovery). This method queues a SetGroupsTask which performs the actual replacement.

Parameters:
registrationID - the ID of the data structure record corresponding to the registration whose managed set of groups is to be replaced
registrationByID - the map containing all active registrations managed by this service
groups - a String array, none of whose elements may be null, consisting of the group names with which to replace the registration's managed set of groups.
See Also:
setGroupsDo(com.sun.jini.fiddler.FiddlerImpl.RegistrationInfo, java.lang.String[]), setGroups(net.jini.id.Uuid, java.lang.String[]), FiddlerRegistration.setGroups(java.lang.String[]), LookupDiscoveryRegistration.setGroups(java.lang.String[])

removeGroupsDo

private void removeGroupsDo(FiddlerImpl.RegistrationInfo regInfo,
                            String[] groups)
Called by the public method removeGroups. This method queues a RemoveGroupsTask which performs the actual removal.

Parameters:
regInfo - the data structure record corresponding to the registration from whose managed set of groups the input set of groups is to be removed
groups - a String array, none of whose elements may be null, consisting of the group names to remove from the registration's managed set of groups
See Also:
removeGroups(net.jini.id.Uuid, java.lang.String[]), FiddlerRegistration.removeGroups(java.lang.String[]), LookupDiscoveryRegistration.removeGroups(java.lang.String[])

removeGroupsDo

private void removeGroupsDo(Uuid registrationID,
                            HashMap registrationByID,
                            String[] groups)
Called by the apply method of the class GroupsRemovedFromRegistrationLogObj (which is invoked during state recovery). This method queues a RemoveGroupsTask which performs the actual removal.

Parameters:
registrationID - the ID of the data structure record corresponding to the registration from whose managed set of groups the input set of groups is to be removed
registrationByID - the map containing all active registrations managed by this service
groups - a String array, none of whose elements may be null, consisting of the group names to remove from the registration's managed set of groups
See Also:
removeGroupsDo(com.sun.jini.fiddler.FiddlerImpl.RegistrationInfo, java.lang.String[]), removeGroups(net.jini.id.Uuid, java.lang.String[]), FiddlerRegistration.removeGroups(java.lang.String[]), LookupDiscoveryRegistration.removeGroups(java.lang.String[])

getGroupsFromAllRegs

private String[] getGroupsFromAllRegs()
Builds a set containing the groups from all registrations. Iterates through all the active registrations, retrieving the groups to discover for each registration (minus duplicates). If at least one registration has requested that all groups be discovered, stops iterating (because the set must be ALL_GROUPS) and returns null.


getDesiredRegsByGroup

private HashMap getDesiredRegsByGroup(FiddlerImpl.RegistrationInfo regInfo)
This method returns a registrar-to-data-structure map in which each registrar key in the returned map is one of the keys from the the global map allDiscoveredRegs, and the corresponding value is the (locator,groups) pair that corresponds to that registrar key in allDiscoveredRegs An element of allDiscoveredRegs is selected to have its registrar and associated (locator,groups) pair be included in the returned mapping if and only if the key value of the element is a registrar that belongs to at least one of the desired groups of the given registration (regInfo parameter). That is, the registrars referenced in the returned mapping are the registrars that are of interest - through group discovery - to the given registration. Note that this method must be called from within a synchronization block.

Parameters:
regInfo - the data structure record corresponding to the registration whose groups-to-discover will be used to select the elements from allDiscoveredRegs to include in the return mapping
Returns:
a mapping in which the key values are registrars that, in addition to being elements of the global map allDiscoveredRegs, also belong to at least one of the desired groups referenced in the regInfo parameter; and whose map values are data structures of type LocatorGroupsStruct that contain the associated locator and member groups of the corresponding registrar key

updateDiscoveryMgrGroups

private void updateDiscoveryMgrGroups()
Modifies the discovery manager's managed set of groups in the appropriate way; that is, adds to the discovery manager's managed set of groups, any new groups-of-interest, across all registrations, and removes any groups that are no longer of interest to any of the registrations. This method is typically called after the groups of a particular registration have been modified. Note that this method must be called from within a synchronization block.


addLocatorsDo

private void addLocatorsDo(FiddlerImpl.RegistrationInfo regInfo,
                           LookupLocator[] locators)
Called by the public method addLocators. This method queues an AddLocatorsTask which performs the actual augmentation of the given registration's desired locators.

Parameters:
regInfo - the data structure record corresponding to the registration whose managed set of locators is to be augmented
locators - an array, none of whose elements may be null, consisting of the LookupLocator objects with which to augment the registration's managed set of locators.
See Also:
addLocators(net.jini.id.Uuid, net.jini.core.discovery.LookupLocator[]), FiddlerRegistration.addLocators(net.jini.core.discovery.LookupLocator[]), LookupDiscoveryRegistration.addLocators(net.jini.core.discovery.LookupLocator[])

addLocatorsDo

private void addLocatorsDo(Uuid registrationID,
                           HashMap registrationByID,
                           LookupLocator[] locators)
Called by the apply method of the class LocsAddedToRegistrationLogObj (which is invoked during state recovery). This method queues an AddLocatorsTask which performs the actual augmentation of the given registration's desired locators.

Parameters:
registrationID - the ID of the data structure record corresponding to the registration whose managed set of locators is to be augmented
registrationByID - the map containing all active registrations managed by this service
locators - an array, none of whose elements may be null, consisting of the LookupLocator objects with which to augment the registration's managed set of locators.
See Also:
addLocatorsDo(com.sun.jini.fiddler.FiddlerImpl.RegistrationInfo, net.jini.core.discovery.LookupLocator[]), addLocators(net.jini.id.Uuid, net.jini.core.discovery.LookupLocator[]), FiddlerRegistration.addLocators(net.jini.core.discovery.LookupLocator[]), LookupDiscoveryRegistration.addLocators(net.jini.core.discovery.LookupLocator[])

setLocatorsDo

private void setLocatorsDo(FiddlerImpl.RegistrationInfo regInfo,
                           LookupLocator[] locators)
Called by the public method setLocators. This method queues a SetLocatorsTask which performs the actual replacement.

Parameters:
regInfo - the data structure record corresponding to the registration whose managed set of locators is to be replaced
locators - an array, none of whose elements may be null, consisting of the LookupLocator objects with which to replace the registration's managed set of locators.
See Also:
setLocators(net.jini.id.Uuid, net.jini.core.discovery.LookupLocator[]), FiddlerRegistration.setLocators(net.jini.core.discovery.LookupLocator[]), LookupDiscoveryRegistration.setLocators(net.jini.core.discovery.LookupLocator[])

setLocatorsDo

private void setLocatorsDo(Uuid registrationID,
                           HashMap registrationByID,
                           LookupLocator[] locators)
Called by the apply method of the class LocsSetInRegistrationLogObj (which is invoked during state recovery). This method queues a SetLocatorsTask which performs the actual replacement.

Parameters:
registrationID - the ID of the data structure record corresponding to the registration whose managed set of locators is to be replaced
registrationByID - the map containing all active registrations managed by this service
locators - an array, none of whose elements may be null, consisting of the LookupLocator objects with which to replace the registration's managed set of locators.
See Also:
setLocatorsDo(com.sun.jini.fiddler.FiddlerImpl.RegistrationInfo, net.jini.core.discovery.LookupLocator[]), setLocators(net.jini.id.Uuid, net.jini.core.discovery.LookupLocator[]), FiddlerRegistration.setLocators(net.jini.core.discovery.LookupLocator[]), LookupDiscoveryRegistration.setLocators(net.jini.core.discovery.LookupLocator[])

removeLocatorsDo

private void removeLocatorsDo(FiddlerImpl.RegistrationInfo regInfo,
                              LookupLocator[] locators)
Called by the public method removeLocators. This method queues a RemoveLocatorsTask which performs the actual removal.

Parameters:
regInfo - the data structure record corresponding to the registration from whose managed set of locators the input set of locators is to be removed
locators - an array, none of whose elements may be null, consisting of the LookupLocator objects to remove from the registration's managed set of locators.
See Also:
removeLocators(net.jini.id.Uuid, net.jini.core.discovery.LookupLocator[]), FiddlerRegistration.removeLocators(net.jini.core.discovery.LookupLocator[]), LookupDiscoveryRegistration.removeLocators(net.jini.core.discovery.LookupLocator[])

removeLocatorsDo

private void removeLocatorsDo(Uuid registrationID,
                              HashMap registrationByID,
                              LookupLocator[] locators)
Called by the apply method of the class LocsRemovedFromRegistrationLogObj (which is invoked during state recovery). This method queues a RemoveLocatorsTask which performs the actual removal.

Parameters:
registrationID - the ID of the data structure record corresponding to the registration from whose managed set of groups the input set of locators is to be removed
registrationByID - the map containing all active registrations managed by this service
locators - an array, none of whose elements may be null, consisting of the LookupLocator objects to remove from the registration's managed set of locators.
See Also:
removeLocatorsDo(com.sun.jini.fiddler.FiddlerImpl.RegistrationInfo, net.jini.core.discovery.LookupLocator[]), removeLocators(net.jini.id.Uuid, net.jini.core.discovery.LookupLocator[]), FiddlerRegistration.removeLocators(net.jini.core.discovery.LookupLocator[]), LookupDiscoveryRegistration.removeLocators(net.jini.core.discovery.LookupLocator[])

getLocatorsFromAllRegs

private LookupLocator[] getLocatorsFromAllRegs()
Builds a set containing the locators from all registrations. Iterates through all the active registrations, retrieving the locators to discover for each registration (minus duplicates).


getDesiredRegsByLocator

private HashMap getDesiredRegsByLocator(FiddlerImpl.RegistrationInfo regInfo)
This method returns a registrar-to-data-structure map in which each registrar key in the returned map is one of the keys from the the global map allDiscoveredRegs, and the corresponding value is the (locator,groups) pair that corresponds to that registrar key in allDiscoveredRegs An element of allDiscoveredRegs is selected to have its registrar and associated (locator,groups) pair be included in the returned mapping if and only if the key value under consideration is a registrar whose locator equals one of the desired locators of the given registration (regInfo parameter). That is, the registrars referenced in the returned mapping are the registrars that are of interest - through locator discovery - to the given registration.

Parameters:
regInfo - the data structure record corresponding to the registration whose locators-to-discover will be used to select the elements from allDiscoveredRegs to include in the return mapping
Returns:
a mapping in which the key values are registrars that, in addition to being elements of the global map allDiscoveredRegs, have locators that are elements of the set of desired locators referenced in the regInfo parameter; and whose map values are data structures of type LocatorGroupsStruct that contain the associated locator and member groups of the corresponding registrar key

updateDiscoveryMgrLocators

private void updateDiscoveryMgrLocators()
Modifies the discovery manager's managed set of locators in the appropriate way; that is, adds to the discovery manager's managed set of locators, any new locators-of-interest, across all registrations, and removes any locators that are no longer of interest to any of the registrations. This method is typically called after the locators of a particular registration have been modified. Note that this method must be called from within a synchronization block.


renewLeaseDo

private long renewLeaseDo(FiddlerImpl.RegistrationInfo regInfo,
                          Uuid leaseID,
                          long duration)
                   throws UnknownLeaseException
Called by the public method renewLease. This method renews the lease corresponding to the registrationID and leaseID parameters, granting a new duration that is less than or equal to the requested duration value contained in the duration parameter.

Parameters:
regInfo - the data structure record corresponding to the registration whose lease is to be renewed
leaseID - identifier assigned by the lease grantor to the lease that is to be renewed
duration - the requested duration for the lease being renewed
Returns:
long value representing the actual duration that was granted for the renewed lease. Note that the actual duration granted and returned by this method may be less than the duration requested.
Throws:
UnknownLeaseException - this exception occurs when the lease being renewed is unknown to the lease grantor.
See Also:
renewLease(net.jini.id.Uuid, net.jini.id.Uuid, long)

renewLeaseInt

private long renewLeaseInt(FiddlerImpl.RegistrationInfo regInfo,
                           Uuid leaseID,
                           long duration,
                           long curTime)
                    throws UnknownLeaseException
Called by the method renewLeaseDo. This method takes a requested duration for the lease corresponding to the registrationID and leaseID parameters, converts that duration to an absolute expiration (based on the local clock) with the appropriate bound applied, and attempts to renew the lease, granting the new expiration time on the lease.

Parameters:
regInfo - the data structure record corresponding to the registration whose lease is to be renewed
leaseID - identifier assigned by the lease grantor to the lease that is to be renewed
duration - the requested duration for the lease being renewed
Returns:
long value representing the new absolute expiration time granted for the renewed lease.
Throws:
UnknownLeaseException - this exception occurs when the lease being renewed is unknown to the lease grantor.
See Also:
renewLeaseDo(com.sun.jini.fiddler.FiddlerImpl.RegistrationInfo, net.jini.id.Uuid, long)

renewLeaseAbs

private void renewLeaseAbs(FiddlerImpl.RegistrationInfo regInfo,
                           Uuid leaseID,
                           long expiration)
This method performs the final steps in the process of renewing the lease on the registration corresponding to the regInfo and leaseID parameters, granting a requested absolute expiration time for that lease.

Parameters:
regInfo - the data structure record corresponding to the registration whose lease is to be renewed
leaseID - identifier assigned by the lease grantor to the lease that is to be renewed
expiration - the requested absolute expiration time for the lease being renewed

renewLeaseAbs

private void renewLeaseAbs(Uuid registrationID,
                           HashMap registrationByID,
                           Uuid leaseID,
                           long expiration)
Called by the apply method of the class LeaseRenewedLogObj (which is invoked during state recovery). This method performs the final steps in the process of renewing the lease on the registration corresponding to the registrationID and leaseID parameters, granting a requested absolute expiration time for that lease.

Parameters:
registrationID - the ID of the data structure record corresponding to the registration whose lease is to be renewed
registrationByID - the map containing all active registrations managed by this service
leaseID - identifier assigned by the lease grantor to the lease that is to be renewed
expiration - the requested absolute expiration time for the lease being renewed
See Also:
renewLeaseDo(com.sun.jini.fiddler.FiddlerImpl.RegistrationInfo, net.jini.id.Uuid, long)

renewLeasesDo

private FiddlerRenewResults renewLeasesDo(Uuid[] registrationIDs,
                                          Uuid[] leaseIDs,
                                          long[] durations)
Called by the public method renewLeases to renew all of the leases from a LeaseMap that correspond to the elements of the registrationIDs and leaseIDs parameters, granting as new durations the corresponding elements of the duration parameter.

Note that all of the input parameters must be the same length.

Parameters:
registrationIDs - array containing the unique identifiers assigned to the each registration to which each lease to be renewed corresponds
leaseIDs - array containing the identifiers assigned by the lease grantor to each lease being renewed
durations - array containing the requested durations for each lease being renewed
Returns:
an instance of FiddlerRenewResults containing data corresponding to the results (granted durations or exceptions) of each renewal attempt
See Also:
renewLeases(net.jini.id.Uuid[], net.jini.id.Uuid[], long[])

renewLeasesAbs

private void renewLeasesAbs(Uuid[] registrationIDs,
                            Uuid[] leaseIDs,
                            long[] expirations)
Using the absolute expiration times contained in the expirations parameter, renews all of the leases from a LeaseMap that correspond to the elements of the registrationIDs and leaseIDs parameters; skipping any negative expiration times.

Note that all of the input parameters must be the same length.

Parameters:
registrationIDs - array containing the unique identifiers assigned to the each registration to which each lease to be renewed corresponds
leaseIDs - array containing the identifiers assigned by the lease grantor to each lease being renewed
expirations - array containing the absolute expiration times to which to renew each lease
See Also:
renewLeases(net.jini.id.Uuid[], net.jini.id.Uuid[], long[]), renewLeaseAbs(com.sun.jini.fiddler.FiddlerImpl.RegistrationInfo, net.jini.id.Uuid, long)

cancelLeaseDo

private void cancelLeaseDo(FiddlerImpl.RegistrationInfo regInfo,
                           Uuid leaseID)
                    throws UnknownLeaseException,
                           IOException
Called by the public method cancelLease. This method cancels the lease on the registration corresponding to the regInfo and leaseID parameters.

Parameters:
regInfo - the data structure record corresponding to the registration whose lease is to be cancelled
leaseID - identifier assigned by the lease grantor to the lease that is to be cancelled
Throws:
UnknownLeaseException - this exception occurs when the lease being cancelled is unknown to the lease grantor.
IOException - this exception occurs when the multicast request protocol experiences a failure.
See Also:
cancelLease(net.jini.id.Uuid, net.jini.id.Uuid)

cancelLeaseDo

private void cancelLeaseDo(Uuid registrationID,
                           HashMap registrationByID,
                           Uuid leaseID)
                    throws UnknownLeaseException,
                           IOException
Called by the apply method of the class LeaseCancelledLogObj (which is invoked during state recovery). This method cancels the lease on the registration corresponding to the registrationID and leaseID parameters.

Parameters:
registrationID - the ID of the data structure record corresponding to the registration whose lease is to be cancelled
registrationByID - the map containing all active registrations managed by this service
leaseID - identifier assigned by the lease grantor to the lease that is to be cancelled
Throws:
UnknownLeaseException - this exception occurs when the lease being cancelled is unknown to the lease grantor.
IOException - this exception occurs when the multicast request protocol experiences a failure.
See Also:
cancelLeaseDo(com.sun.jini.fiddler.FiddlerImpl.RegistrationInfo, net.jini.id.Uuid), cancelLease(net.jini.id.Uuid, net.jini.id.Uuid)

cancelLeasesDo

private Exception[] cancelLeasesDo(Uuid[] registrationIDs,
                                   Uuid[] leaseIDs)
Called by the public method cancelLeases to the cancel all of the leases from a LeaseMap that correspond to the elements of the registrationIDs and leaseIDs parameters.

The two input arrays must be the same length. If there are no exceptions, the return value is null. Otherwise, the return value has the same length as the registrationIDs parameter, and has nulls for the leases that were successfully renewed.

Returns:
an array containing the instances of Exception (or null for successfully renewed leases), each corresponding to the exception that occurred upon attempting renewal.
See Also:
cancelLeases(net.jini.id.Uuid[], net.jini.id.Uuid[])

intersectRegSets

private ServiceRegistrar[] intersectRegSets(ServiceRegistrar[] regs0,
                                            ServiceRegistrar[] regs1)
Returns the set of registrars common to both input parameters


regIsElementOfRegSet

private boolean regIsElementOfRegSet(ServiceRegistrar reg,
                                     ServiceRegistrar[] regSet)
Returns true if the input registrar is an element of the given array


maybeSendDiscoveredEvent

private void maybeSendDiscoveredEvent(FiddlerImpl.RegistrationInfo regInfo,
                                      Map regsMap)
This method determines which of the registrars in the regsMap parameter belong to the set of registrars the given regInfo parameter wishes to discover. It then adds those registrars to the regInfo's map of discovered registrars (including only those registrars that can be successfully serialized). Finally, a discovered event containing the discovery information that is of interest to the regInfo is built and sent to the regInfo's listener.

Parameters:
regInfo - the data structure record corresponding to the registration whose listener will receive the event
regsMap - mapping in which the key values are previously discovered registrars, and the map values are data structures of type LocatorGroupsStruct that contain the locator and member groups of the corresponding registrar key

externalDiscardRequest

private FiddlerImpl.RegistrationInfo externalDiscardRequest()
Examines the discardFlag for each active registration until a value of true is encountered or the set of registrations is exhausted. If that flag is false for all registrations, this method will return null; otherwise, it will return the registration found, but with the the value of the flag set back to false.

Returns:
the first instance of RegistrationInfo whose discardFlag is set to true; returns null if no such registration exists.

mapRegToGroups

private HashMap mapRegToGroups(ServiceRegistrar reg,
                               String[] groups)
Convenience method that creates and returns a mapping of a single ServiceRegistrar instance to a set of groups.

Parameters:
reg - instance of ServiceRegistrar corresponding to the registrar to use as the key to the mapping
groups - String array containing the current member groups of the registrar referenced by the reg parameter; and which is used as the value of the mapping
Returns:
Map instance containing a single mapping from a given registrar to its current member groups

maybeRemoveDiscardedRegsFromGlobalSet

private void maybeRemoveDiscardedRegsFromGlobalSet(Set discardedRegs)
Given a set of registrars that have just been discarded, this method determines which of those registrars are contained in none of the discovered sets of the active registrations; and then removes those registrars from the global maps of registrars that are maintained across all registrations. Note that this method must be called from within a synchronization block.

Parameters:
discardedRegs - set of registrars that were just discarded

maybeRemoveDiscardedRegFromGlobalSet

private void maybeRemoveDiscardedRegFromGlobalSet(Object dReg)
Given a registrar that has just been discarded, this method determines if that registrar is contained in none of the discovered sets of the active registrations; and then removes that registrar from the global maps of registrars that are maintained across all registrations. Note that this method must be called from within a synchronization block.

Parameters:
dReg - set of registrars that were just discarded

updateGroupsInGlobalSet

private void updateGroupsInGlobalSet(Map groupsMap)
For each registrar referenced in the global map allDiscoveredRegs, this method replaces the associated set of member groups with the corresponding set in the given registrars-to-groups map. This method should be called only after a changed event is received from the discovery manager. Note that this method must be called from within a synchronization block.

Parameters:
groupsMap - map containing the registrars and their new groups

buildEvent

private RemoteDiscoveryEvent buildEvent(FiddlerImpl.RegistrationInfo regInfo,
                                        Map groupsMap,
                                        boolean discarded)
This method constructs the appropriate remote discovery event from the information contained in the input parameters. This method encapsulates common exception-handling functionality. If the remote discovery event cannot be successfully constructed, null will be returned.

Parameters:
regInfo - the data structure record corresponding to the registration whose listener will receive the event
groupsMap - map containing the registrars, and their corresponding member groups, to include in the event
discarded - flag indicating whether the registrars included in the event have been discarded or discovered
Returns:
instance of RemoteDiscoveryEvent containing the appropriate information corresponding to the input registration record

queueEvent

private void queueEvent(FiddlerImpl.RegistrationInfo regInfo,
                        RemoteDiscoveryEvent event)
This method simply queues a new SendEventTask instance that will send the given remote event to the given registration's listener.

Parameters:
regInfo - the data structure record corresponding to the registration whose listener will receive the event
event - the instance of RemoteDiscoveryEvent to send to the registration's listener

takeSnapshot

private void takeSnapshot(OutputStream out)
                   throws IOException
Writes the current state of this service to persistent storage.

A 'snapshot' of the service's current state is represented by the data contained in certain fields defined in the service. That data represents many changes -- over time -- to the service's state. This method will record that data to a file referred to as the snapshot file.

The data written by this method to the snapshot file -- as well as the format of the file -- is shown below:

Each data item is written to the snapshot file in serialized form.

Throws:
IOException
See Also:
FiddlerImpl.LocalLogHandler

recoverSnapshot

private void recoverSnapshot(InputStream in)
                      throws IOException,
                             ClassNotFoundException
Retrieve the contents of the snapshot file and reconstitute the 'base' state of this service from the retrieved data.

Refer to takeSnapshot for a description of the data retrieved by this method from the snapshot file.

During recovery, the state of the service at the time of a crash or outage is re-constructed by first reconstituting the 'base state' from the snapshot file; and then modifying that base state according to the records retrieved from the log file. This method is invoked to perform the first step in that reconstruction. As each registered service or event is retrieved, it is inserted into its appropriate container object.

Because events can be generated before the next snapshot is taken, the event sequence numbers must be incremented. This is because the event specification requires that a set of event sequence numbers corresponding to an particular event type (a particular event ID) be monotonically increasing. Since the number of events that might have been sent is arbitrary, each sequence number will be incremented by a 'large' number so as to guarantee adherence to the specification.

Throws:
IOException
ClassNotFoundException
See Also:
takeSnapshot(java.io.OutputStream), FiddlerImpl.LocalLogHandler

addLogRecord

private void addLogRecord(FiddlerImpl.LogRecord rec)
Add a state-change record to persistent storage.

Whenever a significant change occurs to Fiddler's state, this method is invoked to record that change in a file called a log file. Each record written to the log file is an object reflecting both the data used and the ACTIONS taken to make one change to that state at a particular point in time. If the number of records contained in the log file exceeds the pre-defined threshold, a snapshot of Fiddler's current state will be recorded.

Whenever one of the following state changes occurs, this method will be invoked with the appropriate implementation of the LogRecord interface as the input argument.

See Also:
RegistrarImpl.LocalLogHandler

writeArrayElementsToString

private static String writeArrayElementsToString(Object[] arr)

writeArrayElements

private static void writeArrayElements(Object[] arr,
                                       Logger logger,
                                       Level level)

writeGroupArrayToString

private static String writeGroupArrayToString(String[] groups)

writeGroupArray

private static void writeGroupArray(String[] groups,
                                    Logger logger,
                                    Level level)

writeRegistrarsArray

private static void writeRegistrarsArray(ServiceRegistrar[] regs,
                                         Logger logger,
                                         Level level)

writeAttribute

private static void writeAttribute(Entry attr,
                                   Logger logger,
                                   Level level)

writeAttributes

private static void writeAttributes(Entry[] attrs,
                                    Logger logger,
                                    Level level)

logInfoStartup

private void logInfoStartup()

logInfoShutdown

private void logInfoShutdown()

logInfoTasks

private void logInfoTasks(String str)

logInfoEvents

private void logInfoEvents(String str)

logInfoEvents

private void logInfoEvents(Map groupsMap,
                           long eventID,
                           long seqNum,
                           MarshalledObject handback,
                           boolean discarded,
                           Logger logger,
                           Level level)

logInfoGroups

private void logInfoGroups()

logInfoGroups

private void logInfoGroups(String headerStr)

logInfoLocators

private void logInfoLocators()

logInfoDiscard

private void logInfoDiscard(String str,
                            Uuid regID)

logInfoDiscard

private void logInfoDiscard(String str)

logInfoLease

private void logInfoLease(String str,
                          Uuid regID,
                          Uuid leaseID)

logInfoRegistration

private void logInfoRegistration(String str,
                                 Object regInfo)

logInfoPersist

private static void logInfoPersist(String str)

logInfoAddLogRecord

private void logInfoAddLogRecord(FiddlerImpl.LogRecord rec)


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