Package com.sun.jini.reggie
Class GigaRegistrar
java.lang.Object
com.sun.jini.reggie.GigaRegistrar
- All Implemented Interfaces:
JVMInfoProvider,InternalLogProvider,OSInfoProvider,NIOInfoProvider,DestroyAdmin,Registrar,ServiceProxyAccessor,Remote,Administrable,JoinAdmin,ProxyAccessor,DiscoveryAdmin,ServerProxyTrust
public class GigaRegistrar
extends Object
implements Registrar, ProxyAccessor, ServerProxyTrust, NIOInfoProvider, OSInfoProvider, JVMInfoProvider, InternalLogProvider
Base server-side implementation of a lookup service, subclassed by TransientRegistrarImpl and
PersistentRegistrarImpl. Multiple client-side proxy classes are used, for the ServiceRegistrar
interface as well as for leases and administration; their methods transform the parameters and
then make corresponding calls on the Registrar interface implemented on the server side.
- Author:
- Sun Microsystems, Inc.
-
Constructor Summary
ConstructorsConstructorDescriptionGigaRegistrar(String[] configArgs, LifeCycle lifeCycle) Constructs RegistrarImpl based on a configuration obtained using the provided string arguments. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttributes(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.voidaddLookupAttributes(Entry[] attrSets) Add attribute sets for the service.voidaddLookupGroups(String[] groups) Add new groups to the set to join.voidaddLookupLocators(LookupLocator[] locators) Add locators for specific new lookup services to join.voidaddMemberGroups(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.voidcancelEventLease(long eventID, Uuid leaseID) Cancels an event lease.cancelLeases(Object[] regIDs, Uuid[] leaseIDs) Cancels service and event leases from a LeaseMap.voidcancelServiceLease(ServiceID serviceID, Uuid leaseID) Cancels a service lease.voiddestroy()Destroy the service, if possible, including its persistent storage.voidDisabled lrmi monitoring (gigaspaces internal remoting layer).voiddumpEventQueueState(PrintWriter writer) Used to write the internal state to a file.voidEnables lrmi monitoring (gigaspaces internal remoting layer), this will cause the target to start track lrmi invocations which can later be viewed by calling.Return lrmi (gigaspaces internal remoting layer) services monitoring details.getAdmin()Returns an object that implements whatever administration interfaces are appropriate for the particular service.longgetEntryClasses(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.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.Returns a LookupLocator that can be used if necessary for unicast discovery of the lookup service.Entry[]Get the current attribute sets for the service.String[]Get the list of groups to join.Get the list of locators of specific lookup services to join.Returns cluster manager info for relevant services.String[]Returns an array consisting of the names of the groups in which the lookup service is a member.Returns the transport configuration.Returns the transport statistics.getProxy()Returns a proxy object for this remote object.Returns aTrustVerifierthat can be used to verify that a proxy can be trusted as a proxy for the service; that is, theisTrustedObjectmethod of the returned verifier can be called with a candidate proxy.Returns a proxy object for this object.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.intReturns the port number on which the lookup service listens for unicast discovery queries.static booleanisActive()logEntriesDirect(LogEntryMatcher matcher) Returns the service object (i.e., just ServiceItem.service) from an item matching the template, or null if there is no match.Returns at most maxMatches items matching the template, plus the total number of items that match the template.voidmodifyAttributes(ServiceID serviceID, Uuid leaseID, EntryRep[] attrSetTmpls, EntryRep[] attrSets) Modifies existing attribute sets of a registered service item.voidmodifyLookupAttributes(Entry[] attrSetTemplates, Entry[] attrSets) Modify the current attribute sets, using the same semantics as ServiceRegistration.modifyAttributes.notify(Template tmpl, int transitions, RemoteEventListener listener, MarshalledObject handback, long leaseDuration) Registers for event notification.notify(Template tmpl, int transitions, RemoteEventListener listener, MarshalledObject handback, long leaseDuration, int notifyType) Registers for event notification.Register a new service or re-register an existing service.voidremoveLookupGroups(String[] groups) Remove groups from the set to join.voidremoveLookupLocators(LookupLocator[] locators) Remove locators for specific lookup services from the set to join.voidremoveMemberGroups(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.longrenewEventLease(long eventID, Uuid leaseID, long renewDuration) Renews an event lease.renewLeases(Object[] regIDs, Uuid[] leaseIDs, long[] renewDurations) Renews service and event leases from a LeaseMap.longrenewServiceLease(ServiceID serviceID, Uuid leaseID, long renewDuration) Renews a service lease.voidrunGc()serviceDetails(ServiceID serviceID) Returns the service details of the service id.voidsetAttributes(ServiceID serviceID, Uuid leaseID, EntryRep[] attrSets) Deletes all of the service item's existing attributes, and replaces them with the specified attribute sets.voidsetLookupGroups(String[] groups) Replace the list of groups to join with a new list.voidsetLookupLocators(LookupLocator[] locators) Replace the list of locators of specific lookup services to join with a new list.voidsetMemberGroups(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.voidsetUnicastPort(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.
-
Constructor Details
-
GigaRegistrar
Constructs RegistrarImpl based on a configuration obtained using the provided string arguments. If activationID is non-null, the created RegistrarImpl runs as activatable; if persistent is true, it persists/recovers its state to/from disk. A RegistrarImpl instance cannot be constructed as both activatable and non-persistent. If lifeCycle is non-null, its unregister method is invoked during shutdown.- Throws:
Exception
-
-
Method Details
-
isActive
public static boolean isActive() -
dumpEventQueueState
Used to write the internal state to a file.- See Also:
-
getManagerClusterInfo
Description copied from interface:InternalLogProviderReturns cluster manager info for relevant services. NOTE: This method was added here to preserve backwards compatibility (adding a new interface breaks backwards). It is only implemented by GigaRegistrar.- Specified by:
getManagerClusterInfoin interfaceInternalLogProvider
-
getServiceProxy
Description copied from interface:ServiceProxyAccessorReturns a proxy object for this object. This value should not benull.- Specified by:
getServiceProxyin interfaceServiceProxyAccessor- Returns:
- a proxy object reference
- Throws:
NoSuchObjectException
-
getProxy
Description copied from interface:ProxyAccessorReturns a proxy object for this remote object. If this remote object is not exported (and hence, no proxy is available), thennullis returned.- Specified by:
getProxyin interfaceProxyAccessor- Returns:
- a proxy, or
null
-
getProxyVerifier
Description copied from interface:ServerProxyTrustReturns aTrustVerifierthat can be used to verify that a proxy can be trusted as a proxy for the service; that is, theisTrustedObjectmethod 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).- Specified by:
getProxyVerifierin interfaceServerProxyTrust- Returns:
- a
TrustVerifierthat can be used to verify that a proxy can be trusted as a proxy for the service - Throws:
NoSuchObjectException
-
register
Description copied from interface:RegistrarRegister a new service or re-register an existing service.- Specified by:
registerin interfaceRegistrar- Throws:
NoSuchObjectException- See Also:
-
serviceDetails
Description copied from interface:RegistrarReturns the service details of the service id.- Specified by:
serviceDetailsin interfaceRegistrar- Throws:
RemoteException
-
lookup
Description copied from interface:RegistrarReturns the service object (i.e., just ServiceItem.service) from an item matching the template, or null if there is no match.- Specified by:
lookupin interfaceRegistrar- Throws:
NoSuchObjectException- See Also:
-
lookup
Description copied from interface:RegistrarReturns at most maxMatches items matching the template, plus the total number of items that match the template.- Specified by:
lookupin interfaceRegistrar- Throws:
NoSuchObjectException- See Also:
-
notify
public RegistrarEventRegistration notify(Template tmpl, int transitions, RemoteEventListener listener, MarshalledObject handback, long leaseDuration) throws RemoteException Description copied from interface:RegistrarRegisters for event notification.- Specified by:
notifyin interfaceRegistrar- Throws:
RemoteException- See Also:
-
notify
public RegistrarEventRegistration notify(Template tmpl, int transitions, RemoteEventListener listener, MarshalledObject handback, long leaseDuration, int notifyType) throws RemoteException Description copied from interface:RegistrarRegisters for event notification.- Specified by:
notifyin interfaceRegistrar- Throws:
RemoteException- See Also:
-
getEntryClasses
Description copied from interface:RegistrarLooks 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.- Specified by:
getEntryClassesin interfaceRegistrar- Throws:
NoSuchObjectException- See Also:
-
getFieldValues
Description copied from interface:RegistrarLooks 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. The field name has been converted to an index (fields numbered from super to subclass).- Specified by:
getFieldValuesin interfaceRegistrar- Throws:
NoSuchObjectException- See Also:
-
getServiceTypes
Description copied from interface:RegistrarLooks 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.- Specified by:
getServiceTypesin interfaceRegistrar- Throws:
NoSuchObjectException- See Also:
-
getLocator
Description copied from interface:RegistrarReturns a LookupLocator that can be used if necessary for unicast discovery of the lookup service.- Specified by:
getLocatorin interfaceRegistrar- Throws:
NoSuchObjectException- See Also:
-
getAdmin
Description copied from interface:AdministrableReturns an object that implements whatever administration interfaces are appropriate for the particular service.- Specified by:
getAdminin interfaceAdministrable- Returns:
- an object that implements whatever administration interfaces are appropriate for the particular service.
- Throws:
NoSuchObjectException- See Also:
-
addAttributes
public void addAttributes(ServiceID serviceID, Uuid leaseID, EntryRep[] attrSets) throws NoSuchObjectException, UnknownLeaseException Description copied from interface:RegistrarAdds the specified attribute sets (those that aren't duplicates of existing attribute sets) to the registered service item.- Specified by:
addAttributesin interfaceRegistrar- Throws:
NoSuchObjectExceptionUnknownLeaseException- See Also:
-
modifyAttributes
public void modifyAttributes(ServiceID serviceID, Uuid leaseID, EntryRep[] attrSetTmpls, EntryRep[] attrSets) throws NoSuchObjectException, UnknownLeaseException Description copied from interface:RegistrarModifies existing attribute sets of a registered service item.- Specified by:
modifyAttributesin interfaceRegistrar- Throws:
NoSuchObjectExceptionUnknownLeaseException- See Also:
-
setAttributes
public void setAttributes(ServiceID serviceID, Uuid leaseID, EntryRep[] attrSets) throws NoSuchObjectException, UnknownLeaseException Description copied from interface:RegistrarDeletes all of the service item's existing attributes, and replaces them with the specified attribute sets.- Specified by:
setAttributesin interfaceRegistrar- Throws:
NoSuchObjectExceptionUnknownLeaseException- See Also:
-
cancelServiceLease
public void cancelServiceLease(ServiceID serviceID, Uuid leaseID) throws NoSuchObjectException, UnknownLeaseException Description copied from interface:RegistrarCancels a service lease.- Specified by:
cancelServiceLeasein interfaceRegistrar- Throws:
NoSuchObjectExceptionUnknownLeaseException- See Also:
-
renewServiceLease
public long renewServiceLease(ServiceID serviceID, Uuid leaseID, long renewDuration) throws NoSuchObjectException, UnknownLeaseException Description copied from interface:RegistrarRenews a service lease.- Specified by:
renewServiceLeasein interfaceRegistrar- Throws:
NoSuchObjectExceptionUnknownLeaseException- See Also:
-
cancelEventLease
public void cancelEventLease(long eventID, Uuid leaseID) throws NoSuchObjectException, UnknownLeaseException Description copied from interface:RegistrarCancels an event lease.- Specified by:
cancelEventLeasein interfaceRegistrar- Throws:
NoSuchObjectExceptionUnknownLeaseException- See Also:
-
renewEventLease
public long renewEventLease(long eventID, Uuid leaseID, long renewDuration) throws NoSuchObjectException, UnknownLeaseException Description copied from interface:RegistrarRenews an event lease.- Specified by:
renewEventLeasein interfaceRegistrar- Throws:
NoSuchObjectExceptionUnknownLeaseException- See Also:
-
renewLeases
public RenewResults renewLeases(Object[] regIDs, Uuid[] leaseIDs, long[] renewDurations) throws NoSuchObjectException Description copied from interface:RegistrarRenews service and event leases from a LeaseMap.- Specified by:
renewLeasesin interfaceRegistrar- Throws:
NoSuchObjectException- See Also:
-
cancelLeases
Description copied from interface:RegistrarCancels service and event leases from a LeaseMap.- Specified by:
cancelLeasesin interfaceRegistrar- Throws:
NoSuchObjectException- See Also:
-
getLookupAttributes
Description copied from interface:JoinAdminGet the current attribute sets for the service.- Specified by:
getLookupAttributesin interfaceJoinAdmin- Returns:
- the current attribute sets for the service
- Throws:
NoSuchObjectException
-
addLookupAttributes
Description copied from interface:JoinAdminAdd attribute sets for the service. The resulting set will be used for all future joins. The attribute sets are also added to all currently-joined lookup services.- Specified by:
addLookupAttributesin interfaceJoinAdmin- Parameters:
attrSets- the attribute sets to add- Throws:
RemoteException
-
modifyLookupAttributes
public void modifyLookupAttributes(Entry[] attrSetTemplates, Entry[] attrSets) throws RemoteException Description copied from interface:JoinAdminModify the current attribute sets, using the same semantics as ServiceRegistration.modifyAttributes. The resulting set will be used for all future joins. The same modifications are also made to all currently-joined lookup services.- Specified by:
modifyLookupAttributesin interfaceJoinAdmin- Parameters:
attrSetTemplates- the templates for matching attribute setsattrSets- the modifications to make to matching sets- Throws:
RemoteException- See Also:
-
getLookupGroups
Description copied from interface:JoinAdminGet the list of groups to join. An empty array means the service joins no groups (as opposed to "all" groups).- Specified by:
getLookupGroupsin interfaceJoinAdmin- Returns:
- an array of groups to join. An empty array means the service joins no groups (as opposed to "all" groups).
- Throws:
NoSuchObjectException- See Also:
-
addLookupGroups
Description copied from interface:JoinAdminAdd new groups to the set to join. Lookup services in the new groups will be discovered and joined.- Specified by:
addLookupGroupsin interfaceJoinAdmin- Parameters:
groups- groups to join- Throws:
NoSuchObjectException- See Also:
-
removeLookupGroups
Description copied from interface:JoinAdminRemove groups from the set to join. Leases are cancelled at lookup services that are not members of any of the remaining groups.- Specified by:
removeLookupGroupsin interfaceJoinAdmin- Parameters:
groups- groups to leave- Throws:
NoSuchObjectException- See Also:
-
setLookupGroups
Description copied from interface:JoinAdminReplace the list of groups to join with a new list. Leases are cancelled at lookup services that are not members of any of the new groups. Lookup services in the new groups will be discovered and joined.- Specified by:
setLookupGroupsin interfaceJoinAdmin- Parameters:
groups- groups to join- Throws:
NoSuchObjectException- See Also:
-
getLookupLocators
Description copied from interface:JoinAdminGet the list of locators of specific lookup services to join.- Specified by:
getLookupLocatorsin interfaceJoinAdmin- Returns:
- the list of locators of specific lookup services to join
- Throws:
NoSuchObjectException- See Also:
-
addLookupLocators
Description copied from interface:JoinAdminAdd locators for specific new lookup services to join. The new lookup services will be discovered and joined.- Specified by:
addLookupLocatorsin interfaceJoinAdmin- Parameters:
locators- locators of specific lookup services to join- Throws:
RemoteException- See Also:
-
removeLookupLocators
Description copied from interface:JoinAdminRemove locators for specific lookup services from the set to join. Any leases held at the lookup services are cancelled.- Specified by:
removeLookupLocatorsin interfaceJoinAdmin- Parameters:
locators- locators of specific lookup services to leave- Throws:
RemoteException- See Also:
-
setLookupLocators
Description copied from interface:JoinAdminReplace the list of locators of specific lookup services to join with a new list. Leases are cancelled at lookup services that were in the old list but are not in the new list. Any new lookup services will be discovered and joined.- Specified by:
setLookupLocatorsin interfaceJoinAdmin- Parameters:
locators- locators of specific lookup services to join- Throws:
RemoteException- See Also:
-
addMemberGroups
Description copied from interface:DiscoveryAdminAdds 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. Elements in the input set that duplicate names of groups in which the lookup service is already a member will be ignored. If the empty array (NO_GROUPS) is input, this method takes no action.- Specified by:
addMemberGroupsin interfaceDiscoveryAdmin- Parameters:
groups-Stringarray consisting of the names of the new, additional groups in which the lookup service is to be a member.- Throws:
NoSuchObjectException
-
removeMemberGroups
Description copied from interface:DiscoveryAdminDeletes 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. Any element in the input set that is not a name of a group in which the lookup service is currently a member will be ignored. If the empty array (NO_GROUPS) is input, this method takes no action.- Specified by:
removeMemberGroupsin interfaceDiscoveryAdmin- Parameters:
groups-Stringarray 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.- Throws:
NoSuchObjectException
-
getMemberGroups
Description copied from interface:DiscoveryAdminReturns an array consisting of the names of the groups in which the lookup service is a member. If the lookup service currently belongs to no groups, this method will return the empty array.- Specified by:
getMemberGroupsin interfaceDiscoveryAdmin- Returns:
Stringarray consisting of the names of the groups in which the lookup service is a member- Throws:
NoSuchObjectException
-
setMemberGroups
Description copied from interface:DiscoveryAdminReplaces 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. Elements in the input set that duplicate other elements in the input set will be ignored. If the empty array (NO_GROUPS) is input, then the lookup service will be a member of no groups.- Specified by:
setMemberGroupsin interfaceDiscoveryAdmin- Parameters:
groups-Stringarray consisting of the names of the new groups in which the lookup service is to be a member.- Throws:
NoSuchObjectException
-
getUnicastPort
Description copied from interface:DiscoveryAdminReturns the port number on which the lookup service listens for unicast discovery queries.- Specified by:
getUnicastPortin interfaceDiscoveryAdmin- Returns:
- an
intrepresenting the port number on which the lookup service listens for unicast discovery queries. - Throws:
NoSuchObjectException
-
setUnicastPort
Description copied from interface:DiscoveryAdminChanges the number of the port on which the lookup service is currently listening for unicast discovery queries to the given port number. If a value of zero is input, then the lookup service will first try to listen on the standard unicast discovery port, but if that fails, the lookup service will listen on an arbitrary port.- Specified by:
setUnicastPortin interfaceDiscoveryAdmin- Parameters:
port-intrepresenting the new port number on which the lookup service should listen for unicast discovery queries.- Throws:
IOException- because an invocation of this method will result in the re-initiation of the unicast discovery process, which can throw anIOExceptionwhen socket allocation occurs.RemoteException- typically, this exception occurs when there is a communication failure between the client and the server.
-
destroy
Description copied from interface:DestroyAdminDestroy the service, if possible, including its persistent storage. This method should (in effect) spawn a separate thread to do the actual work asynchronously, and make a reasonable attempt to let this remote call return successfully. As such, a successful return from this method does not mean that the service has been destroyed. Although the service should make a reasonable attempt to let this remote call return successfully, the service must not wait indefinitely for other (in-progress and subsequent) remote calls to finish before proceeding to destroy itself. Once this method has been called, the service can, but need not, reject all other (in-progress and subsequent) remote calls to the service.- Specified by:
destroyin interfaceDestroyAdmin- Throws:
RemoteException
-
loadInitialLookupAttributes
-
getNIODetails
Description copied from interface:NIOInfoProviderReturns the transport configuration. Note, does not change during application lifecycle, should be cached on the client side.- Specified by:
getNIODetailsin interfaceNIOInfoProvider- Throws:
RemoteException
-
getNIOStatistics
Description copied from interface:NIOInfoProviderReturns the transport statistics.- Specified by:
getNIOStatisticsin interfaceNIOInfoProvider- Throws:
RemoteException
-
enableLRMIMonitoring
Description copied from interface:NIOInfoProviderEnables lrmi monitoring (gigaspaces internal remoting layer), this will cause the target to start track lrmi invocations which can later be viewed by calling.NIOInfoProvider.fetchLRMIMonitoringDetails()- Specified by:
enableLRMIMonitoringin interfaceNIOInfoProvider- Throws:
RemoteException
-
disableLRMIMonitoring
Description copied from interface:NIOInfoProviderDisabled lrmi monitoring (gigaspaces internal remoting layer).NIOInfoProvider.enableLRMIMonitoring()- Specified by:
disableLRMIMonitoringin interfaceNIOInfoProvider- Throws:
RemoteException
-
fetchLRMIMonitoringDetails
Description copied from interface:NIOInfoProviderReturn lrmi (gigaspaces internal remoting layer) services monitoring details. This will only work if lrmi monitoring was previously enabled, either by admin API, Jmx or system property.NIOInfoProvider.enableLRMIMonitoring()- Specified by:
fetchLRMIMonitoringDetailsin interfaceNIOInfoProvider- Throws:
RemoteException
-
getCurrentTimestamp
- Specified by:
getCurrentTimestampin interfaceOSInfoProvider- Throws:
RemoteException
-
getOSDetails
- Specified by:
getOSDetailsin interfaceOSInfoProvider- Throws:
RemoteException
-
getOSStatistics
- Specified by:
getOSStatisticsin interfaceOSInfoProvider- Throws:
RemoteException
-
getJVMDetails
- Specified by:
getJVMDetailsin interfaceJVMInfoProvider- Throws:
RemoteException
-
getJVMStatistics
- Specified by:
getJVMStatisticsin interfaceJVMInfoProvider- Throws:
RemoteException
-
runGc
- Specified by:
runGcin interfaceJVMInfoProvider- Throws:
RemoteException
-
logEntriesDirect
- Specified by:
logEntriesDirectin interfaceInternalLogProvider- Throws:
RemoteExceptionIOException
-