class RegistrarImpl extends Object implements Registrar, ProxyAccessor, ServerProxyTrust, Startable
Modifier and Type | Class and Description |
---|---|
private static class |
RegistrarImpl.AddressTask
Address for unicast discovery response.
|
private static class |
RegistrarImpl.AllItemIter
Iterate over all Items.
|
private static class |
RegistrarImpl.Announce
Multicast discovery announcement thread code.
|
private static class |
RegistrarImpl.AttrItemIter
Iterate over all matching Items by attribute value.
|
private static class |
RegistrarImpl.AttrsAddedLogObj
LogObj class whose instances are recorded to the log file whenever
new attributes are added to an existing service in the Registrar.
|
private static class |
RegistrarImpl.AttrsModifiedLogObj
LogObj class whose instances are recorded to the log file whenever
existing attributes of an existing service in the Registrar are
modified.
|
private static class |
RegistrarImpl.AttrsSetLogObj
LogObj class whose instances are recorded to the log file whenever
new attributes are set on an existing service in the Registrar.
|
private class |
RegistrarImpl.ClassItemIter
Iterate over all matching Items by entry class, dups possible.
|
private static class |
RegistrarImpl.DecodeRequestTask
Task for decoding multicast request packets.
|
private static class |
RegistrarImpl.Destroy
Termination thread code.
|
private static class |
RegistrarImpl.EventExpire
Event lease expiration thread code
|
private static class |
RegistrarImpl.EventLeaseCancelledLogObj
LogObj class whose instances are recorded to the log file whenever
a lease on a registered event is cancelled.
|
private static class |
RegistrarImpl.EventLeaseRenewedLogObj
LogObj class whose instances are recorded to the log file whenever
a lease on a registered event is renewed.
|
private static class |
RegistrarImpl.EventReg
An event registration record.
|
private static class |
RegistrarImpl.EventRegisteredLogObj
LogObj class whose instances are recorded to the log file whenever
a new event is registered.
|
private static class |
RegistrarImpl.EventTask
An event to be sent, and the listener to send it to.
|
private static class |
RegistrarImpl.IDItemIter
Iterate over a singleton matching Item by serviceID.
|
private static class |
RegistrarImpl.Initializer
Reggie Initializer
|
private static class |
RegistrarImpl.ItemIter
Base class for iterating over all Items that match a Template.
|
private static class |
RegistrarImpl.LeasesCancelledLogObj
LogObj class whose instances are recorded to the log file whenever
lease are cancelled via a LeaseMap.
|
private static class |
RegistrarImpl.LeasesRenewedLogObj
LogObj class whose instances are recorded to the log file whenever
a leases in the Registrar is renewed via a LeaseMap.
|
private static class |
RegistrarImpl.LocalLogHandler
Handler class for the persistent storage facility.
|
private static interface |
RegistrarImpl.LogRecord
Interface defining the method(s) that must be implemented by each of
the concrete LogObj classes.
|
private static class |
RegistrarImpl.LookupAttributesChangedLogObj
LogObj class whose instances are recorded to the log file whenever
the attributes for the lookup service are changed.
|
private static class |
RegistrarImpl.LookupGroupsChangedLogObj
LogObj class whose instances are recorded to the log file whenever
the set of groups to join is changed.
|
private static class |
RegistrarImpl.LookupLocatorsChangedLogObj
LogObj class whose instances are recorded to the log file whenever
the set of locators of lookup services to join is changed.
|
private static class |
RegistrarImpl.MemberGroupsChangedLogObj
LogObj class whose instances are recorded to the log file whenever
the memberGroups array is set to reference a new array of strings.
|
private static class |
RegistrarImpl.Multicast
Multicast discovery request thread code.
|
private static class |
RegistrarImpl.ServiceExpire
Service lease expiration thread code
|
private static class |
RegistrarImpl.ServiceLeaseCancelledLogObj
LogObj class whose instances are recorded to the log file whenever
a lease on an existing service in the Registrar is cancelled.
|
private static class |
RegistrarImpl.ServiceLeaseRenewedLogObj
LogObj class whose instances are recorded to the log file whenever
a lease on an existing service in the Registrar is renewed.
|
private static class |
RegistrarImpl.Snapshot
Snapshot-taking thread.
|
private static class |
RegistrarImpl.SocketTask
Socket for unicast discovery response.
|
private static class |
RegistrarImpl.SvcIterator
Iterates over all services that match template's service types
|
private static class |
RegistrarImpl.SvcReg
A service item registration record.
|
private static class |
RegistrarImpl.SvcRegisteredLogObj
LogObj class whose instances are recorded to the log file whenever
a new service is registered.
|
private static class |
RegistrarImpl.Unicast
Unicast discovery request thread code.
|
private static class |
RegistrarImpl.UnicastPortSetLogObj
LogObj class whose instances are recorded to the log file whenever
the Unicast Port Number is set to a new value.
|
Modifier and Type | Field and Description |
---|---|
private ActivationID |
activationID
Our activation id, or null if not activatable
|
private ActivationSystem |
activationSystem
Associated activation system, or null if not activatable
|
private java.util.concurrent.atomic.AtomicLong |
announcementSeqNo
Multicast announcement sequence number
|
private Thread |
announcer
Multicast discovery announcement sending thread
|
private static Entry[] |
baseAttrs
Base set of initial attributes for self
|
private static String |
COMPONENT
Logger and configuration component name
|
private ReadersWriter |
concurrentObj
Concurrent object to control read and write access
|
private Configuration |
config |
private Exception |
constructionException |
private AccessControlContext |
context |
private static int |
DEFAULT_MAX_PACKET_SIZE
Default maximum size of multicast packets to send and receive
|
private static int |
DEFAULT_MULTICAST_TTL
Default time to live value to use for sending multicast packets
|
private static int |
DEFAULT_SOCKET_TIMEOUT
Default timeout to set on sockets used for unicast discovery
|
private DiscoveryManagement |
discoer
Manager for discovering other lookup services
|
private java.util.concurrent.ExecutorService |
discoveryResponseExec |
private static EntryRep[] |
emptyAttrs
Empty attribute set
|
private List<EntryClass> |
entryClasses
All EntryClasses with non-zero numInstances
|
private Map<Long,RegistrarImpl.EventReg> |
eventByID
Map from Long(eventID) to EventReg.
|
private Queue<RegistrarImpl.EventReg> |
eventByTime
Identity map from EventReg to EventReg, ordered by lease expiration.
|
private Thread |
eventExpirer
Event lease expiration thread
|
private long |
eventID
Event ID
|
private java.util.concurrent.locks.Condition |
eventNotifier
Object for synchronizing with the event expire thread
|
private SynchronousExecutors |
eventNotifierExec
Executors for sending events and discovery responses
|
private Map<RegistrarImpl.EventReg,java.util.concurrent.ExecutorService> |
eventTaskMap |
private boolean |
inRecovery
Flag indicating whether system is in a state of recovery
|
private JoinManager |
joiner
Manager for joining other lookup services
|
private LifeCycle |
lifeCycle
Shutdown callback object, or null if no callback needed
|
private ProxyPreparer |
listenerPreparer
Preparer for received remote event listeners
|
private ProxyPreparer |
locatorPreparer
Preparer for received lookup locators
|
private ReliableLog |
log
Log for recovering/storing state, or null if running as transient
|
private static int |
LOG_VERSION
Log format version
|
private java.util.concurrent.atomic.AtomicInteger |
logFileSize
Current number of records in the Log File since the last snapshot
|
private static Logger |
logger
Logger used by this service
|
private LoginContext |
loginContext
Our login context, for logging out
|
private Entry[] |
lookupAttrs
The attributes to use when joining (including with myself)
|
private String[] |
lookupGroups
The groups we should join
|
private LookupLocator[] |
lookupLocators
The locators of other lookups we should join
|
private static long |
MAX_LEASE
Maximum minMax lease duration for both services and events
|
private static long |
MAX_RENEW
Maximum minimum renewal interval
|
private long |
maxEventLease
Current maximum event lease duration granted, in milliseconds.
|
private long |
maxServiceLease
Current maximum service lease duration granted, in milliseconds.
|
private String[] |
memberGroups
The groups we are a member of
|
private long |
minEventExpiration
Earliest expiration time of an EventReg
|
private long |
minMaxEventLease
Minimum value for maxEventLease.
|
private long |
minMaxServiceLease
Minimum value for maxServiceLease.
|
private long |
minRenewalInterval
Minimum average time between lease renewals, in milliseconds.
|
private long |
minSvcExpiration
Earliest expiration time of a SvcReg
|
private DiscoveryConstraints |
multicastAnnouncementConstraints
Constraints specified for outgoing multicast announcements
|
private long |
multicastAnnouncementInterval
Interval to wait in between sending multicast announcements
|
private Thread |
multicaster
Multicast discovery request packet receiving thread
|
private int |
multicastInterfaceRetryInterval
Interval to wait in between retrying failed interfaces
|
private NetworkInterface[] |
multicastInterfaces
Network interfaces to use for multicast discovery
|
private boolean |
multicastInterfacesSpecified
Flag indicating whether network interfaces were explicitly specified
|
private DiscoveryConstraints |
multicastRequestConstraints
Constraints specified for incoming multicast requests
|
private ClientSubjectChecker |
multicastRequestSubjectChecker
Client subject checker to apply to incoming multicast requests
|
private static Uuid |
myLeaseID
Lease ID always assigned to self
|
private LookupLocator |
myLocator
Our LookupLocator
|
private Registrar |
myRef
Remote reference for myself
|
private ServiceID |
myServiceID
Our service ID
|
private ServiceType |
objectServiceType
Canonical ServiceType for java.lang.Object
|
private int |
persistenceSnapshotThreshold
Log file must contain this many records before snapshot allowed
|
private float |
persistenceSnapshotWeight
Weight factor applied to snapshotSize when deciding to take snapshot
|
private Discovery |
protocol2
Utility for participating in version 2 of discovery protocols
|
private RegistrarProxy |
proxy
Proxy for myself
|
private Random |
random
Random number generator for use in lookup
|
private InvocationConstraints |
rawUnicastDiscoveryConstraints
Cached raw constraints associated with unicastDiscovery method
|
private ProxyPreparer |
recoveredListenerPreparer
Preparer for remote event listeners recovered from state log
|
private ProxyPreparer |
recoveredLocatorPreparer
Preparer for lookup locators recovered from state log
|
private UuidGenerator |
resourceIdGenerator
Generator for resource (e.g., registration, lease) Uuids
|
private Exporter |
serverExporter
Exporter for myself
|
private ServerSocketFactory |
serverSocketFactory
Unicast socket factories
|
private Map<EntryClass,Map<Object,List<RegistrarImpl.SvcReg>>[]> |
serviceByAttr
Map from EntryClass to HashMap[] where each HashMap is a map from
Object (field value) to ArrayList(SvcReg).
|
private Map<EntryClass,List<RegistrarImpl.SvcReg>> |
serviceByEmptyAttr
Map from EntryClass to ArrayList(SvcReg).
|
private Map<ServiceID,RegistrarImpl.SvcReg> |
serviceByID
Map from ServiceID to SvcReg.
|
private SortedSet<RegistrarImpl.SvcReg> |
serviceByTime
Identity map from SvcReg to SvcReg, ordered by lease expiration.
|
private Map<String,Map<ServiceID,RegistrarImpl.SvcReg>> |
serviceByTypeName
Map from String to HashMap mapping ServiceID to SvcReg.
|
private Thread |
serviceExpirer
Service lease expiration thread
|
private UuidGenerator |
serviceIdGenerator
Generator for service IDs
|
private java.util.concurrent.locks.Condition |
serviceNotifier
Object for synchronizing with the service expire thread
|
private java.util.concurrent.locks.Condition |
snapshotNotifier
Object on which the snapshot-taking thread will synchronize
|
private Thread |
snapshotter
Snapshot-taking thread
|
private SocketFactory |
socketFactory |
private Map<Long,RegistrarImpl.EventReg> |
subEventByID
Map from Long(eventID) to EventReg.
|
private Map<ServiceID,Object> |
subEventByService
Map from ServiceID to EventReg or EventReg[].
|
private long |
unexportTimeout
Maximum time to wait for calls to finish before forcing unexport
|
private long |
unexportWait
Time to wait between unexport attempts
|
private RegistrarImpl.Unicast |
unicast |
private DiscoveryConstraints |
unicastDiscoveryConstraints
Constraints specified for handling unicast discovery
|
private String |
unicastDiscoveryHost |
private ClientSubjectChecker |
unicastDiscoverySubjectChecker
Client subject checker to apply to unicast discovery attempts
|
private Thread |
unicaster
Unicast discovery request packet receiving thread
|
private int |
unicastPort
Port for unicast discovery
|
Modifier | Constructor and Description |
---|---|
(package private) |
RegistrarImpl(Configuration config,
ActivationID activationID,
boolean persistent,
LifeCycle lifeCycle)
Constructs RegistrarImpl based on the
Configuration argument.
|
private |
RegistrarImpl(RegistrarImpl.Initializer init) |
(package private) |
RegistrarImpl(String[] configArgs,
ActivationID activationID,
boolean persistent,
LifeCycle lifeCycle)
Constructs RegistrarImpl based on a configuration obtained using the
provided string arguments.
|
Modifier and Type | Method and Description |
---|---|
private HashMap |
addAttr(RegistrarImpl.SvcReg reg,
EntryClass eclass,
int fldidx,
Object value)
Put the service under the given attribute value for the given
defining class and field, if it isn't already there.
|
void |
addAttributes(ServiceID serviceID,
Uuid leaseID,
EntryRep[] attrSets)
Adds the specified attribute sets (those that aren't duplicates of
existing attribute sets) to the registered service item.
|
private void |
addAttributesDo(ServiceID serviceID,
Uuid leaseID,
EntryRep[] attrSets)
The code that does the real work of addAttributes.
|
private void |
addAttrs(RegistrarImpl.SvcReg reg,
EntryRep entry)
Put the service in the serviceByAttr map under all attribute values
in the given entry, or in the serviceByEmptyAttr map if the entry
has no attributes, add a new instance of the EntryClass, and update
entryClasses as necessary.
|
private void |
addEvent(RegistrarImpl.EventReg reg)
Add an event registration to our state.
|
private void |
addInstance(EntryClass eclass)
Add an instance of the EntryClass, and add the class to entryClasses
if this is the first such instance.
|
private void |
addLogRecord(RegistrarImpl.LogRecord rec)
Add a state-change record to persistent storage.
|
void |
addLookupAttributes(Entry[] attrSets)
Add attribute sets for the service.
|
void |
addLookupGroups(String[] groups)
Add new groups to the set to join.
|
void |
addLookupLocators(LookupLocator[] locators)
Add locators for specific new lookup services to join.
|
void |
addMemberGroups(String[] groups)
Adds the given set of names to the set whose elements are the names
of the groups in which the lookup service is currently a member.
|
private void |
addService(RegistrarImpl.SvcReg reg)
Add a service to our state.
|
private void |
addServiceByTypes(ServiceType type,
RegistrarImpl.SvcReg reg)
Adds a service registration to types in its hierarchy
|
private static void |
addTypes(List types,
List codebases,
ServiceType[] bases,
String prefix,
ServiceType type,
String codebase)
Find the most specific types (of type) that don't match prefix and
aren't equal to or a supertype of any types in bases, and add them
to types.
|
private static boolean |
allNull(Object[] array)
Test if all elements of the array are null.
|
private static Object[] |
arrayAdd(Object[] array,
Object elt)
Return a new array containing the elements of the given array
plus the given element added to the end.
|
private static Object[] |
arrayDel(Object[] array,
int i)
Return a new array containing all the elements of the given array
except the one at the specified index.
|
private static boolean |
attrMatch(EntryRep[] tmpls,
EntryRep attrSet)
Test if an entry either doesn't match any template in an array,
or matches a template but is a subclass of the template type.
|
void |
cancelEventLease(long eventID,
Uuid leaseID)
Cancels an event lease.
|
private void |
cancelEventLeaseDo(long eventID,
Uuid leaseID)
The code that does the real work of cancelEventLease.
|
Exception[] |
cancelLeases(Object[] regIDs,
Uuid[] leaseIDs)
Cancels service and event leases from a LeaseMap.
|
private Exception[] |
cancelLeasesDo(Object[] regIDs,
Uuid[] leaseIDs)
The code that does the real work of cancelLeases.
|
void |
cancelServiceLease(ServiceID serviceID,
Uuid leaseID)
Cancels a service lease.
|
private void |
cancelServiceLeaseDo(ServiceID serviceID,
Uuid leaseID)
The code that does the real work of cancelServiceLease.
|
private RegistrarImpl.EventReg |
checkEvent(Uuid leaseID,
long eventID,
long now) |
private RegistrarImpl.SvcReg |
checkLease(ServiceID serviceID,
Uuid leaseID,
long now) |
private void |
closeRequestSockets(List<Runnable> tasks)
Close any sockets that were sitting in the task queue.
|
private void |
computeMaxLeases()
Compute new maxServiceLease and maxEventLease values.
|
private static Item |
copyItem(Item item)
Do a deep copy of the item, and substitute replacements for all
embedded EntryClass instances and null for the ServiceType and
codebase (since they aren't needed on the client side).
|
private void |
deleteAttrs(RegistrarImpl.SvcReg reg,
EntryRep entry,
boolean checkDups)
If checkDups is false, delete the service (if present) from
serviceByAttr under all attribute values of the given entry or
from serviceByEmptyAttr if the entry has no attributes.
|
private void |
deleteEvent(RegistrarImpl.EventReg reg)
Remove an event registration from our state.
|
private void |
deleteInstance(EntryClass eclass)
Delete an instance of the EntryClass, and remove the class from
entryClasses if this is the last such instance.
|
private void |
deleteService(RegistrarImpl.SvcReg reg,
long now)
Delete given service, generating events as necessary.
|
private void |
deleteServiceFromTypes(ServiceType type,
RegistrarImpl.SvcReg reg)
Deletes a service registration from types in its hierarchy
|
private static EntryRep[] |
deleteSet(Item item,
int i)
Delete item.attributeSets[i] and return the new array.
|
void |
destroy()
Destroy the service, if possible, including its persistent storage.
|
private void |
generateEvent(RegistrarImpl.EventReg reg,
Item pre,
Item post,
ServiceID sid,
long now)
Generate an event if the event registration matches.
|
private void |
generateEvents(Item pre,
Item post,
long now)
Generate events for all matching event registrations.
|
Object |
getAdmin()
Returns an object that implements whatever administration interfaces
are appropriate for the particular service.
|
private static EntryClass |
getDefiningClass(EntryClass eclass,
int fldidx)
Return the first (highest) class that defines the given field.
|
private Discovery |
getDiscovery(int version)
Returns Discovery instance implementing the given protocol version
|
private EntryClass |
getEmptyEntryClass(EntryClass eclass)
Return member of entryClasses that is equal to or a subclass of
the specified class, provided there is exactly one such member
and it has no fields.
|
EntryClassBase[] |
getEntryClasses(Template tmpl)
Looks at all service items that match the specified template, finds
every entry (among those service items) that either doesn't match any
entry templates or is a subclass of at least one matching entry
template, and returns the set of the (most specific) classes of those
entries.
|
private EntryClassBase[] |
getEntryClassesDo(Template tmpl)
The code that does the real work of getEntryClasses.
|
Object[] |
getFieldValues(Template tmpl,
int setIndex,
int field)
Looks at all service items that match the specified template, finds
every entry (among those service items) that matches
tmpl.attributeSetTemplates[setIndex], and returns the set of values
of the specified field of those entries.
|
private Object[] |
getFieldValuesDo(Template tmpl,
int setidx,
int fldidx)
The code that does the real work of getFieldValues.
|
LookupLocator |
getLocator()
Returns a LookupLocator that can be used if necessary for unicast
discovery of the lookup service.
|
Entry[] |
getLookupAttributes()
Get the current attribute sets for the service.
|
String[] |
getLookupGroups()
Get the list of groups to join.
|
LookupLocator[] |
getLookupLocators()
Get the list of locators of specific lookup services to join.
|
String[] |
getMemberGroups()
Returns an array consisting of the names of the groups in which the
lookup service is a member.
|
Object |
getProxy()
Returns a proxy object for this remote object.
|
TrustVerifier |
getProxyVerifier()
Returns a
TrustVerifier that can be used to verify that
a proxy can be trusted as a proxy for the service; that is, the
isTrustedObject method of the
returned verifier can be called with a candidate proxy. |
Object |
getServiceProxy()
Returns a proxy object for this object.
|
ServiceTypeBase[] |
getServiceTypes(Template tmpl,
String prefix)
Looks at all service items that match the specified template, and for
every service item finds the most specific type (class or interface)
or types the service item is an instance of that are neither equal to,
nor a superclass of, any of the service types in the template and that
have names that start with the specified prefix, and returns the set
of all such types.
|
private ServiceTypeBase[] |
getServiceTypesDo(Template tmpl,
String prefix)
The code that does the real work of getServiceTypes.
|
int |
getUnicastPort()
Returns the port number on which the lookup service listens for
unicast discovery queries.
|
private static boolean |
hasAttr(RegistrarImpl.SvcReg reg,
EntryClass eclass,
int fldidx,
Object value)
Test if the service has an entry of the given class or subclass
with a field of the given value.
|
private static boolean |
hasEmptyAttr(RegistrarImpl.SvcReg reg,
EntryClass eclass)
Test if the service has an entry of the exact given class (assumed
to have no fields).
|
private static int |
indexOf(Object[] array,
int len,
Object elt)
Returns the first index of elt in the array if < len, else -1.
|
private static int |
indexOf(Object[] array,
Object elt)
Returns the first index of elt in the array, else -1.
|
private static boolean |
isEmpty(Object[] array)
Return true if the array is null or zero length
|
private static long |
limitDuration(long leaseDuration,
long limit)
Limit leaseDuration by limit, and check for negative value.
|
private static RegistrarImpl.Initializer |
loginAndRun(Configuration config,
ActivationID activationID,
boolean persistent,
LifeCycle lifeCycle) |
private static void |
logThrow(Level level,
String className,
String methodName,
String message,
Object[] args,
Throwable thrown)
Logs a thrown exception.
|
MarshalledWrapper |
lookup(Template tmpl)
Returns the service object (i.e., just ServiceItem.service) from an
item matching the template, or null if there is no match.
|
Matches |
lookup(Template tmpl,
int maxMatches)
Returns at most maxMatches items matching the template, plus the total
number of items that match the template.
|
private MarshalledWrapper |
lookupDo(Template tmpl)
The code that does the real work of lookup.
|
private Matches |
lookupDo(Template tmpl,
int maxMatches)
The code that does the real work of lookup.
|
private static void |
marshalAttributes(Entry[] attrs,
ObjectOutputStream out)
Writes reggie's attributes to ObjectOutputStream as a
null-terminated list of MarshalledInstances.
|
private static void |
marshalLocators(LookupLocator[] locators,
ObjectOutputStream out)
Writes locators to the given stream as a null-terminated list of
MarshalledInstances.
|
private static boolean |
matchAttributes(Template tmpl,
Item item)
Test if there is at least one matching entry in the Item for
each entry template in the Template.
|
private static boolean |
matchEntry(EntryRep tmpl,
EntryRep entry)
Test if an entry matches a template.
|
private RegistrarImpl.ItemIter |
matchingItems(Template tmpl)
Return an appropriate iterator for Items matching the Template.
|
private List<RegistrarImpl.SvcReg> |
matchingServices(ServiceType[] types)
Returns a list of services that match all types passed in
|
private static boolean |
matchItem(Template tmpl,
Item item)
Test if an item matches a template.
|
private static boolean |
matchType(ServiceType[] types,
ServiceType type)
Test if a type is equal to or a subtype of every type in an array.
|
void |
modifyAttributes(ServiceID serviceID,
Uuid leaseID,
EntryRep[] attrSetTmpls,
EntryRep[] attrSets)
Modifies existing attribute sets of a registered service item.
|
private void |
modifyAttributesDo(ServiceID serviceID,
Uuid leaseID,
EntryRep[] attrSetTmpls,
EntryRep[] attrSets)
The code that does the real work of modifyAttributes.
|
void |
modifyLookupAttributes(Entry[] attrSetTemplates,
Entry[] attrSets)
Modify the current attribute sets, using the same semantics as
ServiceRegistration.modifyAttributes.
|
private Uuid |
newLeaseID()
Generate a new lease ID
|
private ServiceID |
newServiceID()
Generate a new service ID
|
EventRegistration |
notify(Template tmpl,
int transitions,
RemoteEventListener listener,
MarshalledObject handback,
long leaseDuration)
Registers for event notification.
|
private EventRegistration |
notifyDo(Template tmpl,
int transitions,
RemoteEventListener listener,
MarshalledObject handback,
long leaseDuration)
The code that does the real work of notify.
|
private static boolean |
overlap(Object[] arr1,
Object[] arr2)
Return true if some object is an element of both arrays
|
private void |
pendingEvent(RegistrarImpl.EventReg reg,
ServiceID sid,
Item item,
int transition,
long now)
Add a pending EventTask for this event registration.
|
private String |
pickCodebase(EntryClass eclass,
ArrayList svcs,
long now)
Return any valid codebase for an entry of the exact given class.
|
private String |
pickCodebase(EntryClass eclass,
long now)
Return any valid codebase for an entry class that has instances.
|
private static LookupLocator[] |
prepareLocators(LookupLocator[] locators,
ProxyPreparer preparer,
boolean tolerateFailures)
Returns new array containing locators from the given non-null array
prepared using the given proxy preparer.
|
private void |
recoverEventRegistrations(ObjectInputStream stream)
Recovers event registrations
|
private void |
recoverServiceRegistrations(ObjectInputStream stream,
int logVersion)
Recovers service registrations and reggie's lookup attributes
|
private void |
recoverSnapshot(InputStream in)
Retrieve the contents of the snapshot file and reconstitute the 'base'
state of the Registrar from the retrieved data.
|
ServiceRegistration |
register(Item nitem,
long leaseDuration)
Register a new service or re-register an existing service.
|
private ServiceRegistration |
registerDo(Item nitem,
long leaseDuration)
The code that does the real work of register.
|
private static Object[] |
removeDups(Object[] arr)
Weed out duplicates.
|
void |
removeLookupGroups(String[] groups)
Remove groups from the set to join.
|
void |
removeLookupLocators(LookupLocator[] locators)
Remove locators for specific lookup services from the set to join.
|
void |
removeMemberGroups(String[] groups)
Deletes the elements of the given set of names from the set whose
elements are the names of the groups in which the lookup service is
currently a member.
|
long |
renewEventLease(long eventID,
Uuid leaseID,
long renewDuration)
Renews an event lease.
|
private void |
renewEventLeaseAbs(long eventID,
Uuid leaseID,
long renewExpiration)
Renew the event lease for an absolute expiration time.
|
private long |
renewEventLeaseDo(long eventID,
Uuid leaseID,
long renewDuration)
The code that does the real work of renewEventLease.
|
private long |
renewEventLeaseInt(long eventID,
Uuid leaseID,
long renewDuration,
long now) |
RenewResults |
renewLeases(Object[] regIDs,
Uuid[] leaseIDs,
long[] renewDurations)
Renews service and event leases from a LeaseMap.
|
private void |
renewLeasesAbs(Object[] regIDs,
Uuid[] leaseIDs,
long[] renewExpirations)
Renew the leases for absolute expiration times.
|
private RenewResults |
renewLeasesDo(Object[] regIDs,
Uuid[] leaseIDs,
long[] renewals)
The code that does the real work of renewLeases.
|
long |
renewServiceLease(ServiceID serviceID,
Uuid leaseID,
long renewDuration)
Renews a service lease.
|
private void |
renewServiceLeaseAbs(ServiceID serviceID,
Uuid leaseID,
long renewExpiration)
Renew the service lease for an absolute expiration time.
|
private long |
renewServiceLeaseDo(ServiceID serviceID,
Uuid leaseID,
long renewDuration)
The code that does the real work of renewServiceLease.
|
private long |
renewServiceLeaseInt(ServiceID serviceID,
Uuid leaseID,
long renewDuration,
long now)
Renew a service lease for a relative duration from now.
|
private void |
respond(Socket socket)
Process a unicast discovery request, and respond.
|
void |
setAttributes(ServiceID serviceID,
Uuid leaseID,
EntryRep[] attrSets)
Deletes all of the service item's existing attributes, and replaces
them with the specified attribute sets.
|
private void |
setAttributesDo(ServiceID serviceID,
Uuid leaseID,
EntryRep[] attrSets)
The code that does the real work of setAttributes.
|
void |
setLookupGroups(String[] groups)
Replace the list of groups to join with a new list.
|
void |
setLookupLocators(LookupLocator[] locators)
Replace the list of locators of specific lookup services to join
with a new list.
|
void |
setMemberGroups(String[] groups)
Replaces the set whose elements are the names of the groups in which
the lookup service is currently a member with the given set of group
names.
|
void |
setUnicastPort(int port)
Changes the number of the port on which the lookup service is currently
listening for unicast discovery queries to the given port number.
|
void |
start()
Called after construction, this method enables objects to delay
starting threads or exporting until after construction is complete,
to allow safe publication of the service in accordance with the JMM.
|
private void |
takeSnapshot(OutputStream out)
Write the current state of the Registrar to persistent storage.
|
private static Entry[] |
unmarshalAttributes(ObjectInputStream in)
Returns reggie's attributes unmarshalled from a null-terminated list of
MarshalledInstances read from the given stream, logging (but tolerating)
unmarshalling failures.
|
private static LookupLocator[] |
unmarshalLocators(ObjectInputStream in)
Returns locators unmarshalled from a null-terminated list of
MarshalledInstances read from the given stream, logging (but tolerating)
unmarshalling failures.
|
private void |
updateAttrs(RegistrarImpl.SvcReg reg,
EntryRep entry,
Object[] values)
Store all non-null elements of values into the given entry,
and update serviceByAttr to match.
|
private static final long MAX_LEASE
private static final long MAX_RENEW
private static final int DEFAULT_MAX_PACKET_SIZE
private static final int DEFAULT_MULTICAST_TTL
private static final int DEFAULT_SOCKET_TIMEOUT
private static final int LOG_VERSION
private static final String COMPONENT
private static final Uuid myLeaseID
private static final Logger logger
private static final Entry[] baseAttrs
private static final EntryRep[] emptyAttrs
private RegistrarProxy proxy
private volatile Exporter serverExporter
private Registrar myRef
private volatile ServiceID myServiceID
private final ActivationID activationID
private final ActivationSystem activationSystem
private volatile LookupLocator myLocator
private final LoginContext loginContext
private final LifeCycle lifeCycle
private final ServerSocketFactory serverSocketFactory
private final SocketFactory socketFactory
private final Map<ServiceID,RegistrarImpl.SvcReg> serviceByID
private final SortedSet<RegistrarImpl.SvcReg> serviceByTime
private final Map<String,Map<ServiceID,RegistrarImpl.SvcReg>> serviceByTypeName
private final Map<EntryClass,Map<Object,List<RegistrarImpl.SvcReg>>[]> serviceByAttr
private final Map<EntryClass,List<RegistrarImpl.SvcReg>> serviceByEmptyAttr
private final List<EntryClass> entryClasses
private final Map<Long,RegistrarImpl.EventReg> eventByID
private final Queue<RegistrarImpl.EventReg> eventByTime
private final Map<ServiceID,Object> subEventByService
private final Map<Long,RegistrarImpl.EventReg> subEventByID
private final UuidGenerator resourceIdGenerator
private final UuidGenerator serviceIdGenerator
private long eventID
private final Random random
private final ProxyPreparer listenerPreparer
private final ProxyPreparer recoveredListenerPreparer
private final ProxyPreparer locatorPreparer
private final ProxyPreparer recoveredLocatorPreparer
private long maxServiceLease
private long maxEventLease
private long minSvcExpiration
private long minEventExpiration
private final DiscoveryManagement discoer
private volatile JoinManager joiner
private final SynchronousExecutors eventNotifierExec
private final Map<RegistrarImpl.EventReg,java.util.concurrent.ExecutorService> eventTaskMap
private final java.util.concurrent.ExecutorService discoveryResponseExec
private final Thread serviceExpirer
private final Thread eventExpirer
private volatile Thread unicaster
private volatile RegistrarImpl.Unicast unicast
private final Thread multicaster
private final Thread announcer
private final Thread snapshotter
private final ReadersWriter concurrentObj
private final java.util.concurrent.locks.Condition serviceNotifier
private final java.util.concurrent.locks.Condition eventNotifier
private final java.util.concurrent.locks.Condition snapshotNotifier
private final ServiceType objectServiceType
private final ReliableLog log
private volatile boolean inRecovery
private final java.util.concurrent.atomic.AtomicInteger logFileSize
private final int persistenceSnapshotThreshold
private final float persistenceSnapshotWeight
private final long minMaxServiceLease
private final long minMaxEventLease
private final long minRenewalInterval
private volatile int unicastPort
private volatile String[] memberGroups
private volatile String[] lookupGroups
private volatile LookupLocator[] lookupLocators
private volatile Entry[] lookupAttrs
private final long multicastAnnouncementInterval
private final java.util.concurrent.atomic.AtomicLong announcementSeqNo
private final NetworkInterface[] multicastInterfaces
private final boolean multicastInterfacesSpecified
private final int multicastInterfaceRetryInterval
private final Discovery protocol2
private final InvocationConstraints rawUnicastDiscoveryConstraints
private final DiscoveryConstraints multicastRequestConstraints
private final DiscoveryConstraints multicastAnnouncementConstraints
private final DiscoveryConstraints unicastDiscoveryConstraints
private final ClientSubjectChecker multicastRequestSubjectChecker
private final long unexportTimeout
private final long unexportWait
private final ClientSubjectChecker unicastDiscoverySubjectChecker
private String unicastDiscoveryHost
private Configuration config
private Exception constructionException
private AccessControlContext context
RegistrarImpl(String[] configArgs, ActivationID activationID, boolean persistent, LifeCycle lifeCycle) throws Exception
Exception
RegistrarImpl(Configuration config, ActivationID activationID, boolean persistent, LifeCycle lifeCycle) throws Exception
Exception
private RegistrarImpl(RegistrarImpl.Initializer init)
private static RegistrarImpl.Initializer loginAndRun(Configuration config, ActivationID activationID, boolean persistent, LifeCycle lifeCycle) throws Exception
Exception
public Object getServiceProxy() throws NoSuchObjectException
ServiceProxyAccessor
null
.getServiceProxy
in interface ServiceProxyAccessor
NoSuchObjectException
public Object getProxy()
ProxyAccessor
null
is returned.getProxy
in interface ProxyAccessor
null
public TrustVerifier getProxyVerifier() throws NoSuchObjectException
ServerProxyTrust
TrustVerifier
that can be used to verify that
a proxy can be trusted as a proxy for the service; that is, the
isTrustedObject
method of the
returned verifier can be called with a candidate proxy. The verifier
should be able to verify all proxies for the service, including
proxies for resources (such as leases and registrations).getProxyVerifier
in interface ServerProxyTrust
TrustVerifier
that can be used to verify that
a proxy can be trusted as a proxy for the serviceNoSuchObjectException
public ServiceRegistration register(Item nitem, long leaseDuration) throws NoSuchObjectException
Registrar
register
in interface Registrar
NoSuchObjectException
ServiceRegistrar.register(net.jini.core.lookup.ServiceItem, long)
public MarshalledWrapper lookup(Template tmpl) throws NoSuchObjectException
Registrar
lookup
in interface Registrar
NoSuchObjectException
ServiceRegistrar.lookup(net.jini.core.lookup.ServiceTemplate)
public Matches lookup(Template tmpl, int maxMatches) throws NoSuchObjectException
Registrar
lookup
in interface Registrar
NoSuchObjectException
ServiceRegistrar.lookup(net.jini.core.lookup.ServiceTemplate)
public EventRegistration notify(Template tmpl, int transitions, RemoteEventListener listener, MarshalledObject handback, long leaseDuration) throws RemoteException
Registrar
notify
in interface Registrar
RemoteException
ServiceRegistrar.notify(net.jini.core.lookup.ServiceTemplate, int, net.jini.core.event.RemoteEventListener, java.rmi.MarshalledObject, long)
public EntryClassBase[] getEntryClasses(Template tmpl) throws NoSuchObjectException
Registrar
getEntryClasses
in interface Registrar
NoSuchObjectException
ServiceRegistrar.getEntryClasses(net.jini.core.lookup.ServiceTemplate)
public Object[] getFieldValues(Template tmpl, int setIndex, int field) throws NoSuchObjectException
Registrar
getFieldValues
in interface Registrar
NoSuchObjectException
ServiceRegistrar.getFieldValues(net.jini.core.lookup.ServiceTemplate, int, java.lang.String)
public ServiceTypeBase[] getServiceTypes(Template tmpl, String prefix) throws NoSuchObjectException
Registrar
getServiceTypes
in interface Registrar
NoSuchObjectException
ServiceRegistrar.getServiceTypes(net.jini.core.lookup.ServiceTemplate, java.lang.String)
public LookupLocator getLocator() throws NoSuchObjectException
Registrar
getLocator
in interface Registrar
NoSuchObjectException
ServiceRegistrar.getLocator()
public Object getAdmin() throws NoSuchObjectException
Administrable
getAdmin
in interface Administrable
NoSuchObjectException
JoinAdmin
public void addAttributes(ServiceID serviceID, Uuid leaseID, EntryRep[] attrSets) throws NoSuchObjectException, UnknownLeaseException
Registrar
addAttributes
in interface Registrar
NoSuchObjectException
UnknownLeaseException
ServiceRegistration.addAttributes(net.jini.core.entry.Entry[])
public void modifyAttributes(ServiceID serviceID, Uuid leaseID, EntryRep[] attrSetTmpls, EntryRep[] attrSets) throws NoSuchObjectException, UnknownLeaseException
Registrar
modifyAttributes
in interface Registrar
NoSuchObjectException
UnknownLeaseException
ServiceRegistration.modifyAttributes(net.jini.core.entry.Entry[], net.jini.core.entry.Entry[])
public void setAttributes(ServiceID serviceID, Uuid leaseID, EntryRep[] attrSets) throws NoSuchObjectException, UnknownLeaseException
Registrar
setAttributes
in interface Registrar
NoSuchObjectException
UnknownLeaseException
ServiceRegistration.setAttributes(net.jini.core.entry.Entry[])
public void cancelServiceLease(ServiceID serviceID, Uuid leaseID) throws NoSuchObjectException, UnknownLeaseException
Registrar
cancelServiceLease
in interface Registrar
NoSuchObjectException
UnknownLeaseException
Lease.cancel()
public long renewServiceLease(ServiceID serviceID, Uuid leaseID, long renewDuration) throws NoSuchObjectException, UnknownLeaseException
Registrar
renewServiceLease
in interface Registrar
NoSuchObjectException
UnknownLeaseException
Lease.renew(long)
public void cancelEventLease(long eventID, Uuid leaseID) throws NoSuchObjectException, UnknownLeaseException
Registrar
cancelEventLease
in interface Registrar
NoSuchObjectException
UnknownLeaseException
Lease.cancel()
public long renewEventLease(long eventID, Uuid leaseID, long renewDuration) throws NoSuchObjectException, UnknownLeaseException
Registrar
renewEventLease
in interface Registrar
NoSuchObjectException
UnknownLeaseException
Lease.renew(long)
public RenewResults renewLeases(Object[] regIDs, Uuid[] leaseIDs, long[] renewDurations) throws NoSuchObjectException
Registrar
renewLeases
in interface Registrar
NoSuchObjectException
LeaseMap.renewAll()
public Exception[] cancelLeases(Object[] regIDs, Uuid[] leaseIDs) throws NoSuchObjectException
Registrar
cancelLeases
in interface Registrar
NoSuchObjectException
LeaseMap.cancelAll()
public Entry[] getLookupAttributes() throws NoSuchObjectException
JoinAdmin
getLookupAttributes
in interface JoinAdmin
NoSuchObjectException
public void addLookupAttributes(Entry[] attrSets) throws RemoteException
JoinAdmin
addLookupAttributes
in interface JoinAdmin
attrSets
- the attribute sets to addRemoteException
public void modifyLookupAttributes(Entry[] attrSetTemplates, Entry[] attrSets) throws RemoteException
JoinAdmin
modifyLookupAttributes
in interface JoinAdmin
attrSetTemplates
- the templates for matching attribute setsattrSets
- the modifications to make to matching setsRemoteException
ServiceRegistration.modifyAttributes(net.jini.core.entry.Entry[], net.jini.core.entry.Entry[])
public String[] getLookupGroups() throws NoSuchObjectException
JoinAdmin
getLookupGroups
in interface JoinAdmin
NoSuchObjectException
JoinAdmin.setLookupGroups(java.lang.String[])
public void addLookupGroups(String[] groups) throws NoSuchObjectException
JoinAdmin
addLookupGroups
in interface JoinAdmin
groups
- groups to joinNoSuchObjectException
JoinAdmin.removeLookupGroups(java.lang.String[])
public void removeLookupGroups(String[] groups) throws NoSuchObjectException
JoinAdmin
removeLookupGroups
in interface JoinAdmin
groups
- groups to leaveNoSuchObjectException
JoinAdmin.addLookupGroups(java.lang.String[])
public void setLookupGroups(String[] groups) throws NoSuchObjectException
JoinAdmin
setLookupGroups
in interface JoinAdmin
groups
- groups to joinNoSuchObjectException
JoinAdmin.getLookupGroups()
public LookupLocator[] getLookupLocators() throws NoSuchObjectException
JoinAdmin
getLookupLocators
in interface JoinAdmin
NoSuchObjectException
JoinAdmin.setLookupLocators(net.jini.core.discovery.LookupLocator[])
public void addLookupLocators(LookupLocator[] locators) throws RemoteException
JoinAdmin
addLookupLocators
in interface JoinAdmin
locators
- locators of specific lookup services to joinRemoteException
JoinAdmin.removeLookupLocators(net.jini.core.discovery.LookupLocator[])
public void removeLookupLocators(LookupLocator[] locators) throws RemoteException
JoinAdmin
removeLookupLocators
in interface JoinAdmin
locators
- locators of specific lookup services to leaveRemoteException
JoinAdmin.addLookupLocators(net.jini.core.discovery.LookupLocator[])
public void setLookupLocators(LookupLocator[] locators) throws RemoteException
JoinAdmin
setLookupLocators
in interface JoinAdmin
locators
- locators of specific lookup services to joinRemoteException
JoinAdmin.getLookupLocators()
public void addMemberGroups(String[] groups) throws NoSuchObjectException
DiscoveryAdmin
NO_GROUPS
) is input, this method takes no action.addMemberGroups
in interface DiscoveryAdmin
groups
- String
array consisting of the names of
the new, additional groups in which the lookup service
is to be a member.NoSuchObjectException
public void removeMemberGroups(String[] groups) throws NoSuchObjectException
DiscoveryAdmin
NO_GROUPS
) is input, this
method takes no action.removeMemberGroups
in interface DiscoveryAdmin
groups
- String
array consisting of the names to
remove from the set whose elements are the names of the
groups in which the lookup service is currently a member.NoSuchObjectException
public String[] getMemberGroups() throws NoSuchObjectException
DiscoveryAdmin
getMemberGroups
in interface DiscoveryAdmin
String
array consisting of the names of the groups
in which the lookup service is a memberNoSuchObjectException
public void setMemberGroups(String[] groups) throws NoSuchObjectException
DiscoveryAdmin
NO_GROUPS
)
is input, then the lookup service will be a member of no groups.setMemberGroups
in interface DiscoveryAdmin
groups
- String
array consisting of the names of
the new groups in which the lookup service is to be a
member.NoSuchObjectException
public int getUnicastPort() throws NoSuchObjectException
DiscoveryAdmin
getUnicastPort
in interface DiscoveryAdmin
int
representing the port number on which the
lookup service listens for unicast discovery queries.NoSuchObjectException
public void setUnicastPort(int port) throws IOException, RemoteException
DiscoveryAdmin
setUnicastPort
in interface DiscoveryAdmin
port
- int
representing the new port number on which
the lookup service should listen for unicast discovery
queries.IOException
- because an invocation of this method will
result in the re-initiation of the unicast discovery process,
which can throw an IOException
when socket
allocation occurs.RemoteException
- typically, this exception occurs when
there is a communication failure between the client and the
server.public void destroy() throws RemoteException
DestroyAdmin
destroy
in interface DestroyAdmin
RemoteException
private static Object[] arrayAdd(Object[] array, Object elt)
private static Object[] arrayDel(Object[] array, int i)
private static int indexOf(Object[] array, Object elt)
private static int indexOf(Object[] array, int len, Object elt)
private static boolean isEmpty(Object[] array)
private static boolean overlap(Object[] arr1, Object[] arr2)
private static boolean allNull(Object[] array)
private static EntryRep[] deleteSet(Item item, int i)
private static Item copyItem(Item item)
private static EntryClass getDefiningClass(EntryClass eclass, int fldidx)
private void addServiceByTypes(ServiceType type, RegistrarImpl.SvcReg reg)
private void deleteServiceFromTypes(ServiceType type, RegistrarImpl.SvcReg reg)
private static boolean matchItem(Template tmpl, Item item)
private static boolean matchType(ServiceType[] types, ServiceType type)
private static boolean matchEntry(EntryRep tmpl, EntryRep entry)
private static boolean matchAttributes(Template tmpl, Item item)
private static boolean attrMatch(EntryRep[] tmpls, EntryRep attrSet)
private static boolean hasAttr(RegistrarImpl.SvcReg reg, EntryClass eclass, int fldidx, Object value)
private static boolean hasEmptyAttr(RegistrarImpl.SvcReg reg, EntryClass eclass)
private static void addTypes(List types, List codebases, ServiceType[] bases, String prefix, ServiceType type, String codebase)
private static long limitDuration(long leaseDuration, long limit)
private static void marshalAttributes(Entry[] attrs, ObjectOutputStream out) throws IOException
IOException
private static Entry[] unmarshalAttributes(ObjectInputStream in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
private static void marshalLocators(LookupLocator[] locators, ObjectOutputStream out) throws IOException
IOException
private static LookupLocator[] unmarshalLocators(ObjectInputStream in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
private static LookupLocator[] prepareLocators(LookupLocator[] locators, ProxyPreparer preparer, boolean tolerateFailures) throws RemoteException
RemoteException
private static void logThrow(Level level, String className, String methodName, String message, Object[] args, Throwable thrown)
private void addService(RegistrarImpl.SvcReg reg)
private void deleteService(RegistrarImpl.SvcReg reg, long now)
private void addEvent(RegistrarImpl.EventReg reg)
private void deleteEvent(RegistrarImpl.EventReg reg)
private void addAttrs(RegistrarImpl.SvcReg reg, EntryRep entry)
private void deleteAttrs(RegistrarImpl.SvcReg reg, EntryRep entry, boolean checkDups)
private void updateAttrs(RegistrarImpl.SvcReg reg, EntryRep entry, Object[] values)
private HashMap addAttr(RegistrarImpl.SvcReg reg, EntryClass eclass, int fldidx, Object value)
private void addInstance(EntryClass eclass)
private void deleteInstance(EntryClass eclass)
private RegistrarImpl.ItemIter matchingItems(Template tmpl)
private EntryClass getEmptyEntryClass(EntryClass eclass)
private List<RegistrarImpl.SvcReg> matchingServices(ServiceType[] types)
private String pickCodebase(EntryClass eclass, long now) throws ClassNotFoundException
ClassNotFoundException
private String pickCodebase(EntryClass eclass, ArrayList svcs, long now) throws ClassNotFoundException
ClassNotFoundException
private void computeMaxLeases()
private void respond(Socket socket) throws Exception
Exception
private Discovery getDiscovery(int version) throws DiscoveryProtocolException
DiscoveryProtocolException
private void closeRequestSockets(List<Runnable> tasks)
public void start() throws Exception
Startable
In addition to starting threads after construction, it also allows objects to avoid throwing an exception during construction to avoid finalizer attacks.
The implementation is required to ensure start() is idempotent (only executed once, additional invocations must return immediately).
private ServiceRegistration registerDo(Item nitem, long leaseDuration)
private MarshalledWrapper lookupDo(Template tmpl)
private Matches lookupDo(Template tmpl, int maxMatches)
private EventRegistration notifyDo(Template tmpl, int transitions, RemoteEventListener listener, MarshalledObject handback, long leaseDuration) throws RemoteException
RemoteException
private EntryClassBase[] getEntryClassesDo(Template tmpl)
private Object[] getFieldValuesDo(Template tmpl, int setidx, int fldidx)
private ServiceTypeBase[] getServiceTypesDo(Template tmpl, String prefix)
private void addAttributesDo(ServiceID serviceID, Uuid leaseID, EntryRep[] attrSets) throws UnknownLeaseException
UnknownLeaseException
private void modifyAttributesDo(ServiceID serviceID, Uuid leaseID, EntryRep[] attrSetTmpls, EntryRep[] attrSets) throws UnknownLeaseException
UnknownLeaseException
private void setAttributesDo(ServiceID serviceID, Uuid leaseID, EntryRep[] attrSets) throws UnknownLeaseException
UnknownLeaseException
private void cancelServiceLeaseDo(ServiceID serviceID, Uuid leaseID) throws UnknownLeaseException
UnknownLeaseException
private long renewServiceLeaseDo(ServiceID serviceID, Uuid leaseID, long renewDuration) throws UnknownLeaseException
UnknownLeaseException
private RegistrarImpl.SvcReg checkLease(ServiceID serviceID, Uuid leaseID, long now) throws UnknownLeaseException
UnknownLeaseException
private RegistrarImpl.EventReg checkEvent(Uuid leaseID, long eventID, long now) throws UnknownLeaseException
UnknownLeaseException
private long renewServiceLeaseInt(ServiceID serviceID, Uuid leaseID, long renewDuration, long now) throws UnknownLeaseException
UnknownLeaseException
private void renewServiceLeaseAbs(ServiceID serviceID, Uuid leaseID, long renewExpiration)
private void cancelEventLeaseDo(long eventID, Uuid leaseID) throws UnknownLeaseException
UnknownLeaseException
private long renewEventLeaseDo(long eventID, Uuid leaseID, long renewDuration) throws UnknownLeaseException
UnknownLeaseException
private long renewEventLeaseInt(long eventID, Uuid leaseID, long renewDuration, long now) throws UnknownLeaseException
UnknownLeaseException
private void renewEventLeaseAbs(long eventID, Uuid leaseID, long renewExpiration)
private RenewResults renewLeasesDo(Object[] regIDs, Uuid[] leaseIDs, long[] renewals)
private void renewLeasesAbs(Object[] regIDs, Uuid[] leaseIDs, long[] renewExpirations)
private Exception[] cancelLeasesDo(Object[] regIDs, Uuid[] leaseIDs)
private void generateEvents(Item pre, Item post, long now)
private void generateEvent(RegistrarImpl.EventReg reg, Item pre, Item post, ServiceID sid, long now)
private void pendingEvent(RegistrarImpl.EventReg reg, ServiceID sid, Item item, int transition, long now)
private ServiceID newServiceID()
private Uuid newLeaseID()
private void takeSnapshot(OutputStream out) throws IOException
A 'snapshot' of the Registrar's current state is represented by the data contained in certain fields of the Registrar. That data represents many changes -- over time -- to the Registrar'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
RegistrarImpl.LocalLogHandler
private void recoverSnapshot(InputStream in) throws IOException, ClassNotFoundException
The data retrieved by this method from the snapshot file is shown below:
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 set of event sequence numbers 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.
IOException
ClassNotFoundException
RegistrarImpl.LocalLogHandler
private void recoverServiceRegistrations(ObjectInputStream stream, int logVersion) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
private void recoverEventRegistrations(ObjectInputStream stream) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
private void addLogRecord(RegistrarImpl.LogRecord rec)
Whenever a significant change occurs to the Registrar'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 the Registrar's 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 the current state of the Registrar 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
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.