class FiddlerImpl extends Object implements ServerProxyTrust, ProxyAccessor, Fiddler
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.
Modifier and Type | Class and Description |
---|---|
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.
|
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
FiddlerImpl(ActivationID activationID,
MarshalledObject data)
Constructs a new instance of FiddlerImpl.
|
FiddlerImpl(String[] configArgs,
LifeCycle lifeCycle,
boolean persistent)
Constructs a new instance of FiddlerImpl.
|
Modifier and Type | Method and Description |
---|---|
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) |
private static final String COMPONENT_NAME
static final Logger problemLogger
static final Logger startupLogger
static final Logger tasksLogger
static final Logger eventsLogger
static final Logger groupsLogger
static final Logger locatorsLogger
static final Logger discardLogger
static final Logger leaseLogger
static final Logger registrationLogger
static final Logger persistLogger
private static final String PRODUCT
private static final String MANUFACTURER
private static final String VENDOR
private static final String VERSION
private static final long MAX_LEASE
private static final int LOG_VERSION
private FiddlerProxy outerProxy
private Fiddler innerProxy
private FiddlerAdminProxy adminProxy
private ServiceID serviceID
private ActivationID activationID
private ActivationSystem activationSystem
private Uuid proxyID
private final HashMap allDiscoveredRegs
private final HashMap registrationByID
private final TreeMap registrationByTime
private LookupDiscoveryManager discoveryMgr
private final FiddlerImpl.LookupDiscoveryListener discoveryListener
private long curEventID
private long minExpiration
private DiscoveryManagement joinMgrLDM
private JoinManager joinMgr
private TaskManager taskMgr
private Thread leaseExpireThread
private Thread snapshotThread
private final ReadersWriter concurrentObj
private final Object leaseExpireThreadSyncObj
private final Object snapshotThreadSyncObj
private ReliableLog log
private boolean inRecovery
private int logFileSize
private String persistDir
private long leaseBound
private float snapshotWt
private int snapshotThresh
private String[] thisServicesGroups
private LookupLocator[] thisServicesLocators
private Entry[] thisServicesAttrs
private Configuration config
private LoginContext loginContext
private Exporter serverExporter
private long leaseMax
private boolean initialStartup
private LifeCycle lifeCycle
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.private static ProxyPreparer listenerPreparer
private static ProxyPreparer recoveredListenerPreparer
private static ProxyPreparer locatorToJoinPreparer
private static ProxyPreparer recoveredLocatorToJoinPreparer
private static ProxyPreparer locatorToDiscoverPreparer
private static ProxyPreparer recoveredLocatorToDiscoverPreparer
private final ReadyState readyState
FiddlerImpl(ActivationID activationID, MarshalledObject data) throws IOException, ActivationException, ConfigurationException, LoginException, ClassNotFoundException
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.
activationID
- the activation ID generated by the activation
system and assigned to the instance of the server
being activateddata
- state data (represented as a
MarshalledObject
) which is needed to
re-activate this serverIOException
- 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
parameterActivationException
- this exception can occur when a problem
occurs while activating the serviceLoginException
- this exception occurs when authentication
fails while performing a JAAS login for
this serviceClassNotFoundException
- 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(String[] configArgs, LifeCycle lifeCycle, boolean persistent) throws IOException, ConfigurationException, LoginException
configArgs
- String
array whose elements are
the arguments to use when creating this version of
the serverlifeCycle
- 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.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
parameterLoginException
- this exception occurs when authentication
fails while performing a JAAS login for
this servicepublic TrustVerifier getProxyVerifier() throws NoSuchObjectException
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.
getProxyVerifier
in interface ServerProxyTrust
TrustVerifier
which can be used to verify that
a given proxy to this service can be trusted.NoSuchObjectException
- if this method is called during
service initialization or shutdown processingUnsupportedOperationException
- if the server proxy does not
implement both
RemoteMethodControl
and TrustEquivalence
ServerProxyTrust.getProxyVerifier()
public Object getProxy()
ServiceStarter
to create an activatable
instance of this server.getProxy
in interface ProxyAccessor
public Object getAdmin() throws NoSuchObjectException, RemoteException
getAdmin
in interface Administrable
NoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- typically, this exception occurs when
there is a communication failure between the client and the
server.
see com.sun.jini.fiddler.FiddlerAdminProxy#getAdmin (?)Administrable.getAdmin()
public Entry[] getLookupAttributes() throws NoSuchObjectException, RemoteException
getLookupAttributes
in interface JoinAdmin
NoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- typically, this exception occurs when
there is a communication failure between the client and the
lookup discovery service.FiddlerAdminProxy.getLookupAttributes()
,
JoinAdmin.getLookupAttributes()
public void addLookupAttributes(Entry[] attrSets) throws NoSuchObjectException, RemoteException
addLookupAttributes
in interface JoinAdmin
attrSets
- array of net.jini.core.entry.Entry containing the
attribute sets to addNoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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.FiddlerAdminProxy.addLookupAttributes(net.jini.core.entry.Entry[])
,
JoinAdmin.addLookupAttributes(net.jini.core.entry.Entry[])
public void modifyLookupAttributes(Entry[] attrSetTemplates, Entry[] attrSets) throws NoSuchObjectException, RemoteException
modifyLookupAttributes
in interface JoinAdmin
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
modifiedattrSets
- array of net.jini.core.entry.Entry containing the
modifications to make to matching setsNoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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.FiddlerAdminProxy.modifyLookupAttributes(net.jini.core.entry.Entry[], net.jini.core.entry.Entry[])
,
JoinAdmin.modifyLookupAttributes(net.jini.core.entry.Entry[], net.jini.core.entry.Entry[])
public String[] getLookupGroups() throws NoSuchObjectException, RemoteException
getLookupGroups
in interface JoinAdmin
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.
NoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- typically, this exception occurs when
there is a communication failure between the client and the
lookup discovery service.FiddlerAdminProxy.getLookupGroups()
,
JoinAdmin.getLookupGroups()
public void addLookupGroups(String[] groups) throws NoSuchObjectException, RemoteException
addLookupGroups
in interface JoinAdmin
groups
- String array containing the names of the groups to addNoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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.FiddlerAdminProxy.addLookupGroups(java.lang.String[])
,
JoinAdmin.addLookupGroups(java.lang.String[])
public void removeLookupGroups(String[] groups) throws NoSuchObjectException, RemoteException
removeLookupGroups
in interface JoinAdmin
groups
- String array containing the names of the groups to removeNoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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.FiddlerAdminProxy.removeLookupGroups(java.lang.String[])
,
JoinAdmin.removeLookupGroups(java.lang.String[])
public void setLookupGroups(String[] groups) throws NoSuchObjectException, RemoteException
setLookupGroups
in interface JoinAdmin
groups
- String array containing the names of the new groupsNoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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.FiddlerAdminProxy.setLookupGroups(java.lang.String[])
,
JoinAdmin.setLookupGroups(java.lang.String[])
public LookupLocator[] getLookupLocators() throws NoSuchObjectException, RemoteException
getLookupLocators
in interface JoinAdmin
NoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- typically, this exception occurs when
there is a communication failure between the client and the
lookup discovery service.FiddlerAdminProxy.getLookupLocators()
,
JoinAdmin.getLookupLocators()
public void addLookupLocators(LookupLocator[] locators) throws NoSuchObjectException, RemoteException
Any lookup services corresponding to the new locators that the lookup discovery service has not yet joined, will be discovered and joined.
addLookupLocators
in interface JoinAdmin
locators
- array of net.jini.core.discovery.LookupLocator objects to add
to the managed set of locatorsNoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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.FiddlerAdminProxy.addLookupLocators(net.jini.core.discovery.LookupLocator[])
,
JoinAdmin.addLookupLocators(net.jini.core.discovery.LookupLocator[])
public void removeLookupLocators(LookupLocator[] locators) throws NoSuchObjectException, RemoteException
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.
removeLookupLocators
in interface JoinAdmin
locators
- array of net.jini.core.discovery.LookupLocator objects to
remove from the managed set of locatorsNoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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.FiddlerAdminProxy.removeLookupLocators(net.jini.core.discovery.LookupLocator[])
,
JoinAdmin.removeLookupLocators(net.jini.core.discovery.LookupLocator[])
public void setLookupLocators(LookupLocator[] locators) throws NoSuchObjectException, RemoteException
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.
setLookupLocators
in interface JoinAdmin
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 locatorsNoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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.FiddlerAdminProxy.setLookupLocators(net.jini.core.discovery.LookupLocator[])
,
JoinAdmin.setLookupLocators(net.jini.core.discovery.LookupLocator[])
public void destroy() throws NoSuchObjectException, RemoteException
destroy
in interface DestroyAdmin
NoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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.FiddlerAdminProxy.destroy()
,
DestroyAdmin.destroy()
public void setLeaseBound(long newBound) throws NoSuchObjectException, RemoteException
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.
setLeaseBound
in interface FiddlerAdmin
newBound
- long
value representing the new least
upper bound (in milliseconds) on the set of all possible
lease durations that may be grantedNoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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.FiddlerAdminProxy.setLeaseBound(long)
,
FiddlerAdmin.setLeaseBound(long)
public long getLeaseBound() throws NoSuchObjectException, RemoteException
getLeaseBound
in interface FiddlerAdmin
long
value representing the current least
upper bound (in milliseconds) on the set of all possible
lease durations that may be grantedNoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- typically, this exception occurs when
there is a communication failure between the client and the
lookup discovery service.FiddlerAdminProxy.getLeaseBound()
,
FiddlerAdmin.getLeaseBound()
public void setPersistenceSnapshotWeight(float weight) throws NoSuchObjectException, RemoteException
setPersistenceSnapshotWeight
in interface FiddlerAdmin
weight
- weight factor for snapshot sizeNoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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.FiddlerAdminProxy.setPersistenceSnapshotWeight(float)
,
FiddlerAdmin.setPersistenceSnapshotWeight(float)
public float getPersistenceSnapshotWeight() throws NoSuchObjectException, RemoteException
getPersistenceSnapshotWeight
in interface FiddlerAdmin
NoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- typically, this exception occurs when
there is a communication failure between the client and the
lookup discovery service.FiddlerAdminProxy.getPersistenceSnapshotWeight()
,
FiddlerAdmin.getPersistenceSnapshotWeight()
public void setPersistenceSnapshotThreshold(int threshold) throws NoSuchObjectException, RemoteException
setPersistenceSnapshotThreshold
in interface FiddlerAdmin
threshold
- size threshold for taking a snapshotNoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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.#setPersistenceSnapshotThreshold
,
FiddlerAdmin.setPersistenceSnapshotThreshold(int)
public int getPersistenceSnapshotThreshold() throws NoSuchObjectException, RemoteException
getPersistenceSnapshotThreshold
in interface FiddlerAdmin
NoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- typically, this exception occurs when
there is a communication failure between the client and the
lookup discovery service.#getPersistenceSnapshotThreshold
,
FiddlerAdmin.getPersistenceSnapshotThreshold()
public Object getServiceProxy() throws NoSuchObjectException
ServiceStarter
to create an activatable
instance of this server.getServiceProxy
in interface ServiceProxyAccessor
NoSuchObjectException
- if this method is called during
service initialization or shutdown processingpublic Uuid getProxyID() throws NoSuchObjectException, RemoteException
getProxyID
in interface Fiddler
NoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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.public LookupDiscoveryRegistration register(String[] groups, LookupLocator[] locators, RemoteEventListener listener, MarshalledObject handback, long leaseDuration) throws NoSuchObjectException, RemoteException
register
in interface Fiddler
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.NoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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.LookupDiscoveryService
public MarshalledObject[] getRegistrars(Uuid registrationID) throws NoSuchObjectException, RemoteException, ThrowThis
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.
getRegistrars
in interface Fiddler
registrationID
- unique identifier assigned to the registration
from which the set of registrars is being
retrievedNoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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.FiddlerRegistration.getRegistrars()
,
LookupDiscoveryRegistration.getRegistrars()
public String[] getGroups(Uuid registrationID) throws NoSuchObjectException, RemoteException, ThrowThis
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.
getGroups
in interface Fiddler
registrationID
- unique identifier assigned to the registration
from which the set of groups is being retrievedNoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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
FiddlerRegistration.getGroups()
,
LookupDiscoveryRegistration.getGroups()
public LookupLocator[] getLocators(Uuid registrationID) throws NoSuchObjectException, RemoteException, ThrowThis
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.
getLocators
in interface Fiddler
registrationID
- unique identifier assigned to the registration
from which the set of locators is being retrievedNoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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
FiddlerRegistration.getLocators()
,
LookupDiscoveryRegistration.getLocators()
public void addGroups(Uuid registrationID, String[] groups) throws NoSuchObjectException, RemoteException, ThrowThis
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.
addGroups
in interface Fiddler
registrationID
- unique identifier assigned to the registration
to which the set of groups being augmented
correspondsgroups
- 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
.
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 processingRemoteException
- 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
FiddlerRegistration.addGroups(java.lang.String[])
,
LookupDiscoveryRegistration.addGroups(java.lang.String[])
public void setGroups(Uuid registrationID, String[] groups) throws NoSuchObjectException, RemoteException, ThrowThis
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.
setGroups
in interface Fiddler
registrationID
- unique identifier assigned to the registration
to which the set of groups being replaced
correspondsgroups
- 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.
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 processingRemoteException
- 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
FiddlerRegistration.setGroups(java.lang.String[])
,
LookupDiscoveryRegistration.setGroups(java.lang.String[])
public void removeGroups(Uuid registrationID, String[] groups) throws NoSuchObjectException, RemoteException, ThrowThis
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.
removeGroups
in interface Fiddler
registrationID
- unique identifier assigned to the registration
to which the set of groups being removed
correspondsgroups
- 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
.
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 processingRemoteException
- 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
FiddlerRegistration.removeGroups(java.lang.String[])
,
LookupDiscoveryRegistration.removeGroups(java.lang.String[])
public void addLocators(Uuid registrationID, LookupLocator[] locators) throws NoSuchObjectException, RemoteException, ThrowThis
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.
addLocators
in interface Fiddler
registrationID
- unique identifier assigned to the registration
to which the set of locators being augmented
correspondslocators
- 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
.
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 processingRemoteException
- 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
FiddlerRegistration.addLocators(net.jini.core.discovery.LookupLocator[])
,
LookupDiscoveryRegistration.addLocators(net.jini.core.discovery.LookupLocator[])
public void setLocators(Uuid registrationID, LookupLocator[] locators) throws NoSuchObjectException, RemoteException, ThrowThis
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.
setLocators
in interface Fiddler
registrationID
- unique identifier assigned to the registration
to which the set of locators being replaced
correspondslocators
- 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
.
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 processingRemoteException
- 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
FiddlerRegistration.setLocators(net.jini.core.discovery.LookupLocator[])
,
LookupDiscoveryRegistration.setLocators(net.jini.core.discovery.LookupLocator[])
public void removeLocators(Uuid registrationID, LookupLocator[] locators) throws NoSuchObjectException, RemoteException, ThrowThis
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.
removeLocators
in interface Fiddler
registrationID
- unique identifier assigned to the registration
to which the set of locators being removed
correspondslocators
- 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
.
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 processingRemoteException
- 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
FiddlerRegistration.removeLocators(net.jini.core.discovery.LookupLocator[])
,
LookupDiscoveryRegistration.removeLocators(net.jini.core.discovery.LookupLocator[])
public void discard(Uuid registrationID, ServiceRegistrar registrar) throws NoSuchObjectException, RemoteException, ThrowThis
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.
discard
in interface Fiddler
registrationID
- unique identifier assigned to the registration
making the current discard requestregistrar
- 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.
NullPointerException
- this exception occurs when
null is input to the registrar parameter.NoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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
FiddlerRegistration.discard(net.jini.core.lookup.ServiceRegistrar)
,
LookupDiscoveryRegistration.discard(net.jini.core.lookup.ServiceRegistrar)
public long renewLease(Uuid registrationID, Uuid leaseID, long duration) throws UnknownLeaseException, NoSuchObjectException, RemoteException
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.
renewLease
in interface Fiddler
registrationID
- unique identifier assigned to the registration
to which the lease being renewed correspondsleaseID
- identifier assigned by the lease grantor to the
lease being renewedduration
- the requested duration for the lease being renewedlong
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.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 processingRemoteException
- 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.Lease.renew(long)
,
AbstractLease.renew(long)
,
AbstractLease.doRenew(long)
,
FiddlerLease.doRenew(long)
public FiddlerRenewResults renewLeases(Uuid[] registrationIDs, Uuid[] leaseIDs, long[] durations) throws NoSuchObjectException, RemoteException
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.
renewLeases
in interface Fiddler
registrationIDs
- array containing the unique identifiers assigned
to the each registration to which each lease
to be renewed correspondsleaseIDs
- array containing the identifiers assigned by the
lease grantor to each lease being reneweddurations
- array containing the requested durations for
each lease being renewedNoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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.LeaseMap.renewAll()
public void cancelLease(Uuid registrationID, Uuid leaseID) throws UnknownLeaseException, NoSuchObjectException, RemoteException
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.
cancelLease
in interface Fiddler
registrationID
- unique identifier assigned to the registration
to which the lease being cancelled correspondsleaseID
- identifier assigned by the lease grantor to the
lease that is to be cancelledUnknownLeaseException
- 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 processingRemoteException
- 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.Lease.cancel()
public Exception[] cancelLeases(Uuid[] registrationIDs, Uuid[] leaseIDs) throws NoSuchObjectException, RemoteException
LeaseMap
.
For each element in the registrationIDs
parameter,
this method will cancel the corresponding element in the
leaseIDs
parameter.
cancelLeases
in interface Fiddler
registrationIDs
- array containing the unique identifiers assigned
to the each registration to which each lease
to be cancelled correspondsleaseIDs
- array containing the identifiers assigned by the
lease grantor to each lease being cancelledNoSuchObjectException
- if this method is called during
service initialization or shutdown processingRemoteException
- 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.LeaseMap.cancelAll()
private static Object[] appendArray(Object[] array, Object elt)
private static long applyBoundToLeaseDuration(long leaseDuration, long bound)
bound
parameter,
and checks for negative value.private static boolean containsNullElement(Object[] arr)
arr
- Object array to examine for null elementsprivate static boolean interested(String[] regGroups, Set desiredGroups)
regGroups
- array of the member groups from the registrar
(cannot be null)desiredGroups
- groups the registration wishes to discover
(can be null = ALL_GROUPS)true
if at least one of the registrar's member
groups is contained in the registration's set of groups to
discover; false
otherwiseprivate static boolean interested(LookupLocator regLoc, String[] regGroups, Set desiredLocators, Set desiredGroups)
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 discoverdesiredGroups
- groups the registration wishes to discover
(can be null = ALL_GROUPS)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
otherwiseprivate static HashMap getUndesiredRegsByGroup(Map regMap, FiddlerImpl.RegistrationInfo regInfo)
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.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 mappingregInfo
- 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 mappingregMap
parameter, and belongs to none
of the desired groups referenced in the regInfo
parameterprivate static Map getUndesiredRegsByLocator(Map regMap, FiddlerImpl.RegistrationInfo regInfo)
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.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 mappingregInfo
- 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 mappingregMap
parameter, and has
a locator equal to none of the desired locators referenced
in the regInfo
parameterprivate static MarshalledObject[] marshalAttributes(FiddlerImpl fiddlerImpl, Entry[] attrs)
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.fiddlerImpl
- reference to the current instance of this serviceattrs
- Entry[]
array consisting of the
attributes to marshalMarshalledObject[]
, where each element
corresponds to an attribute in marshalled formprivate static Entry[] unmarshalAttributes(FiddlerImpl fiddlerImpl, MarshalledObject[] marshalledAttrs)
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.fiddlerImpl
- reference to the current instance of this servicemarshalledAttrs
- MarshalledObject[]
array consisting
of the attributes to unmarshalEntry[]
, where each element corresponds
to an attribute that was successfully unmarshalledprivate static void prepareNewLocators(ProxyPreparer preparer, LookupLocator[] locators) throws RemoteException
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:
addLookupLocators
setLookupLocators
removeLookupLocators
addLocators
setLocators
removeLocators
preparer
- the preparer to use to prepare each element of the
input arraylocators
- array of LookupLocator
instances in which
each element will be prepared.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
private static LookupLocator[] prepareOldLocators(ProxyPreparer preparer, LookupLocator[] locators)
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.preparer
- the preparer to use to prepare each element of the
input arraylocators
- array of LookupLocator
instances in which
each element will be prepared.LookupLocator
instances in which each
element of the returned array is the result of successful proxy
preparation of the corresponding element of the input arrayprivate static Set prepareOldLocators(ProxyPreparer preparer, Set locators)
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.preparer
- the preparer to use to prepare each element of the
input arraylocators
- Set
of LookupLocator
instances in which each element will be prepared.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
private static boolean locSetContainsLoc(Set locSet, LookupLocator loc)
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.locSet
- this method will determine whether or not the given
locator is contained in this Set
of
LookupLocator
s.loc
- this method will determine whether or not this
LookupLocator
is contained in the given set.true
if the given set of locators contains the
given locator; false
otherwise.private void init(String[] configArgs, boolean persistent) throws IOException, ConfigurationException, LoginException
private void initWithLogin(Configuration config, boolean persistent, LoginContext loginContext) throws IOException, ConfigurationException, LoginException
Subject
referenced
in the given loginContext
.private void doInit(Configuration config, boolean persistent) throws IOException, ConfigurationException
IOException
ConfigurationException
private void cleanupInitFailure()
private void handleActivatableInitThrowable(Throwable t) throws IOException, ActivationException, ConfigurationException, LoginException, ClassNotFoundException
private void handleInitThrowable(Throwable t) throws IOException, ConfigurationException, LoginException
private void destroyDo()
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.destroy()
private LookupDiscoveryRegistration registerDo(String[] groups, LookupLocator[] locators, RemoteEventListener listener, MarshalledObject handback, long leaseDuration) throws RemoteException, IOException
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.
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.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
register(java.lang.String[], net.jini.core.discovery.LookupLocator[], net.jini.core.event.RemoteEventListener, java.rmi.MarshalledObject, long)
private void addRegistration(FiddlerImpl.RegistrationInfo regInfo) throws IOException
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).regInfo
- the data structure record corresponding to the
registration that is to be added to the data baseIOException
- this exception occurs when the multicast
request protocol fails to start.registerDo(java.lang.String[], net.jini.core.discovery.LookupLocator[], net.jini.core.event.RemoteEventListener, java.rmi.MarshalledObject, long)
,
recoverSnapshot(java.io.InputStream)
private void removeRegistration(FiddlerImpl.RegistrationInfo regInfo) throws IOException
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).regInfo
- the data structure record corresponding to the
registration that is to be removed from the data baseIOException
- this exception occurs when the multicast
request protocol fails to start.cancelLeaseDo(com.sun.jini.fiddler.FiddlerImpl.RegistrationInfo, net.jini.id.Uuid)
private void addGroupsDo(FiddlerImpl.RegistrationInfo regInfo, String[] groups)
addGroups
. This method
queues an AddGroupsTask
which performs the actual
augmentation of the given registration's desired groups.regInfo
- the data structure record corresponding to the
registration whose managed set of groups is to be
augmentedgroups
- 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.addGroups(net.jini.id.Uuid, java.lang.String[])
,
FiddlerRegistration.addGroups(java.lang.String[])
,
LookupDiscoveryRegistration.addGroups(java.lang.String[])
private void addGroupsDo(Uuid registrationID, HashMap registrationByID, String[] groups)
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.
registrationID
- the ID of the data structure record
corresponding to the registration whose
managed set of groups is to be augmentedregistrationByID
- the map containing all active registrations
managed by this servicegroups
- 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.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[])
private void setGroupsDo(FiddlerImpl.RegistrationInfo regInfo, String[] groups)
setGroups
. This method
queues a SetGroupsTask
which performs the actual
replacement.regInfo
- the data structure record corresponding to the
registration whose managed set of groups is to be
replacedgroups
- 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.setGroups(net.jini.id.Uuid, java.lang.String[])
,
FiddlerRegistration.setGroups(java.lang.String[])
,
LookupDiscoveryRegistration.setGroups(java.lang.String[])
private void setGroupsDo(Uuid registrationID, HashMap registrationByID, String[] groups)
apply
method of the class
GroupsSetInRegistrationLogObj
(which is invoked
during state recovery). This method queues a
SetGroupsTask
which performs the actual replacement.
registrationID
- the ID of the data structure record
corresponding to the registration whose
managed set of groups is to be replacedregistrationByID
- the map containing all active registrations
managed by this servicegroups
- 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.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[])
private void removeGroupsDo(FiddlerImpl.RegistrationInfo regInfo, String[] groups)
removeGroups
. This method
queues a RemoveGroupsTask
which performs the actual
removal.regInfo
- the data structure record corresponding to the
registration from whose managed set of groups the input
set of groups is to be removedgroups
- a String array, none of whose elements may be null,
consisting of the group names to remove from the
registration's managed set of groupsremoveGroups(net.jini.id.Uuid, java.lang.String[])
,
FiddlerRegistration.removeGroups(java.lang.String[])
,
LookupDiscoveryRegistration.removeGroups(java.lang.String[])
private void removeGroupsDo(Uuid registrationID, HashMap registrationByID, String[] groups)
apply
method of the class
GroupsRemovedFromRegistrationLogObj
(which is
invoked during state recovery). This method queues a
RemoveGroupsTask
which performs the actual removal.
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 removedregistrationByID
- the map containing all active registrations
managed by this servicegroups
- a String
array, none of whose
elements may be null, consisting of the group
names to remove from the registration's managed
set of groupsremoveGroupsDo(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[])
private String[] getGroupsFromAllRegs()
private HashMap getDesiredRegsByGroup(FiddlerImpl.RegistrationInfo regInfo)
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.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 mappingallDiscoveredRegs
, 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 keyprivate void updateDiscoveryMgrGroups()
private void addLocatorsDo(FiddlerImpl.RegistrationInfo regInfo, LookupLocator[] locators)
addLocators
. This method
queues an AddLocatorsTask
which performs the actual
augmentation of the given registration's desired locators.regInfo
- the data structure record corresponding to the
registration whose managed set of locators is to be
augmentedlocators
- 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.addLocators(net.jini.id.Uuid, net.jini.core.discovery.LookupLocator[])
,
FiddlerRegistration.addLocators(net.jini.core.discovery.LookupLocator[])
,
LookupDiscoveryRegistration.addLocators(net.jini.core.discovery.LookupLocator[])
private void addLocatorsDo(Uuid registrationID, HashMap registrationByID, LookupLocator[] locators)
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.
registrationID
- the ID of the data structure record
corresponding to the registration whose
managed set of locators is to be augmentedregistrationByID
- the map containing all active registrations
managed by this servicelocators
- 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.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[])
private void setLocatorsDo(FiddlerImpl.RegistrationInfo regInfo, LookupLocator[] locators)
setLocators
. This method
queues a SetLocatorsTask
which performs the
actual replacement.regInfo
- the data structure record corresponding to the
registration whose managed set of locators is to be
replacedlocators
- 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.setLocators(net.jini.id.Uuid, net.jini.core.discovery.LookupLocator[])
,
FiddlerRegistration.setLocators(net.jini.core.discovery.LookupLocator[])
,
LookupDiscoveryRegistration.setLocators(net.jini.core.discovery.LookupLocator[])
private void setLocatorsDo(Uuid registrationID, HashMap registrationByID, LookupLocator[] locators)
apply
method of the class
LocsSetInRegistrationLogObj
(which is invoked
during state recovery). This method queues a
SetLocatorsTask
which performs the actual replacement.
registrationID
- the ID of the data structure record
corresponding to the registration whose
managed set of locators is to be replacedregistrationByID
- the map containing all active registrations
managed by this servicelocators
- 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.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[])
private void removeLocatorsDo(FiddlerImpl.RegistrationInfo regInfo, LookupLocator[] locators)
removeLocators
. This method
queues a RemoveLocatorsTask
which performs the
actual removal.regInfo
- the data structure record corresponding to the
registration from whose managed set of locators the
input set of locators is to be removedlocators
- an array, none of whose elements may be null,
consisting of the LookupLocator
objects
to remove from the registration's managed set of
locators.removeLocators(net.jini.id.Uuid, net.jini.core.discovery.LookupLocator[])
,
FiddlerRegistration.removeLocators(net.jini.core.discovery.LookupLocator[])
,
LookupDiscoveryRegistration.removeLocators(net.jini.core.discovery.LookupLocator[])
private void removeLocatorsDo(Uuid registrationID, HashMap registrationByID, LookupLocator[] locators)
apply
method of the class
LocsRemovedFromRegistrationLogObj
(which is
invoked during state recovery). This method queues a
RemoveLocatorsTask
which performs the actual removal.
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 removedregistrationByID
- the map containing all active registrations
managed by this servicelocators
- an array, none of whose elements may be null,
consisting of the LookupLocator
objects to remove from the registration's
managed set of locators.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[])
private LookupLocator[] getLocatorsFromAllRegs()
private HashMap getDesiredRegsByLocator(FiddlerImpl.RegistrationInfo regInfo)
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.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 mappingallDiscoveredRegs
, 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 keyprivate void updateDiscoveryMgrLocators()
private long renewLeaseDo(FiddlerImpl.RegistrationInfo regInfo, Uuid leaseID, long duration) throws UnknownLeaseException
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.regInfo
- the data structure record corresponding to the
registration whose lease is to be renewedleaseID
- identifier assigned by the lease grantor to the lease
that is to be renewedduration
- the requested duration for the lease being renewedlong
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.UnknownLeaseException
- this exception occurs
when the lease being renewed is unknown to the lease grantor.renewLease(net.jini.id.Uuid, net.jini.id.Uuid, long)
private long renewLeaseInt(FiddlerImpl.RegistrationInfo regInfo, Uuid leaseID, long duration, long curTime) throws UnknownLeaseException
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.regInfo
- the data structure record corresponding to the
registration whose lease is to be renewedleaseID
- identifier assigned by the lease grantor to the lease
that is to be renewedduration
- the requested duration for the lease being renewedlong
value representing the new absolute
expiration time granted for the renewed lease.UnknownLeaseException
- this exception occurs
when the lease being renewed is unknown to the lease grantor.renewLeaseDo(com.sun.jini.fiddler.FiddlerImpl.RegistrationInfo, net.jini.id.Uuid, long)
private void renewLeaseAbs(FiddlerImpl.RegistrationInfo regInfo, Uuid leaseID, long expiration)
regInfo
and leaseID
parameters, granting a requested absolute
expiration time for that lease.regInfo
- the data structure record corresponding to the
registration whose lease is to be renewedleaseID
- identifier assigned by the lease grantor to the lease
that is to be renewedexpiration
- the requested absolute expiration time for the lease
being renewedprivate void renewLeaseAbs(Uuid registrationID, HashMap registrationByID, Uuid leaseID, long expiration)
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.registrationID
- the ID of the data structure record
corresponding to the registration whose
lease is to be renewedregistrationByID
- the map containing all active registrations
managed by this serviceleaseID
- identifier assigned by the lease grantor to
the lease that is to be renewedexpiration
- the requested absolute expiration time for the
lease being renewedrenewLeaseDo(com.sun.jini.fiddler.FiddlerImpl.RegistrationInfo, net.jini.id.Uuid, long)
private FiddlerRenewResults renewLeasesDo(Uuid[] registrationIDs, Uuid[] leaseIDs, long[] durations)
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.
registrationIDs
- array containing the unique identifiers assigned
to the each registration to which each lease
to be renewed correspondsleaseIDs
- array containing the identifiers assigned by the
lease grantor to each lease being reneweddurations
- array containing the requested durations for
each lease being renewedrenewLeases(net.jini.id.Uuid[], net.jini.id.Uuid[], long[])
private void renewLeasesAbs(Uuid[] registrationIDs, Uuid[] leaseIDs, long[] expirations)
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.
registrationIDs
- array containing the unique identifiers assigned
to the each registration to which each lease
to be renewed correspondsleaseIDs
- array containing the identifiers assigned by the
lease grantor to each lease being renewedexpirations
- array containing the absolute expiration times
to which to renew each leaserenewLeases(net.jini.id.Uuid[], net.jini.id.Uuid[], long[])
,
renewLeaseAbs(com.sun.jini.fiddler.FiddlerImpl.RegistrationInfo, net.jini.id.Uuid, long)
private void cancelLeaseDo(FiddlerImpl.RegistrationInfo regInfo, Uuid leaseID) throws UnknownLeaseException, IOException
cancelLease
. This method
cancels the lease on the registration corresponding to the
regInfo
and leaseID
parameters.regInfo
- the data structure record corresponding to the
registration whose lease is to be cancelledleaseID
- identifier assigned by the lease grantor to the lease
that is to be cancelledUnknownLeaseException
- 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.cancelLease(net.jini.id.Uuid, net.jini.id.Uuid)
private void cancelLeaseDo(Uuid registrationID, HashMap registrationByID, Uuid leaseID) throws UnknownLeaseException, IOException
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.registrationID
- the ID of the data structure record
corresponding to the registration whose
lease is to be cancelledregistrationByID
- the map containing all active registrations
managed by this serviceleaseID
- identifier assigned by the lease grantor to
the lease that is to be cancelledUnknownLeaseException
- 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.cancelLeaseDo(com.sun.jini.fiddler.FiddlerImpl.RegistrationInfo, net.jini.id.Uuid)
,
cancelLease(net.jini.id.Uuid, net.jini.id.Uuid)
private Exception[] cancelLeasesDo(Uuid[] registrationIDs, Uuid[] leaseIDs)
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.
cancelLeases(net.jini.id.Uuid[], net.jini.id.Uuid[])
private ServiceRegistrar[] intersectRegSets(ServiceRegistrar[] regs0, ServiceRegistrar[] regs1)
private boolean regIsElementOfRegSet(ServiceRegistrar reg, ServiceRegistrar[] regSet)
private void maybeSendDiscoveredEvent(FiddlerImpl.RegistrationInfo regInfo, Map regsMap)
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.regInfo
- the data structure record corresponding to the
registration whose listener will receive the eventregsMap
- 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 keyprivate FiddlerImpl.RegistrationInfo externalDiscardRequest()
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
.RegistrationInfo
whose
discardFlag
is set to true
;
returns null
if no such registration exists.private HashMap mapRegToGroups(ServiceRegistrar reg, String[] groups)
ServiceRegistrar
instance to a set of groups.reg
- instance of ServiceRegistrar
corresponding to the registrar to use as the key
to the mappinggroups
- String
array containing the current
member groups of the registrar referenced by the
reg
parameter; and which is used
as the value of the mappingMap
instance containing a single mapping from
a given registrar to its current member groupsprivate void maybeRemoveDiscardedRegsFromGlobalSet(Set discardedRegs)
discardedRegs
- set of registrars that were just discardedprivate void maybeRemoveDiscardedRegFromGlobalSet(Object dReg)
dReg
- set of registrars that were just discardedprivate void updateGroupsInGlobalSet(Map groupsMap)
groupsMap
- map containing the registrars and their new groupsprivate RemoteDiscoveryEvent buildEvent(FiddlerImpl.RegistrationInfo regInfo, Map groupsMap, boolean discarded)
regInfo
- the data structure record corresponding to the
registration whose listener will receive the eventgroupsMap
- map containing the registrars, and their corresponding
member groups, to include in the eventdiscarded
- flag indicating whether the registrars included in
the event have been discarded or discoveredRemoteDiscoveryEvent
containing the
appropriate information corresponding to the input registration
recordprivate void queueEvent(FiddlerImpl.RegistrationInfo regInfo, RemoteDiscoveryEvent event)
SendEventTask
instance
that will send the given remote event to the given registration's
listener.regInfo
- the data structure record corresponding to the
registration whose listener will receive the eventevent
- the instance of RemoteDiscoveryEvent
to
send to the registration's listenerprivate void takeSnapshot(OutputStream out) throws IOException
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:
IOException
FiddlerImpl.LocalLogHandler
private void recoverSnapshot(InputStream in) throws IOException, ClassNotFoundException
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.
private void addLogRecord(FiddlerImpl.LogRecord rec)
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.
RegistrarImpl.LocalLogHandler
private static void writeRegistrarsArray(ServiceRegistrar[] regs, Logger logger, Level level)
private void logInfoStartup()
private void logInfoShutdown()
private void logInfoTasks(String str)
private void logInfoEvents(String str)
private void logInfoEvents(Map groupsMap, long eventID, long seqNum, MarshalledObject handback, boolean discarded, Logger logger, Level level)
private void logInfoGroups()
private void logInfoGroups(String headerStr)
private void logInfoLocators()
private void logInfoDiscard(String str)
private static void logInfoPersist(String str)
private void logInfoAddLogRecord(FiddlerImpl.LogRecord rec)
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.