Summary of the invention
The objective of the invention is to have overcome above-mentioned shortcoming of the prior art, provide a kind of do not rely on concrete programming language and running environment flow process description, flexibility and changeability, conserve system resources, the operational efficiency of computing method higher, system performance is reliable and stable, the scope of application realizes the distributed service logic Calculation Method in the component software system comparatively widely.
In order to realize above-mentioned purpose, realize in the component software system of the present invention that the distributed service logic Calculation Method is as follows:
Realize the distributed service logic Calculation Method in this component software system, this method utilization local system and the remote server that is connected by computer network, its principal feature is that described method may further comprise the steps:
(1) system carries out initialization operation;
(2) service logic engine on the remote server starts the initialization process operation;
(3) the system front end controller receives the request of carrying out service logic, and the group # of group # or using system acquiescence is set according to the pre-configured strategy of system;
(4) system judges that the client of the request of transmission is positioned at local system or remote system;
(5), then directly carry out local service logical calling and handle operation if sending the client of request is to be positioned at local system;
(6), then search corresponding target and transmit the remote server address if sending the client of request is to be positioned at remote system;
(7) system will carry out the required information of this service logic and assemble processing;
(8) message after the system front end controller will be assembled is sent to described target and transmits remote server;
(9) the system front end controller is finished above-mentioned processing of request and is returned, and does not block follow-up processing;
(10) target is transmitted remote server and is received corresponding message, and triggers MDB (MessageDriven Bean) audiomonitor that always is in active state;
(11) the MDB audiomonitor unpacks processing to this message, and sends described service logic engine to;
(12) described service logic engine is carried out local service logical calling processing operation;
(13) this remote server is handled the result of calculation of operating with this service logical calling and is assembled processing again, and sends it back local system.
Described service logic engine starts the initialization process operation and may further comprise the steps:
(1) be written into the definition of all service logic with and the definition of the various Object-Oriented class that referred to;
(2) initialization service logic state also takes out the parameter of service logic from data bus;
(3) judge that whether this service logic is the service logic on the root node, if not, then is provided with the subservice logic flag;
(4) information of extracting in the runtime environment variable is put into log record;
(5) snapshot and the service logical calling stack information with the value of current data bus is made as current Debugging message;
(6) path of service logic is pressed into the top layer of call stack;
(7) flow process with service logic resolves into orderly Control Node and computing node.
Described service logical calling is handled operation and be may further comprise the steps:
(1) carries out according to the iteration that the flow process after this service logic is decomposed begins each node successively in synchronous obstruction mode;
(2) present node that preparation is carried out is pointed in the current XML data field of Debugging message;
(3) example of the present node of clone's preparation execution;
(4) duplicate the XML data uncle XML data field of the path point of input that present node is required and I/O parameter, is configured to the XML data field of current runtime of this node;
(5) carry out the arithmetic logic of this node;
(6) father XML data field is duplicated and covered to the XML data of the path point of output that this node is set and I/O parameter from current XML data field;
(7) iteration is carried out the end node of next node up to service logic;
(8) this service logic is ejected from call stack;
(9) current Debugging message is popped;
(10) Clear Log parameter;
(11) finish the operation of this service logic, and return the corresponding calculated result.
Described searching target is transmitted the remote server address: the pairing target forwarding server of the group # address of seeking this setting from system's table of database.
The described required information of service logic of will carrying out is assembled to handle and be may further comprise the steps:
(1) takes out this service logic and carry out required input parameter, and its sequence is changed into binary stream;
(2) title and the input parameter with this service logic is assembled into standard JMS message according to default form.
Comprise message attributes and message text in the described default form, described message attributes comprises module title, process title, bag title, request mark, application identities and unit marks, and described message text is the XML data after the serializing.
Described this message is unpacked to handle and send described service logic engine to may further comprise the steps:
(1) message is unpacked according to default form;
(2) will unpack the information that obtains and reinterpret into a service logical calling, and be transmitted to the EJB object of service logic engine;
(3) will carry out the required input parameter of service logic and carry out unserializing, and pass to service logic engine.
Service logical calling in carrying out local system or remote server handles before the operation, handle after the operation and handle and occur in the operating process all carrying out system handles person and handling operation under the unusual situation, and this processings is operated and be may further comprise the steps:
(1) system carries out processor's match query processing operation;
(2) carry out the processing that processor itself sets;
(3) under running into unusual situation in the processing procedure, if this processor oneself handles the unusual of inside, the disposal strategy after then will taking place unusually is with the mode reporting system of rreturn value;
(4), then stop carrying out other follow-up logic, and in running log, note abnormal information if this processor will dish out unusually.
The example that described system handles person is generated for processor factory, and carry out local service logical calling handle operation before, handle operation after and handle the system handles person who is carried out in the operating process and handle three methods that are respectively this system handles person's example of operating.
Described processor's match query is handled operation and be may further comprise the steps:
(1) set up Hash table in system, and the key word under the original state (Key) is set to non-processor person (NullHandler), this NullHandler represents not need to carry out any Handler operation;
(2) system is referred to as Key by processor's name and inquires about in Hash table, if inquire record, the processor in then directly will writing down takes out also and returns;
(3) if do not inquire record, then system uses asterisk wildcard to inquire about, and the result cache of inquiry is gone in the Hash table, and wherein Key is set to processor's title, is worth to be the processor.
Adopted and realized the distributed service logic Calculation Method in the component software system of this invention, because it finishes the control and the operation of member logic by the call flow that uses ad hoc fashion, realized software logic computing based on member, and do not rely on concrete programming language and running environment the flow process of computing method describe, whole logical groups assembling structure flexibility and changeability, make the operational efficiency of software component improve greatly, effectively saved system resource, and make system performance reliable and stable, reduced the cost of development and maintenance; System's portability and extensibility have been strengthened simultaneously; Moreover, this method can also be responded the variation and the technique variation of business demand fast, can support the software systems of setting up high modularization and highly integrating again, the scope of application is comparatively extensive, for the further developing of distributed service logic computing technique in the modern computer component software system lays a solid foundation.
Embodiment
In order more to be expressly understood technology contents of the present invention, describe in detail especially exemplified by following examples.
See also Fig. 1 to shown in Figure 5, realize in this component software system the distributed service logic Calculation Method comprising local system and the remote server that is connected by computer network, comprising following steps:
(1) system carries out initialization operation;
(2) service logic engine on the remote server starts the initialization process operation, may further comprise the steps:
(a) be written into the definition of all service logic with and the definition of the various Object-Oriented class that referred to;
(b) initialization service logic state and from data bus, take out the parameter of service logic;
(c) judge that whether this service logic is the service logic on the root node, if not, then is provided with the subservice logic flag;
(d) information of extracting in the runtime environment variable is put into log record;
(e) snapshot and the service logical calling stack information with the value of current data bus is made as current Debugging message;
(f) path of service logic is pressed into the top layer of call stack;
(g) flow process with service logic resolves into orderly Control Node and computing node;
(3) the system front end controller receives the request of carrying out service logic, and the group # of group # or using system acquiescence is set according to the pre-configured strategy of system;
(4) system judges that the client of the request of transmission is positioned at local system or remote system;
(5) if local system then directly carries out local service logical calling and handles operation, may further comprise the steps:
(a) carry out according to the iteration that the flow process after this service logic is decomposed begins each node successively in synchronous obstruction mode;
(b) present node that preparation is carried out is pointed in the current XML data field of Debugging message;
(c) example of the present node of clone's preparation execution;
(d) duplicate the XML data uncle XML data field of the path point of input that present node is required and I/O parameter, is configured to the XML data field of current runtime of this node;
(e) carry out the arithmetic logic of this node;
(f) father XML data field is duplicated and covered to the XML data of the path point of output that this node is set and I/O parameter from current XML data field;
(g) iteration is carried out the end node of next node up to service logic;
(h) this service logic is ejected from call stack;
(i) current Debugging message is popped;
(j) Clear Log parameter;
(k) finish the operation of this service logic, and return the corresponding calculated result;
(6) if remote system is then searched corresponding target and transmitted the remote server address, this seek operations is: the pairing target forwarding server of the group # address of seeking this setting from system's table of database;
(7) system will carry out the required information of this service logic and assemble processing, may further comprise the steps:
(a) take out this service logic and carry out required input parameter, and its sequence is changed into binary stream;
(b) title and the input parameter with this service logic is assembled into standard JMS (Java MessageService according to default form, the Java messenger service) message, should comprise message attributes and message text in the default form, described message attributes comprises module title, process title, bag title, request mark, application identities and unit marks, and described message text is the XML data after the serializing;
(8) message after the system front end controller will be assembled is sent to described target and transmits remote server;
(9) the system front end controller is finished above-mentioned processing of request and is returned, and does not block follow-up processing;
(10) target is transmitted remote server and is received corresponding message, and triggers MDB (MessageDriven Bean) audiomonitor that always is in active state;
(11) the MDB audiomonitor unpacks processing to this message, and sends described service logic engine to, may further comprise the steps:
(a) message is unpacked according to default form;
(b) will unpack the information that obtains and reinterpret into a service logical calling, and be transmitted to the EJB object of service logic engine;
(c) will carry out the required input parameter of service logic and carry out unserializing, and pass to service logic engine;
(12) service logic engine is carried out local service logical calling processing operation;
(13) this remote server is handled the result of calculation of operating with this service logical calling and is assembled processing again, and sends it back local system.
Simultaneously, carry out local service logical calling handle operation before, handle operation after and handle and occur in the operating process all carrying out system handles person (Handler) and handling operation under the unusual situation, this processing is operated and be may further comprise the steps:
(1) system carries out processor's match query processing operation, may further comprise the steps:
(a) in system, set up Hash (Hash) table, and the Key under the original state is set to NullHandler;
(b) system is referred to as Key by processor's name and inquires about in Hash table, if inquire record, the processor in then directly will writing down takes out also and returns;
(c) if do not inquire record, then system uses asterisk wildcard to inquire about, and the result cache of inquiry is gone in the Hash table, and wherein Key is set to processor's title, is worth to be the processor;
(2) carry out the processing that processor itself sets;
(3) under running into unusual situation in the processing procedure, if this processor oneself handles the unusual of inside, the disposal strategy after then will taking place unusually is with the mode reporting system of rreturn value;
(4), then stop carrying out other follow-up logic, and in running log, note abnormal information if this processor will dish out unusually.
The example that described system handles person is generated for processor factory (HandlerFactory), and carry out local service logical calling handle operation before, handle operation after and handle the system handles person who is carried out in the operating process and handle three methods that are respectively this system handles person's example of operating.
In the middle of practical application, in the distributed service logic computing method of the present invention, the account form of member is as follows:
1, basic calculation
(1) when starting, service logic engine will be written into all service logic definition and the definition of various OO (OO, Object Oriented) class that it referred to;
(2) initialization service logic state also takes out the parameter of service logic from data bus;
(3) if service logic is the service logic on the root node, then put the subservice logic flag;
(4) information of extracting in the runtime environment variable is put into log record;
(5) value snapshot and the service logical calling stack information with the current data bus is made as current Debugging message;
(6) path of service logic is pressed into the top layer of call stack;
(7) flow process with service logic resolves into orderly Control Node and computing node;
(8) iteration that begins each node successively according to the flow process after decomposing is carried out;
(9) node that preparation is carried out is pointed in the current XML data field of Debugging message;
(10) example (preventing concurrency conflict) of the node of clone's preparation execution;
(11) duplicate the XML data uncle XML data field of the path point of input that node is required and I/O parameter, is configured to the XML data field of current runtime of node;
(12) carry out the arithmetic logic of this node;
(13) father XML data field is duplicated and covered to the XML data of the path point of output that node is set and I/O parameter from current XML data field;
(14) iteration is carried out the end node of next node up to service logic;
(15) the current business logic is ejected from call stack;
(16) current Debugging message is popped;
(17) Clear Log parameter;
(18) operation of winding-up logic.
2, based on the distributed computing model of group #
(1) front controller is received the request of carrying out service logic;
(2) group # UnitId is set or uses the group # of giving tacit consent to according to configured strategy;
(3) judge that sending the client of asking is positioned at local machine or remote machine;
(4) if then directly using, local machine blocks the calculating of method of calling execution service logic synchronously;
(5) otherwise, go to seek in system's table of database the pairing forwarding server of given UnitId address;
(6) in order to allow request can pass through Network Transmission, at first take out the required input parameter of this service logic, its sequence is changed into binary stream;
Service logic title of (7) being asked and the parameter of calling are formatted into the standard JMS message of following form:
(8) on the target forwarding server of selecting before the message after the assembling is sent to;
(9) front controller is finished this processing of request and is returned, and does not block follow-up processing;
(10) when message arrived destination server, the MDB audiomonitor that always is in active state will be triggered;
(11) reinterpret into a service logical calling after audiomonitor unpacks message and be transmitted to EJB (the Enterprise Java Bean) object of service logic engine;
(12) the required input parameter of service logic is also together passed to service logic engine this moment after the unserializing;
(13) service logic engine is calculated with general service logical course actuating logic;
(14) result calculated is again by serializing and return;
3, calculate in the service logic cross section
The purpose of handling (Handle) is in order to add new processing flexibly on some opportunitys that logic means is handled, logic means just only needs to be concerned about concrete traffic issues like this, some extra operations can be disposed flexibly, have played the effect (PointCut is exactly that each represents logic, service logic) of similar dynamic AOP.In order to support developer's customization more flexibly, need realize further expanding to present Handle.In component software system, comprise two kinds of Handle, promptly represent logic Handle and service logic Handle, increased an arithmetic logic Handler now,, can adjust back the Handle (bizlet Handle) of computing member on the forward and backward opportunity that the computing member is carried out.
(1) Handle call-by mechanism
In the existing component software system, have only the opportunity that Handle is called back logic to carry out preceding and latter two moment of execution, increased a moment of dishing out unusually now.In logic is called preceding, be called back or logic implementation, take place unusual the time, all will trigger the corresponding call back function of appointment Handle.
Handler should oneself handle the unusual of inside in principle, by the disposal strategy after unusual generation of Server of rreturn value announcement, if Handler will dish out unusually, then Yu Xia logic and Handler will can not be performed, and note abnormal information in running log.
(2) efficient of Handler
Because it is very frequent that the Handler as access control processor (AccessController) calls, the operational efficiency of Handler is than higher.The efficient that guarantees original Handler is considered from two aspects:
It at first is the generation of Handler.Processor factory (HandlerFactory) is that each Handler generates an example, and preposition, postposition and abnormality processing are defined as three methods of a Handler, and each Handler only can be by instantiation once like this.When using adapter processing person (Adapter) to call original Handler to realize, Adapter only generates once, by distribution (Dispatch) pattern right of execution is acted on behalf of to concrete Handler example.
See also shown in Figure 5ly again, Adapter itself also only has an example, and the Handler that by setDelegatingHandlerClass it is acted on behalf of when at every turn calling points to different original Handler examples.
Next is the matching efficiency of Handler, because each efficient of using asterisk wildcard to inquire about is not best, so after each match hit, the result of coupling is cached in the Hash table, when calling the logic of same title later, corresponding Handler will be reached from cache table directly at every turn.Because the key word (key) of Map can not be null value (null), so when logic is not joined any Handler, will in table, put a NullHandler and represent not need to carry out any Handler operation.
(3) concurrent processing of Handler
In the realization of traditional old interface, the interface that only represents logic has been realized clone's interface (java.lang.Clonable ()), and new interface changes universal succession clone interface into, and each request is carried out, and all duplicates a new instance processes request.
In the above-described embodiments, what use is the extending mark language description of structure, can certainly adopt other standard unit language mechanism as required, which kind of no matter adopts describe mechanism, construction method of the present invention can be good at supporting the visual of performance history all the time.In Integrated Development Environment, the internal logic of member and interface definition can be showed more intuitively, thereby improve exploitation greatly, debugging, deployment, efficiency of managing.
In the modern computer field of software development, the component-oriented technology has been integrated traditional component technology, model-driven technology and service-oriented technology, is a kind of effective means that solves existing software system structure drawback.So-called member is meant that certain has a style of one's own and the software of (or one a group) clear interface is arranged.Simultaneously, member should have when moving clearly and the intension of reaching the standard grade.That is to say that this member possesses the interface of visit in the time of can supplying operation; And at certain time point of SDLC, this member can independently be paid and install.In addition, also necessarily require a member to merge or combination with other members easily, thereby various useful functions are provided, and under normal conditions, single member has only the component synergism work with other just can reach its effect.
Architectural framework based on component-oriented, the exploitation of component-oriented is a kind of advanced person's software development means, different phase and different aspect in the construction cycle---comprise demand analysis, structure, design, foundation, test, reach the standard grade, supportive Technical Architecture, project management etc., all based on member.This definition is set up software to the extension of component-oriented exploitation from the thinking of utilization component-oriented, has expanded to the entire software development cycle---and its all stages and all aspects all are the center with the member.Can be used for assembling at any time if wish member, these members must be built as the part of project, and component-oriented seemed and had superiority especially this moment.Therefore, conceiving infosystem with the member method, is the best approach of controlling large-scale distributed system development complexity at present.
Adopted and realized the distributed service logic Calculation Method in the above-mentioned component software system, because it finishes the control and the operation of member logic by the call flow that uses ad hoc fashion, realized software logic computing based on member, and do not rely on concrete programming language and running environment the flow process of computing method describe, whole logical groups assembling structure flexibility and changeability, make the operational efficiency of software component improve greatly, effectively saved system resource, and make system performance reliable and stable, reduced the cost of development and maintenance; System's portability and extensibility have been strengthened simultaneously; By implementing distributed service logic computing method of the present invention, can make that the advantage of software of componentization is given full play to, and the strong exploitation of supporting component software system, have following advantage simultaneously:
(1) greatly reduce exploitation, reach the standard grade, personalized costs, but develop easily to large-scale high-performance and expanding system, thereby reduce " manufacturing cost " of software development aspect.In other words, this life cycle is developed in the analysis---design---of being not only that construction method of the present invention is paid close attention to, but the whole life-span of software product;
(2) can respond the variation of " business demand " and " technique variation " fast.Construction method of the present invention can be dealt with the real needs of certain vertical field or certain particular customer in the mode of " order production ", thereby can pay out the product and the flow process of " highly personalized " and " configurable ";
(3) can support the not only software of " high modularization " but also " highly integrating " of foundation.Construction method of the present invention can make software component not only have the border of explication, belongs to a clear and definite structure simultaneously again;
(4) construction method of the present invention is a kind of actual software component " standard ", can play the directive function on both side of technology and function to member specification and interaction.
Moreover, this method can also be responded the variation and the technique variation of business demand fast, can support the software systems of setting up high modularization and highly integrating again, the scope of application is comparatively extensive, for the further developing of distributed service logic computing technique in the modern computer component software system lays a solid foundation.
In this instructions, the present invention is described with reference to its certain embodiments.But, still can make various modifications and conversion obviously and not deviate from the spirit and scope of the present invention.Therefore, instructions and accompanying drawing are regarded in an illustrative, rather than a restrictive.