public interface ServiceRegistrar
ServiceRegistration
Modifier and Type | Field and Description |
---|---|
static int |
NOTIFY_PLAIN |
static int |
NOTIFY_WITH_EVENTS |
static int |
NOTIFY_WITH_MATCHES |
static int |
TRANSITION_MATCH_MATCH
An event is sent when the changed item matches the template both
before and after the operation.
|
static int |
TRANSITION_MATCH_NOMATCH
An event is sent when the changed item matches the template before
the operation, but doesn't match the template after the operation
(this includes deletion of the item).
|
static int |
TRANSITION_NOMATCH_MATCH
An event is sent when the changed item doesn't match the template
before the operation (this includes not existing), but does match
the template after the operation.
|
Modifier and Type | Method and Description |
---|---|
Class[] |
getEntryClasses(ServiceTemplate 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(ServiceTemplate tmpl,
int setIndex,
String 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.
|
String[] |
getGroups()
Returns the set of groups that this lookup service is currently a
member of.
|
LookupLocator |
getLocator()
Returns a LookupLocator that can be used if necessary for unicast
discovery of the lookup service.
|
Object |
getRegistrar() |
ServiceID |
getServiceID()
Returns the service ID of the lookup service.
|
Class[] |
getServiceTypes(ServiceTemplate 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.
|
Object |
lookup(ServiceTemplate tmpl)
Returns the service object (i.e., just ServiceItem.service) from an
item matching the template, or null if there is no match.
|
ServiceMatches |
lookup(ServiceTemplate tmpl,
int maxMatches)
Returns at most maxMatches items matching the template, plus the total
number of items that match the template.
|
RegistrarEventRegistration |
notify(ServiceTemplate tmpl,
int transitions,
RemoteEventListener listener,
MarshalledObject handback,
long leaseDuration)
Registers for event notification.
|
RegistrarEventRegistration |
notify(ServiceTemplate tmpl,
int transitions,
RemoteEventListener listener,
MarshalledObject handback,
long leaseDuration,
int notifyType)
Same as above, just return the matching templaes with the call
|
ServiceRegistration |
register(ServiceItem item,
long leaseDuration)
Register a new service or re-register an existing service.
|
ServiceDetails |
serviceDetails(ServiceID serviceID) |
static final int TRANSITION_MATCH_NOMATCH
static final int TRANSITION_NOMATCH_MATCH
static final int TRANSITION_MATCH_MATCH
static final int NOTIFY_PLAIN
static final int NOTIFY_WITH_MATCHES
static final int NOTIFY_WITH_EVENTS
ServiceRegistration register(ServiceItem item, long leaseDuration) throws RemoteException
To register a new service, item.serviceID should be null. In that case, if item.service does not equal (using MarshalledObject.equals) any existing item's service object, then a new service ID will be assigned and included in the returned ServiceRegistration. The service ID is unique over time and space with respect to all other service IDs generated by all lookup services. If item.service does equal an existing item's service object, the existing item is first deleted from the lookup service (even if it has different attributes) and its lease is cancelled, but that item's service ID is reused for the newly registered item.
To re-register an existing service, or to register the service in any other lookup service, item.serviceID should be set to the same service ID that was returned by the initial registration. If an item is already registered under the same service ID, the existing item is first deleted (even if it has different attributes or a different service instance) and its lease is cancelled. Note that service object equality is not checked in this case, to allow for reasonable evolution of the service (e.g., the serialized form of the stub changes, or the service implements a new interface).
Any duplicate attribute sets included in a service item are eliminated in the stored representation of the item. The lease duration request is not exact; the returned lease is allowed to have a shorter (but not longer) duration than what was requested. The registration is persistent across restarts (crashes) of the lookup service until the lease expires or is cancelled.
item
- service item to registerleaseDuration
- requested lease duration, in millisecondsRemoteException
ServiceDetails serviceDetails(ServiceID serviceID) throws RemoteException
RemoteException
Object lookup(ServiceTemplate tmpl) throws RemoteException
tmpl
- template to matchRemoteException
ServiceMatches lookup(ServiceTemplate tmpl, int maxMatches) throws RemoteException
tmpl
- template to matchmaxMatches
- maximum number of matches to returnRemoteException
RegistrarEventRegistration notify(ServiceTemplate tmpl, int transitions, RemoteEventListener listener, MarshalledObject handback, long leaseDuration) throws RemoteException
While the event registration is in effect, a ServiceEvent is sent to the specified listener whenever a register, lease cancellation or expiration, or attribute change operation results in an item changing state in a way that satisfies the template and transition combination.
tmpl
- template to matchtransitions
- bitwise OR of any non-empty set of transition valueslistener
- listener to send events tohandback
- object to include in every ServiceEvent generatedleaseDuration
- requested lease durationRemoteException
RegistrarEventRegistration notify(ServiceTemplate tmpl, int transitions, RemoteEventListener listener, MarshalledObject handback, long leaseDuration, int notifyType) throws RemoteException
RemoteException
Class[] getEntryClasses(ServiceTemplate tmpl) throws RemoteException
tmpl
- template to matchRemoteException
Object[] getFieldValues(ServiceTemplate tmpl, int setIndex, String field) throws NoSuchFieldException, RemoteException
tmpl
- template to matchsetIndex
- index into tmpl.attributeSetTemplatesfield
- name of field of tmpl.attributeSetTemplates[setIndex]NoSuchFieldException
- field does not name a field of the
entry templateRemoteException
Class[] getServiceTypes(ServiceTemplate tmpl, String prefix) throws RemoteException
tmpl
- template to matchprefix
- class name prefixRemoteException
ServiceID getServiceID()
LookupLocator getLocator() throws RemoteException
RemoteException
String[] getGroups() throws RemoteException
RemoteException
Object getRegistrar()
Copyright © GigaSpaces.