use of com.alibaba.nacos.naming.core.v2.pojo.Service in project nacos by alibaba.
the class InstanceMetadataProcessor method updateInstanceMetadata.
private void updateInstanceMetadata(MetadataOperation<InstanceMetadata> op) {
Service service = Service.newService(op.getNamespace(), op.getGroup(), op.getServiceName());
namingMetadataManager.updateInstanceMetadata(service, op.getTag(), op.getMetadata());
NotifyCenter.publishEvent(new ServiceEvent.ServiceChangedEvent(service, true));
}
use of com.alibaba.nacos.naming.core.v2.pojo.Service in project nacos by alibaba.
the class InstanceMetadataProcessor method deleteInstanceMetadata.
private void deleteInstanceMetadata(MetadataOperation<InstanceMetadata> op) {
Service service = Service.newService(op.getNamespace(), op.getGroup(), op.getServiceName());
namingMetadataManager.removeInstanceMetadata(service, op.getTag());
}
use of com.alibaba.nacos.naming.core.v2.pojo.Service in project nacos by alibaba.
the class NamingMetadataManager method handleInstanceMetadataEvent.
private void handleInstanceMetadataEvent(MetadataEvent.InstanceMetadataEvent event) {
Service service = event.getService();
String metadataId = event.getMetadataId();
if (containInstanceMetadata(service, metadataId)) {
updateExpiredInfo(event.isExpired(), ExpiredMetadataInfo.newExpiredInstanceMetadata(event.getService(), event.getMetadataId()));
}
}
use of com.alibaba.nacos.naming.core.v2.pojo.Service in project nacos by alibaba.
the class NamingMetadataManager method loadServiceMetadataSnapshot.
/**
* Load service metadata snapshot.
*
* <p>Service metadata need load back the service.
*
* @param snapshot snapshot
*/
public void loadServiceMetadataSnapshot(ConcurrentMap<Service, ServiceMetadata> snapshot) {
for (Service each : snapshot.keySet()) {
ServiceManager.getInstance().getSingleton(each);
}
ConcurrentMap<Service, ServiceMetadata> oldSnapshot = serviceMetadataMap;
serviceMetadataMap = snapshot;
oldSnapshot.clear();
}
use of com.alibaba.nacos.naming.core.v2.pojo.Service in project nacos by alibaba.
the class ServiceMetadataProcessor method updateServiceMetadata.
private void updateServiceMetadata(MetadataOperation<ServiceMetadata> op) {
Service service = Service.newService(op.getNamespace(), op.getGroup(), op.getServiceName(), op.getMetadata().isEphemeral());
Optional<ServiceMetadata> currentMetadata = namingMetadataManager.getServiceMetadata(service);
if (currentMetadata.isPresent()) {
ServiceMetadata newMetadata = mergeMetadata(currentMetadata.get(), op.getMetadata());
Service singleton = ServiceManager.getInstance().getSingleton(service);
namingMetadataManager.updateServiceMetadata(singleton, newMetadata);
} else {
Service singleton = ServiceManager.getInstance().getSingleton(service);
namingMetadataManager.updateServiceMetadata(singleton, op.getMetadata());
}
doubleWriteMetadata(service, false);
}
Aggregations