Summary of the invention
For the poor problem of autgmentability, modificability that correlation technique medium-long range service issue exists, the present invention proposes a kind of dissemination method and device of far call service, can monitor and the far call business service autgmentability that the assurance system is good and modificability.
Technical scheme of the present invention is achieved in that
According to an aspect of the present invention, provide a kind of dissemination method of far call service, the method comprises:
Announced business service is monitored, determined whether to exist the business service that need to change to the far call service;
Change to the business service of far call service for needs, according to the interface crawl business service sample of this business service, and this business service carried out long-range issue.
Wherein, announced business service is monitored, is determined whether to exist the business service that need to change to the far call service to comprise:
Configuration file according to announced business service filters, and obtains changing to the tabulation of the business service of far call service.
And, comprise the interface name of the business service that need to change to far call service in the tabulation.
In addition, crawl business service sample comprises:
The business service that needs is changed to the far call service creates tracker, is grasped the crawl business service sample of this business service by tracker.
And business service is the OSGI business service.
According to another aspect of the present invention, provide a kind of distributing device of far call service, this device comprises:
Monitoring module is used for announced business service is monitored, and determines whether to exist the business service that need to change to the far call service;
Release module is used for needs are changed to the business service of far call service, according to the interface crawl business service sample of this business service, and this business service is carried out long-range issue.
Wherein, monitoring module is used for filtering according to the configuration file of announced business service, obtains changing to the tabulation of the business service of far call service.
And, comprise the interface name of the business service that need to change to far call service in the tabulation.
In addition, release module is specifically followed the tracks of for the business service that needs is changed to the far call service, and grasps the crawl business service sample of this business service.
And business service is the OSGI business service.
The present invention is by monitoring announced business service, determine whether to exist the business service that need to change to the far call service, change to the business service of far call service for needs, interface crawl business service sample according to this business service, and this business service carried out long-range issue, can monitor and the far call business service, the autgmentability that the assurance system is good and modificability, produce a large amount of workloads when avoiding that business service carried out long-range issue, improved the efficient of service distribution.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, the every other embodiment that those of ordinary skills obtain belongs to the scope of protection of the invention.
According to embodiments of the invention, provide a kind of dissemination method of far call service.
As shown in Figure 1, the dissemination method according to the far call service of the embodiment of the invention comprises:
Step S101 monitors announced business service, determines whether to exist the business service that need to change to the far call service;
Step S103 changes to the business service of far call service for needs, according to the interface crawl business service sample of this business service, and this business service is carried out long-range issue.
Wherein, announced business service is monitored, is determined whether to exist the business service that need to change to the far call service to comprise:
Configuration file according to announced business service filters, and obtains changing to the tabulation of the business service of far call service.
And, comprise the interface name of the business service that need to change to far call service in the tabulation.
In addition, crawl business service sample comprises:
The business service that needs is changed to the far call service creates tracker, is grasped the crawl business service sample of this business service by tracker.
And, business service is that (Open Service Gateway Initiative technology is the dynamic modeling system towards Java to OSGI, the OSGi technology provides the standardization primitive that allows application program to use refining, the reusable and component construction that can cooperate, and these assemblies can be assembled into one and use and dispose) business service.
A kind of distributing device of far call service is provided according to one embodiment of present invention.
As shown in Figure 2, the distributing device according to the far call service of the embodiment of the invention comprises:
Monitoring module 21 is used for announced business service is monitored, and determines whether to exist the business service that need to change to the far call service;
Release module 22 is used for needs are changed to the business service of far call service, according to the interface crawl business service sample of this business service, and this business service is carried out long-range issue.
Wherein, monitoring module is used for filtering according to the configuration file of announced business service, obtains changing to the tabulation of the business service of far call service.
And, comprise the interface name of the business service that need to change to far call service in the tabulation.
In addition, release module is specifically followed the tracks of for the business service that needs is changed to the far call service, and grasps the crawl business service sample of this business service.
And business service is the OSGI business service.
As shown in Figure 3, be the business service far call of the embodiment of the invention and the process of monitors distribution.
At first, carry out the issue of business service, secondly, the service of issue far call, and the process of monitors distribution, last, issue OSGI service.
Technical scheme of the present invention depends on cloud computing application deployment environment (OSGI), and it is as follows that system dynamically issues the remote access service step:
A. monitor all announced OSGI services in the deployed environment;
B. according to configuration file, filter the OSGI service in the deployed environment, the be as the criterion interface name tabulation of preparation cloth remote access service of the content in the configuration file;
C. business service is changed to remote access service;
Dynamically issue remote access service for the realization said system, need remote service distributor of definition and service parameter reader.
The first, the service parameter reader be used for to realize reading service issue configuration file, and the service list that need to issue of buffer memory.
The corresponding interface of service parameter reader is as follows:
At first, service issue configuration file is read in initialization, and the service list that need to issue of buffer memory:
public?void?init()throws?IOException
Secondly, obtain announced service list:
public?List<String>getDeployService()
At last, by the service major key, obtain specified services information:
public?String?getPropertyValue(String?key)
The flow process of service parameter reader is described below:
At first, initial method reads configuration file;
Secondly, resolve configuration file, and be cached in the Properties object;
At last, obtain the service list that needs issue.
The second, the remote service distributor is used for realizing following the tracks of and filtering business service, and the business service issue of needs is become remote access service.
The corresponding interface of remote service distributor is as follows:
At first, by the service of tracker issue far call:
Public?void?deployService(BundleContext?context)throws?Exception
Secondly, create the service tracks distributor:
private?ServiceTrackerCustomizer?createStCustomizer(
final?BundleContext?context,final?Class<?>clz)
The flow process of remote service distributor is described below:
At first, obtain the service list that needs issue;
Secondly, the searching loop service list, and create corresponding tracker;
And, also comprise following description:
Monitor all announced business service in the OSGI service environment;
Judge whether loading service needs the remote service that changes;
If directly this business service issue is become the far call service;
Monitor unloaded service operations in the OSGI service environment;
Judge whether remote service of offload services;
If unload current remote service.
Technical scheme of the present invention is dissemination method and the device of a kind of far call service, to solve the problems such as different business systems issue remote service autgmentability in the cloud computing environment, modificability be poor.
Technical scheme of the present invention has defined a remote service distributor and service parameter reader, realize dynamically issue remote service functions, to the upper-layer service system mask published method of bottom, upper-layer service only need to be paid close attention to the own service logic, and use unified published method at bottom, shielded the otherness of different business service.When calling remote service generation change, only need to revise the remote service published method, and can not have influence on business logic processing, guaranteed the autgmentability that system is good.
Technical scheme of the present invention mainly comprises service issue configuration management and dynamically issues remote service.This technical scheme is irrelevant with concrete business processing logic, but exists in a kind of mode of monitor, but system can become the local service issue automatically according to service configuration the service of far call.Avoid the non-business processing step of the overstaffed intervention of business development, reduced simultaneously because the far call mode changes, and had influence on the modification of business module.
In sum, by means of technique scheme of the present invention, by announced business service is monitored, determine whether to exist the business service that need to change to the far call service, change to the business service of far call service for needs, interface crawl business service sample according to this business service, and this business service carried out long-range issue, can monitor and the far call business service, the autgmentability that the assurance system is good and modificability, produce a large amount of workloads when avoiding that business service carried out long-range issue, improved the efficient of service distribution.
The above only is preferred embodiment of the present invention, and is in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of doing, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.