|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.netflix.eureka.InstanceRegistry
public abstract class InstanceRegistry
Handles all registry requests from eureka clients.
Primary operations that are performed are the Registers,Renewals,Cancels,Expirations and Status Changes. The registry also stores only the delta operations
| Field Summary | |
|---|---|
protected java.lang.String[] |
allKnownRemoteRegions
|
static java.lang.String[] |
EMPTY_STR_ARRAY
|
protected static EurekaServerConfig |
EUREKA_SERVER_CONFIG
|
protected int |
expectedNumberOfRenewsPerMin
|
protected java.lang.Object |
lock
|
protected int |
numberOfRenewsPerMinThreshold
|
protected java.util.concurrent.ConcurrentMap<java.lang.String,com.netflix.appinfo.InstanceInfo.InstanceStatus> |
overriddenInstanceStatusMap
|
protected java.util.Map<java.lang.String,RemoteRegionRegistry> |
regionNameVSRemoteRegistry
|
| Constructor Summary | |
|---|---|
protected |
InstanceRegistry()
|
| Method Summary | |
|---|---|
boolean |
cancel(java.lang.String appName,
java.lang.String id,
boolean isReplication)
Cancels the registration of an instance. |
void |
clearRegistry()
|
void |
evict()
Evict Ts with expired Lease(s). |
com.netflix.discovery.shared.Application |
getApplication(java.lang.String appName)
|
com.netflix.discovery.shared.Application |
getApplication(java.lang.String appName,
boolean includeRemoteRegion)
Get application information. |
com.netflix.discovery.shared.Applications |
getApplicationDeltas()
Deprecated. use getApplicationDeltasFromMultipleRegions(String[]) instead. This method has a flawed behavior
of transparently falling back to a remote region if no instances for an app is available locally. The new
behavior is to explictly specify if you need a remote region. |
com.netflix.discovery.shared.Applications |
getApplicationDeltasFromMultipleRegions(java.lang.String[] remoteRegions)
Gets the application delta also including instances from the passed remote regions, with the instances from the local region. |
com.netflix.discovery.shared.Applications |
getApplications()
|
com.netflix.discovery.shared.Applications |
getApplications(boolean includeRemoteRegion)
Deprecated. Use getApplicationsFromMultipleRegions(String[]) instead. This method has a flawed behavior
of transparently falling back to a remote region if no instances for an app is available locally. The new
behavior is to explictly specify if you need a remote region. |
com.netflix.discovery.shared.Applications |
getApplicationsFromAllRemoteRegions()
Returns applications including instances from all remote regions. |
com.netflix.discovery.shared.Applications |
getApplicationsFromLocalRegionOnly()
Returns applications including instances from local region only. |
com.netflix.discovery.shared.Applications |
getApplicationsFromMultipleRegions(java.lang.String[] remoteRegions)
This method will return applications with instances from all passed remote regions as well as the current region. |
com.netflix.appinfo.InstanceInfo |
getInstanceByAppAndId(java.lang.String appName,
java.lang.String id)
Gets the InstanceInfo information. |
com.netflix.appinfo.InstanceInfo |
getInstanceByAppAndId(java.lang.String appName,
java.lang.String id,
boolean includeRemoteRegions)
Gets the InstanceInfo information. |
java.util.List<com.netflix.appinfo.InstanceInfo> |
getInstancesById(java.lang.String id)
|
java.util.List<com.netflix.appinfo.InstanceInfo> |
getInstancesById(java.lang.String id,
boolean includeRemoteRegions)
Get the list of instances by its unique id. |
java.util.List<com.netflix.discovery.shared.Pair<java.lang.Long,java.lang.String>> |
getLastNCanceledInstances()
|
java.util.List<com.netflix.discovery.shared.Pair<java.lang.Long,java.lang.String>> |
getLastNRegisteredInstances()
|
long |
getNumberofElementsininstanceCache()
|
long |
getNumOfRenewsInLastMin()
|
protected void |
initRemoteRegionRegistry()
|
abstract boolean |
isLeaseExpirationEnabled()
|
protected void |
postInit()
|
void |
register(com.netflix.appinfo.InstanceInfo r,
int leaseDuration,
boolean isReplication)
Assign a new Lease to the passed in T |
boolean |
renew(java.lang.String appName,
java.lang.String id,
boolean isReplication)
Renew the Lease associated w/ the passed in appName
and id |
boolean |
statusUpdate(java.lang.String appName,
java.lang.String id,
com.netflix.appinfo.InstanceInfo.InstanceStatus newStatus,
java.lang.String lastDirtyTimestamp,
boolean isReplication)
Updates the status of an instance. |
void |
storeOverriddenStatusIfRequired(java.lang.String id,
com.netflix.appinfo.InstanceInfo.InstanceStatus overriddenStatus)
Stores overridden status if it is not already there. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.netflix.discovery.shared.LookupService |
|---|
getNextServerFromEureka |
| Field Detail |
|---|
public static final java.lang.String[] EMPTY_STR_ARRAY
protected java.util.concurrent.ConcurrentMap<java.lang.String,com.netflix.appinfo.InstanceInfo.InstanceStatus> overriddenInstanceStatusMap
protected java.util.Map<java.lang.String,RemoteRegionRegistry> regionNameVSRemoteRegistry
protected java.lang.String[] allKnownRemoteRegions
protected java.lang.Object lock
protected volatile int numberOfRenewsPerMinThreshold
protected volatile int expectedNumberOfRenewsPerMin
protected static final EurekaServerConfig EUREKA_SERVER_CONFIG
| Constructor Detail |
|---|
protected InstanceRegistry()
| Method Detail |
|---|
public void clearRegistry()
public void register(com.netflix.appinfo.InstanceInfo r,
int leaseDuration,
boolean isReplication)
LeaseManagerLease to the passed in T
register in interface LeaseManager<com.netflix.appinfo.InstanceInfo>r - - T to registerisReplication - - whether this is a replicated entry from another eureka node.
public boolean cancel(java.lang.String appName,
java.lang.String id,
boolean isReplication)
This is normally invoked by a client when it shuts down informing the server to remove the instance from traffic.
cancel in interface LeaseManager<com.netflix.appinfo.InstanceInfo>appName - the application name of the application.id - the unique identifier of the instance.isReplication - true if this is a replication event from other nodes, false
otherwise.
InstanceRegistry successfully, false otherwise.
public boolean renew(java.lang.String appName,
java.lang.String id,
boolean isReplication)
LeaseManagerLease associated w/ the passed in appName
and id
renew in interface LeaseManager<com.netflix.appinfo.InstanceInfo>id - - unique id within appNameisReplication - - whether this is a replicated entry from another ds node
public void storeOverriddenStatusIfRequired(java.lang.String id,
com.netflix.appinfo.InstanceInfo.InstanceStatus overriddenStatus)
id - the unique identifier of the instance.overriddenStatus - Overridden status if any.
public boolean statusUpdate(java.lang.String appName,
java.lang.String id,
com.netflix.appinfo.InstanceInfo.InstanceStatus newStatus,
java.lang.String lastDirtyTimestamp,
boolean isReplication)
InstanceInfo.InstanceStatus.OUT_OF_SERVICE and
InstanceInfo.InstanceStatus.UP to put the instance in and out of traffic.
appName - the application name of the instance.id - the unique identifier of the instance.newStatus - the new InstanceInfo.InstanceStatus.lastDirtyTimestamp - last timestamp when this instance information was updated.isReplication - true if this is a replication event from other nodes, false
otherwise.
public void evict()
LeaseManagerTs with expired Lease(s).
evict in interface LeaseManager<com.netflix.appinfo.InstanceInfo>public com.netflix.discovery.shared.Application getApplication(java.lang.String appName)
getApplication in interface com.netflix.discovery.shared.LookupService<java.lang.String>
public com.netflix.discovery.shared.Application getApplication(java.lang.String appName,
boolean includeRemoteRegion)
appName - - The name of the applicationincludeRemoteRegion - - true, if we need to include applications from remote regions
as indicated by the region URL by this property
EurekaServerConfig.getRemoteRegionUrls(), false
otherwise
public com.netflix.discovery.shared.Applications getApplications()
getApplications in interface com.netflix.discovery.shared.LookupService<java.lang.String>public com.netflix.discovery.shared.Applications getApplicationsFromAllRemoteRegions()
getApplicationsFromMultipleRegions(String[]) with a null argument.
public com.netflix.discovery.shared.Applications getApplicationsFromLocalRegionOnly()
getApplicationsFromMultipleRegions(String[]) with an empty array.
public com.netflix.discovery.shared.Applications getApplicationsFromMultipleRegions(java.lang.String[] remoteRegions)
EurekaServerConfig.getRemoteRegionAppWhitelist(String) for every region. In case, there is no whitelist
defined for a region, this method will also look for a global whitelist by passing null to the
method EurekaServerConfig.getRemoteRegionAppWhitelist(String) getApplicationsFromAllRemoteRegions()
or getApplicationsFromLocalRegionOnly()
remoteRegions - The remote regions for which the instances are to be queried. The instances may be limited
by a whitelist as explained above. If null or empty no remote regions are included.
@Deprecated public com.netflix.discovery.shared.Applications getApplications(boolean includeRemoteRegion)
getApplicationsFromMultipleRegions(String[]) instead. This method has a flawed behavior
of transparently falling back to a remote region if no instances for an app is available locally. The new
behavior is to explictly specify if you need a remote region.
Applications.
includeRemoteRegion - - true, if we need to include applications from remote regions
as indicated by the region URL by this property
EurekaServerConfig.getRemoteRegionUrls(), false
otherwise
@Deprecated public com.netflix.discovery.shared.Applications getApplicationDeltas()
getApplicationDeltasFromMultipleRegions(String[]) instead. This method has a flawed behavior
of transparently falling back to a remote region if no instances for an app is available locally. The new
behavior is to explictly specify if you need a remote region.
EurekaServerConfig.getRetentionTimeInMSInDeltaQueue(). Subsequent
requests for delta information may return the same information and client
must make sure this does not adversely affect them.
public com.netflix.discovery.shared.Applications getApplicationDeltasFromMultipleRegions(java.lang.String[] remoteRegions)
EurekaServerConfig.getRemoteRegionAppWhitelist(String) for a region. In case, there is no whitelist
defined for a region, this method will also look for a global whitelist by passing null to the
method EurekaServerConfig.getRemoteRegionAppWhitelist(String)
remoteRegions - The remote regions for which the instances are to be queried. The instances may be limited
by a whitelist as explained above. If null all remote regions are included.
If empty list then no remote region is included.
null if the application does
not exist locally or in remote regions.
public com.netflix.appinfo.InstanceInfo getInstanceByAppAndId(java.lang.String appName,
java.lang.String id)
InstanceInfo information.
appName - the application name for which the information is requested.id - the unique identifier of the instance.
public com.netflix.appinfo.InstanceInfo getInstanceByAppAndId(java.lang.String appName,
java.lang.String id,
boolean includeRemoteRegions)
InstanceInfo information.
appName - the application name for which the information is requested.id - the unique identifier of the instance.includeRemoteRegions - - true, if we need to include applications from remote regions
as indicated by the region URL by this property
EurekaServerConfig.getRemoteRegionUrls(), false
otherwise
public java.util.List<com.netflix.appinfo.InstanceInfo> getInstancesById(java.lang.String id)
getInstancesById in interface com.netflix.discovery.shared.LookupService<java.lang.String>
public java.util.List<com.netflix.appinfo.InstanceInfo> getInstancesById(java.lang.String id,
boolean includeRemoteRegions)
id - - the unique id of the instanceincludeRemoteRegions - - true, if we need to include applications from remote regions
as indicated by the region URL by this property
EurekaServerConfig.getRemoteRegionUrls(), false
otherwise
public abstract boolean isLeaseExpirationEnabled()
@Monitor(name="numOfRenewsInLastMin",
description="Number of total heartbeats received in the last minute",
type=GAUGE)
public long getNumOfRenewsInLastMin()
public java.util.List<com.netflix.discovery.shared.Pair<java.lang.Long,java.lang.String>> getLastNRegisteredInstances()
public java.util.List<com.netflix.discovery.shared.Pair<java.lang.Long,java.lang.String>> getLastNCanceledInstances()
protected void postInit()
@Monitor(name="numOfElementsinInstanceCache",
description="Number of elements in the instance Cache",
type=GAUGE)
public long getNumberofElementsininstanceCache()
protected void initRemoteRegionRegistry()
throws java.net.MalformedURLException
java.net.MalformedURLException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||