CN112988277B - Rule file loading method, device, server and medium - Google Patents

Rule file loading method, device, server and medium Download PDF

Info

Publication number
CN112988277B
CN112988277B CN202110349296.8A CN202110349296A CN112988277B CN 112988277 B CN112988277 B CN 112988277B CN 202110349296 A CN202110349296 A CN 202110349296A CN 112988277 B CN112988277 B CN 112988277B
Authority
CN
China
Prior art keywords
rule file
session object
rule
file
name
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110349296.8A
Other languages
Chinese (zh)
Other versions
CN112988277A (en
Inventor
胡元
乔迟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CCB Finetech Co Ltd
Original Assignee
CCB Finetech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by CCB Finetech Co Ltd filed Critical CCB Finetech Co Ltd
Priority to CN202110349296.8A priority Critical patent/CN112988277B/en
Publication of CN112988277A publication Critical patent/CN112988277A/en
Application granted granted Critical
Publication of CN112988277B publication Critical patent/CN112988277B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a rule file loading method, a rule file loading device, a rule file loading server and a rule file loading medium. The method comprises the following steps: placing a rule engine in a state of not being ready, acquiring an update rule file, and storing the update rule file under a preset folder in a system; constructing a session object corresponding to the updated rule file, and placing the rule engine in a ready state; and loading the updating rule file through the rule engine according to the session object. According to the technical scheme, the problems that the rule file can be loaded only by stopping the system when the rule is newly added, the rule is modified and the rule is abandoned are solved, and the effects that the rule file can be automatically loaded, the system development efficiency is improved and the user experience is improved without stopping and restarting the system when the rule file is updated are achieved.

Description

Rule file loading method, device, server and medium
Technical Field
The embodiment of the invention relates to the technical field of Internet, in particular to a rule file loading method, a device, a server and a medium.
Background
The rules engine can separate business decision logic of business decision makers and technical decisions of application developers in the application system, and place the business decisions in a central database or other unified place, so that the business decisions can be dynamically managed and modified during operation, thereby providing effective technical support for enterprises to maintain flexibility and competitiveness.
The existing rule engine puts the written rule file in a folder under the application engineering directory, and when the application is started, all rule files are loaded into the application running space. If the rule file is updated, the application is restarted, and the influence of restarting the application once is considerable for a large-sized application.
Disclosure of Invention
The embodiment of the invention provides a rule file loading method, a rule file loading device, a rule file loading server and a rule file loading medium, so that the rule file can be updated without restarting a system, and the operation influence on the system is reduced.
In a first aspect, an embodiment of the present invention provides a rule file loading method, where the method includes:
placing a rule engine in a state of not being ready, acquiring an update rule file, and storing the update rule file under a preset folder in a system;
constructing a session object corresponding to the updated rule file, and placing the rule engine in a ready state;
and loading the updating rule file through the rule engine according to the session object.
In a second aspect, an embodiment of the present invention further provides a rule file loading device, where the rule file loading device includes:
the updating rule file acquisition module is used for placing the rule engine in a state of not being ready to acquire an updating rule file and storing the updating rule file in a preset folder in the system;
a session object construction module, configured to construct a session object corresponding to the updated rule file, and place a rule engine in a ready state;
and the updating rule file loading module is used for loading the updating rule file through the rule engine according to the session object.
In a third aspect, an embodiment of the present invention further provides a server, where the server includes:
one or more processors;
a storage means for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the rule file loading method as provided by any embodiment of the present invention.
In a fourth aspect, embodiments of the present invention further provide a computer readable storage medium having a computer program stored thereon, wherein the program when executed by a processor implements a rule file loading method as provided in any embodiment of the present invention.
According to the technical scheme, the rule engine is placed in a state of not being ready to acquire the update rule file, and the update rule file is stored in a preset folder in the system; the rule engine is convenient to load the rule file from the preset folder; constructing a session object corresponding to the updated rule file, and placing the rule engine in a ready state; the conversation object corresponds to the rule file one by one, so that the rule engine can load the updated rule file according to the conversation object, the updated rule file is loaded through the rule engine, the problems that a system is stopped to load the rule file when a new rule is added, the rule is modified and the rule is abandoned are solved, when the updated rule file is realized, the system is not required to be stopped and restarted, the updated rule file can be automatically loaded only by placing the updated rule file in a specified folder, the development efficiency of the system is improved, and the effect of user experience is improved.
Drawings
FIG. 1 is a flow chart of a rule file loading method according to a first embodiment of the present invention;
FIG. 2 is a flowchart of a rule file loading method according to a second embodiment of the present invention;
FIG. 3 is a flow chart of a rule file loading method in a third embodiment of the present invention;
FIG. 4 is a flowchart of a rule file loading method in a fourth embodiment of the present invention;
FIG. 5 is a block diagram of a rule file loading device in a fifth embodiment of the present invention;
fig. 6 is a schematic structural diagram of a server in a sixth embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Example 1
Fig. 1 is a flowchart of rule file loading provided in an embodiment of the present invention, where the embodiment is applicable to the case of rule file loading, and the method may be executed by a rule file loading device, and specifically includes the following steps:
s110, placing the rule engine in a state of not being ready, acquiring an update rule file, and storing the update rule file in a preset folder in the system.
It will be appreciated that the rules engine, developed by the inference engine, is a component embedded in the application, enabling the separation of business decisions from the application code and the writing of business decisions using predefined semantic modules. And receiving data input, interpreting the business rule, and making a business decision according to the business rule. In the demand, we can always calculate constraint, integrity, check, branch flow and the like into the business rule. The business rules discussed in the rules engine focus on the need to perform the corresponding operations when preset conditions are met. A complete business rule thus includes both conditional and trigger operations. And storing the business rules under a preset folder in the form of rule files. The engine is an important operation mechanism inside things, and the rule engine is mainly used for solving a series of problems of how to describe, execute, monitor and the like rules. The rule engine of java open source has: drools, easy Rules, mandarax, IBM ILOG. The most widely used and open source is Drools.
Generally, the rule files are stored in a self-built special folder under the resource (resources) catalog of the project, but when the rule files are required to be newly added, modified and abandoned, when the system is operated, the files in the self-built special folder under the resources catalog are packed into a whole, the rule files in the files cannot be changed, and the updated rule files cannot be added, so that the system operation is required to be stopped to modify the rule files in the self-built special folder under the resources catalog. And then restarting the system, reloading the rule file, and constructing the session object. In large projects, the method not only affects the user experience, but also brings a great deal of inconvenience to developers, and reduces the development efficiency.
The rule file is written through an external editor, and when the rule file is updated, the rule engine is firstly placed in a state of not being ready, and the acquired update file is stored under a preset folder in the system, so that the rule engine can load the rule file from the preset folder conveniently. Without stopping the system.
S120, constructing a session object corresponding to the updated rule file, and placing the rule engine in a ready state.
After the updating rule is stored in a preset folder, a session object (kiesessation) corresponding to the updating rule is constructed according to the updated rule file, and the rule file corresponds to the kiesessation one by one. kieSession is used to interact with the rules engine. The rule engine is enabled to load the rule file through kieSession.
Optionally, constructing a session object corresponding to the update rule file includes: according to the file name of the update rule file, registering the corresponding session object in a registration center, wherein the registration content comprises: the name and save location of the session object. When constructing the kiesessation, the kiesessation needs to be registered in a registration center, and the registration content comprises the name and the storage position of the kiesessation. When the rule engine loads the rule file, the corresponding kiesessation is found from the registry according to the name and the storage position of the kiesessation, and the rule file corresponding to the kiesessation is loaded according to the kiesessation.
Optionally, registering the corresponding session object in the registration center includes: determining the file name of the update rule file as a session object name, or determining the session object name according to a preset naming rule and the file name of the update rule file; a session object is registered based on the session object name. When the registry registers kiesessation, the name of kiesessation may be named the same as the rule file. When the rule engine loads the rule file, the rule file with the same name can be found according to the name of the kieSession to load. Alternatively, the name of kieSession is also different from the rule file. The kiesessation can be named according to a preset naming rule, then a corresponding relation between the kiesessation name and the rule file name is established, and the rule engine finds a rule file corresponding to the kiesessation according to the corresponding relation and loads the rule file. The connection between the kieSession and the rule file corresponding to the kieSession is established, so that the rule engine can quickly find the rule file corresponding to the kieSession according to the corresponding relation, and the loading efficiency is improved.
Optionally, constructing a session object corresponding to the update rule file, and further includes: and storing the session object into a preset memory space, wherein the size of the preset memory space is set according to the number of the rule files. The built kiesessions are all stored in the same preset memory space, when the system is developed and designed, the space required by the kiesessions corresponding to one rule file is estimated, and the space required by the kiesessions corresponding to all rule files is obtained according to the number of the rule files and the space required by one kiesessions. The size of the space is configured in the configuration file during system development and design, and the space is opened up in the memory space of the operating system according to the size of the space in the configuration file during the initialization of the rule engine so as to store kiesessation. With the increase of rule files, when the opened memory space is insufficient for storing the kiesessation, a new memory space can be opened again for storing the kiesessation, so that the kiesessation can be stored sufficiently.
Optionally, constructing a session object corresponding to the update rule file, and further includes: registering a session object in the registry is stopped when the rules engine is placed in a ready state. When the kieSession is constructed, the rule engine changes from the not-ready state to the ready state, and the registry stops registering the kieSession. The rule engine begins loading rule files according to kieSession. If the rule file is updated again, the state of the rule engine needs to be set to be in an unprepared state, so that kieSession corresponding to the updated rule file can be registered in the registry. The phenomenon that the updated rule file cannot be loaded because the rule engine starts to work and register the kieSession when the rule engine starts to load the rule file and the kieSession cannot interact with the rule engine at the moment is avoided.
S130, loading the updating rule file through the rule engine according to the session object.
After constructing the kiesessation corresponding to the updated rule file, interacting with the rule engine according to the kiesessation, and enabling the rule engine to load the corresponding rule file according to the kiesessation. Optionally, loading, by the rule engine, the update rule file according to the session object, including: determining a target session object according to the name and the storage position of the session object registered in the registration center; and loading the updating rule file through the rule engine according to the target session object. When the rule engine loads the corresponding rule file according to the kiesessation, the target kiesessation is found through the name and the storage position of the kiesessation registered in the registry. And the rule engine finds a corresponding updated rule file according to the name of the target kieSession or the corresponding relation with the updated rule file, and loads the found updated rule file. And accordingly, corresponding operation is performed according to the update rule file.
According to the technical scheme, the rule engine is placed in a state of not being ready to acquire the update rule file, and the update rule file is stored in a preset folder in the system; the rule engine is convenient to load the rule file from the preset folder; constructing a session object corresponding to the updated rule file, and placing the rule engine in a ready state; the conversation object corresponds to the rule file one by one, so that the rule engine can load the updated rule file according to the conversation object, the updated rule file is loaded through the rule engine, the problems that a system is stopped to load the rule file when a new rule is added, the rule is modified and the rule is abandoned are solved, when the updated rule file is realized, the system is not required to be stopped and restarted, the updated rule file can be automatically loaded only by placing the updated rule file in a specified folder, the development efficiency of the system is improved, and the effect of user experience is improved.
Example two
Fig. 2 is a flowchart of a rule file loading method according to a second embodiment of the present invention, where the rule file is updated based on the previous embodiment, and the rule file updating includes: adding a rule file; the construction of the session object corresponding to the updating rule file comprises the following steps: and determining whether a new rule file exists in the preset folder, if so, constructing a session object corresponding to the new rule file. When the new rule file is detected to exist under the preset folder, the corresponding session object is constructed, so that the efficiency of the system for increasing the new rule file can be enhanced. And when the new rule file is determined to exist, the corresponding session object is built again, so that the running efficiency of the system can be enhanced.
As shown in fig. 2, the method specifically comprises the following steps:
s210, placing the rule engine in a state of not being ready, acquiring an update rule file, and storing the update rule file in a preset folder in the system.
S220, determining whether a new rule file exists in the preset folder, if so, constructing a session object corresponding to the new rule file, and placing the rule engine in a ready state.
Detecting a preset folder, when detecting that a new rule file exists, constructing a kieSession corresponding to the new rule file, and resetting the rule engine to a ready state after construction is completed, namely loading the new rule file through the constructed kieSession.
Optionally, determining whether the new rule file exists under the preset folder includes: detecting the occupied space and/or the number of files of the preset folder; and when the occupied space or the number of files is increased, determining that the preset folder has a new rule file. And detecting whether the preset folder has the new rule files or not, and detecting the occupied space and/or the number of the files of the preset folder. When the occupied space of the preset folder is increased or the number of files in the preset folder is increased, the fact that the newly added rule file exists is determined, and the kieSession corresponding to the newly added rule file needs to be constructed is indicated, so that the efficiency of increasing the newly added rule file by the system is enhanced.
Optionally, detecting the occupied space and/or the number of files of the preset folder includes: determining detection time, wherein the detection time comprises detection interval time or preset detection time point; and detecting the occupied space and/or the number of files of the preset folder according to the detection time. For example, the detection interval time may be set by a heartbeat detection manner, and detection is performed at intervals. The detection time can also be customized, and the detection can be performed by setting a circulation time point, for example, 23:15:15, i.e. 15 minutes 15 seconds at 23 pm per day, the preset folder is detected. The user can set the settings as required.
S230, loading the update rule file through the rule engine according to the session object.
According to the technical scheme, the rule engine is placed in a state of not being ready to acquire the update rule file, and the update rule file is stored in a preset folder in the system; the rule engine is convenient to load the rule file from the preset folder; updating the rule file includes: adding a rule file; determining whether a new rule file exists in the preset folder, if so, constructing a session object corresponding to the new rule file, and placing the rule engine in a ready state; when the new rule file is detected to exist under the preset folder, the corresponding session object is constructed, so that the efficiency of the system for increasing the new rule file can be enhanced. And when the new rule file is determined to exist, the corresponding session object is built again, so that the running efficiency of the system can be enhanced. The conversation object corresponds to the rule file one by one, so that the rule engine can load the updated rule file according to the conversation object, the updated rule file is loaded through the rule engine, the problems that a system is stopped to load the rule file when a new rule is added, the rule is modified and the rule is abandoned are solved, when the updated rule file is realized, the system is not required to be stopped and restarted, the updated rule file can be automatically loaded only by placing the updated rule file in a specified folder, the development efficiency of the system is improved, and the effect of user experience is improved.
Example III
Fig. 3 is a flowchart of a rule file loading method according to a third embodiment of the present invention, where the rule file is further refined based on the previous embodiment, and optionally, updating the rule file includes: changing a rule file; the rule file is changed to the original rule file; the construction of the session object corresponding to the updating rule file comprises the following steps: constructing a corresponding modification session object according to the modification rule file; and replacing the session object corresponding to the original rule file with the modified session object. The system does not need to be stopped to modify the rule file to be changed, and the operation efficiency of the system is improved.
As shown in fig. 3, the method specifically comprises the following steps:
s310, placing the rule engine in a state of not being ready, acquiring an update rule file, and storing the update rule file in a preset folder in the system.
S320, constructing a corresponding modification session object according to the modification rule file; and replacing the session object corresponding to the original rule file with the modified session object, and placing the rule engine in a ready state.
Optionally, updating the rule file includes: changing a rule file; the rule file is changed to the original rule file; when the original rule file in the system needs to be modified, the original rule file is modified through an external editor, after modification is completed, the modified rule file is stored under a preset folder, and the kieSession corresponding to the modified rule file is constructed, so that the rule engine loads the modified rule file through the kieSession corresponding to the modified rule engine.
Optionally, constructing a corresponding modification session object according to the modification rule file includes: designating the change rule file as the same name as the original rule file; and constructing a modification session object corresponding to the modification rule file according to the file name of the modification rule file. When the change rule file is stored under the preset folder, the change rule file needs to be named as the same name as the original changed rule file. When the kiesessation corresponding to the changed rule file is constructed, the kiesessation corresponding to the original changed rule file can be covered, and when the rule engine is in a ready state, the loading rule file is the changed rule file.
S330, loading the update rule file through the rule engine according to the session object.
According to the technical scheme, the rule engine is placed in a state of not being ready to acquire the update rule file, and the update rule file is stored in a preset folder in the system; the rule engine is convenient to load the rule file from the preset folder; updating the rule file includes: changing a rule file; constructing a corresponding modification session object according to the modification rule file; replacing the session object corresponding to the original rule file with the modified session object, and placing the rule engine in a ready state; the system does not need to be stopped to modify the rule file to be changed, and the operation efficiency of the system is improved. The conversation object corresponds to the rule file one by one, so that the rule engine can load the updated rule file according to the conversation object, the updated rule file is loaded through the rule engine, the problems that a system is stopped to load the rule file when a new rule is added, the rule is modified and the rule is abandoned are solved, when the updated rule file is realized, the system is not required to be stopped and restarted, the updated rule file can be automatically loaded only by placing the updated rule file in a specified folder, the development efficiency of the system is improved, and the effect of user experience is improved.
Example IV
Fig. 4 is a flowchart of a rule file loading method according to a fourth embodiment of the present invention, where the rule file updating includes: discarding the rule file; the rule file loading method further comprises the following steps: deleting the abandoned rule file from the preset folder according to the name of the abandoned rule file; and deleting the session object corresponding to the abandoned rule file. The rule files needing to be abandoned are removed from the preset folder, the registration center also removes the corresponding session object, the memory space of the system is saved, and the rule files cannot be reloaded with the abandoned rule files.
As shown in fig. 4, the method specifically comprises the following steps:
s410, placing the rule engine in a state of not being ready, acquiring an update rule file, and storing the update rule file in a preset folder in the system.
S420, constructing a session object corresponding to the updated rule file, and placing the rule engine in a ready state.
S430, loading the update rule file through the rule engine according to the session object.
S440, deleting the abandoned rule file from the preset folder according to the name of the abandoned rule file; and deleting the session object corresponding to the abandoned rule file.
When some rule files are not needed any more, in order to save the memory space, the unnecessary rule files need to be discarded, at this time, when the rule engine is in an unprepared state, the unnecessary discarding rule files are deleted in a preset folder, and the session objects corresponding to the discarding rule files are deleted in the registry. If only the kiesessation corresponding to the abandoned rule file is deleted, when the rule engine starts to load the rule file, the corresponding kiesessation is automatically created according to the rule file under the preset folder, and the rule engine loads the abandoned rule file, so that when the kiesessation corresponding to the abandoned rule file is deleted, the abandoned rule file in the preset folder is also required to be deleted.
According to the technical scheme, the rule engine is placed in a state of not being ready to acquire the update rule file, and the update rule file is stored in a preset folder in the system; the rule engine is convenient to load the rule file from the preset folder; constructing a session object corresponding to the updated rule file, and placing the rule engine in a ready state; the conversation object corresponds to the rule file one by one, so that the rule engine can load the updated rule file according to the conversation object, load the updated rule file through the rule engine, and delete the abandoned rule file from the preset folder according to the name of the abandoned rule file; and deleting the session object corresponding to the abandoned rule file. The rule files needing to be abandoned are removed from the preset folder, the registration center also removes the corresponding session object, the memory space of the system is saved, and the rule files cannot be reloaded with the abandoned rule files. The method solves the problems that the rule file can be loaded only by stopping the system when the rule file is newly added, the rule is modified and the rule is abandoned, and the rule file can be automatically loaded only by placing the updated rule file in a specified folder without stopping and restarting the system when the rule file is updated, so that the system development efficiency is improved and the user experience effect is improved.
Example five
Fig. 5 is a structural diagram of a rule file loading device according to a fifth embodiment of the present invention, where the rule file loading device includes: an update rule file acquisition module 310, a session object construction module 320, and an update rule file loading module 330.
The update rule file obtaining module 310 is configured to place the rule engine in a state of not being ready, obtain an update rule file, and store the update rule file under a preset folder in the system; a session object construction module 320, configured to construct a session object corresponding to the updated rule file, and place the rule engine in a ready state; and the update rule file loading module 330 is configured to load the update rule file through the rule engine according to the session object.
In the technical solution of the foregoing embodiment, the session object construction module 320 includes:
a session object registration unit, configured to register a corresponding session object in a registration center according to a file name of the update rule file, where the registration content includes: the name and save location of the session object.
In the technical solution of the above embodiment, the session object registration unit includes:
a session object name determining subunit, configured to determine a file name of the update rule file as a session object name, or determine the session object name according to a preset naming rule and the file name of the update rule file;
and the session object registration subunit is used for registering the session object based on the session object name.
In the technical solution of the foregoing embodiment, the session object construction module 320 further includes:
and the session object storage unit is used for storing the session object into a preset memory space, and the size of the preset memory space is set according to the number of the rule files.
In the technical solution of the foregoing embodiment, the session object construction module 320 further includes:
a session object stopping registration unit for stopping registration of the session object in the registration center when the rule engine is placed in a ready state.
Optionally, updating the rule file includes: adding a rule file;
in the technical solution of the foregoing embodiment, the session object construction module 320 includes:
and the new rule file determining subunit is used for determining whether a new rule file exists under the preset folder, and if so, constructing a session object corresponding to the new rule file.
In the technical solution of the above embodiment, the new rule file determining subunit includes:
a preset folder detection subunit, configured to detect an occupied space and/or the number of files of the preset folder;
and the rule file determining subunit is used for determining that the preset folder has a new rule file when the occupied space or the number of files is increased.
In the technical solution of the foregoing embodiment, a preset folder detection subunit includes:
a detection time determining subunit, configured to determine a detection time, where the detection time includes a detection interval time or a preset detection time point;
and the folder detection subunit is used for detecting the occupied space and/or the number of files of the preset folder according to the detection time.
Optionally, updating the rule file includes: changing a rule file; the rule file is changed to the original rule file;
in the technical solution of the foregoing embodiment, the session object construction module 320 includes:
a session object construction unit, configured to construct a corresponding modification session object according to the modification rule file;
and the session object replacing unit is used for replacing the session object corresponding to the original rule file with the modified session object.
In the technical solution of the above embodiment, the session object construction unit includes:
a rule file change naming subunit, configured to name the rule file change as the same name as the original rule file;
and the modification session object construction subunit is used for constructing a modification session object corresponding to the modification rule file according to the file name of the modification rule file.
Optionally, updating the rule file includes: discarding the rule file;
in the technical solution of the foregoing embodiment, the rule file loading device further includes:
the rule file deleting module is used for deleting the abandoned rule file from the preset folder according to the name of the abandoned rule file;
and the session object deleting module is used for deleting the session object corresponding to the abandoned rule file.
In the technical solution of the foregoing embodiment, the update rule file loading module 330 includes:
a target session object determining unit, configured to determine a target session object according to a name and a save location of a session object registered in the registration center;
and the updating rule file loading unit is used for loading the updating rule file through the rule engine according to the target session object.
The rule file loading device provided by the embodiment of the invention can execute the rule file loading method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example six
Fig. 6 is a schematic structural diagram of a server according to a fourth embodiment of the present invention, as shown in fig. 6, the server includes a processor 410, a memory 420, an input device 430 and an output device 440; the number of processors 410 in the server may be one or more, one processor 410 being taken as an example in fig. 6; the processor 410, memory 420, input device 430, and output device 440 in the server may be connected by a bus or other means, for example in fig. 6.
The memory 420 is used as a computer readable storage medium for storing software programs, computer executable programs, and modules, such as program instructions/modules corresponding to the rule file loading method in the embodiment of the present invention (for example, the update rule file obtaining module 310, the session object constructing module 320, and the update rule file loading module 330 in the rule file loading device). The processor 410 executes various functional applications of the server and data processing by running software programs, instructions and modules stored in the memory 420, i.e., implements the rule file loading method described above.
Memory 420 may include primarily a program storage area and a data storage area, wherein the program storage area may store an operating system, at least one application program required for functionality; the storage data area may store data created according to the use of the terminal, etc. In addition, memory 420 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some examples, memory 420 may further include memory remotely located with respect to processor 410, which may be connected to a server via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 430 may be used to receive input numeric or character information and to generate key signal inputs related to user settings and function control of the server. The output 440 may include a display device such as a display screen.
Example seven
A seventh embodiment of the present invention also provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are for performing a rule file loading method, the method comprising:
placing a rule engine in a state of not being ready, acquiring an update rule file, and storing the update rule file under a preset folder in a system;
constructing a session object corresponding to the updated rule file, and placing the rule engine in a ready state;
and loading the updating rule file through the rule engine according to the session object.
Of course, the storage medium containing the computer executable instructions provided in the embodiments of the present invention is not limited to the method operations described above, and may also perform the related operations in the rule file loading method provided in any embodiment of the present invention.
From the above description of embodiments, it will be clear to a person skilled in the art that the present invention may be implemented by means of software and necessary general purpose hardware, but of course also by means of hardware, although in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, etc., and include several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments of the present invention.
It should be noted that, in the embodiment of the rule file loading device, each unit and module included are only divided according to the functional logic, but not limited to the above division, so long as the corresponding functions can be implemented; in addition, the specific names of the functional units are also only for distinguishing from each other, and are not used to limit the protection scope of the present invention.
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (4)

1. A rule file loading method, comprising:
placing a rule engine in a state of not being ready, acquiring an update rule file, and storing the update rule file under a preset folder in a system;
constructing a session object corresponding to the updated rule file, and placing the rule engine in a ready state;
loading the update rule file through the rule engine according to the session object;
the construction of the session object corresponding to the updating rule file comprises the following steps:
according to the file name of the update rule file, registering the corresponding session object in a registration center, wherein the registration content comprises: the name and the storage location of the session object;
the registering of the corresponding session object in the registry includes:
determining the file name of the update rule file as the session object name, or,
determining the name of the session object according to a preset naming rule and the file name of the updating rule file;
registering a session object based on the session object name;
the construction of the session object corresponding to the update rule file further comprises:
storing the session object into a preset memory space, wherein the size of the preset memory space is set according to the number of rule files;
the construction of the session object corresponding to the update rule file further comprises:
stopping registering a session object in the registry when a rules engine is placed in a ready state;
the update rule file includes: adding a rule file;
the construction of the session object corresponding to the updating rule file comprises the following steps:
determining whether a new rule file exists under the preset folder, if so, constructing a session object corresponding to the new rule file;
the determining whether the new rule file exists under the preset folder comprises the following steps:
detecting the occupied space and/or the number of files of the preset folder;
when the occupied space or the number of files is increased, determining that the preset folder has a new rule file;
the detecting the occupied space and/or the number of files of the preset folder comprises the following steps:
determining detection time, wherein the detection time comprises detection interval time or preset detection time point;
detecting the occupied space and/or the number of files of the preset folder according to the detection time;
the update rule file includes: changing a rule file; the rule file is changed to the original rule file;
the construction of the session object corresponding to the updating rule file comprises the following steps:
constructing a corresponding modification session object according to the modification rule file;
replacing the session object corresponding to the original rule file with the modified session object;
the constructing a corresponding modification session object according to the modification rule file includes:
designating the change rule file as the same name as the original rule file;
constructing a modification session object corresponding to a modification rule file according to the file name of the modification rule file;
the update rule file includes: discarding the rule file; the method further comprises the steps of:
deleting the abandoned rule file from the preset folder according to the name of the abandoned rule file;
deleting the session object corresponding to the abandoned rule file;
the loading the update rule file by the rule engine according to the session object comprises:
determining a target session object according to the name and the storage position of the session object registered in the registration center;
and loading the updating rule file through the rule engine according to the target session object.
2. A rule file loading apparatus, comprising:
the updating rule file acquisition module is used for placing the rule engine in a state of not being ready to acquire an updating rule file and storing the updating rule file in a preset folder in the system;
a session object construction module, configured to construct a session object corresponding to the updated rule file, and place a rule engine in a ready state;
the updating rule file loading module is used for loading the updating rule file through the rule engine according to the session object;
the session object construction module includes:
a session object registration unit, configured to register a corresponding session object in a registration center according to a file name of the update rule file, where the registration content includes: the name and the storage location of the session object;
the session object registration unit includes:
a session object name determining subunit, configured to determine a file name of the update rule file as a session object name, or determine the session object name according to a preset naming rule and the file name of the update rule file;
a session object registration subunit configured to register a session object based on the session object name;
the session object construction module further includes:
a session object storage unit, configured to store the session object in a preset memory space, where the size of the preset memory space is set according to the number of rule files;
the session object construction module further includes:
a session object stopping registration unit for stopping registration of a session object in the registry when the rule engine is placed in a ready state;
the update rule file includes: adding a rule file;
the session object construction module includes:
a new rule file determining subunit, configured to determine whether a new rule file exists in the preset folder, if yes, construct a session object corresponding to the new rule file;
the newly added rule file determining subunit includes:
a preset folder detection subunit, configured to detect an occupied space and/or the number of files of the preset folder;
a rule file determining subunit, configured to determine that a new rule file is added in the preset folder when the occupied space or the number of files increases;
the preset folder detection subunit includes:
a detection time determining subunit, configured to determine a detection time, where the detection time includes a detection interval time or a preset detection time point;
the folder detection subunit is used for detecting the occupied space and/or the number of files of the preset folder according to the detection time;
the update rule file includes: changing a rule file; the rule file is changed to the original rule file;
the session object construction module includes:
a session object construction unit, configured to construct a corresponding modification session object according to the modification rule file;
a session object replacing unit, configured to replace a session object corresponding to the original rule file with the modified session object;
the session object construction unit includes:
a rule file change naming subunit, configured to name the rule file change as the same name as the original rule file;
a modification session object construction subunit, configured to construct a modification session object corresponding to the modification rule file according to the file name of the modification rule file;
the update rule file includes: discarding the rule file;
the apparatus further comprises:
the rule file deleting module is used for deleting the abandoned rule file from the preset folder according to the name of the abandoned rule file;
the session object deleting module is used for deleting the session object corresponding to the abandoned rule file;
the update rule file loading module comprises:
a target session object determining unit, configured to determine a target session object according to a name and a save location of a session object registered in the registration center;
and the updating rule file loading unit is used for loading the updating rule file through the rule engine according to the target session object.
3. A server, the server comprising:
one or more processors;
a storage means for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the rule file loading method of claim 1.
4. A computer readable storage medium having stored thereon a computer program, which when executed by a processor implements the rule file loading method according to claim 1.
CN202110349296.8A 2021-03-31 2021-03-31 Rule file loading method, device, server and medium Active CN112988277B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110349296.8A CN112988277B (en) 2021-03-31 2021-03-31 Rule file loading method, device, server and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110349296.8A CN112988277B (en) 2021-03-31 2021-03-31 Rule file loading method, device, server and medium

Publications (2)

Publication Number Publication Date
CN112988277A CN112988277A (en) 2021-06-18
CN112988277B true CN112988277B (en) 2023-06-30

Family

ID=76338696

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110349296.8A Active CN112988277B (en) 2021-03-31 2021-03-31 Rule file loading method, device, server and medium

Country Status (1)

Country Link
CN (1) CN112988277B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114025407A (en) * 2021-10-29 2022-02-08 深圳市康必达控制技术有限公司 Equipment communication method, device, computer equipment and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109783151A (en) * 2017-11-10 2019-05-21 北京京东尚科信息技术有限公司 The method and apparatus of rule change

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109783151A (en) * 2017-11-10 2019-05-21 北京京东尚科信息技术有限公司 The method and apparatus of rule change

Also Published As

Publication number Publication date
CN112988277A (en) 2021-06-18

Similar Documents

Publication Publication Date Title
CN110263275B (en) Method and device for accessing webpage, mobile terminal and storage medium
JP5678778B2 (en) Systems and migration methods
CN110750315B (en) Class loading method, device, equipment and storage medium in Android system
CN109462507B (en) Configuration updating method, device and system and electronic equipment
CN112068850A (en) Method and device for creating service product instance and electronic equipment
CN114281653B (en) Application program monitoring method and device and computing equipment
CN113268500A (en) Service processing method and device and electronic equipment
CN112988277B (en) Rule file loading method, device, server and medium
US11909640B2 (en) Creating endpoints
CN108829391B (en) Method and system for identifying control in Fragment
CN108334333B (en) Method and device for updating source code base
CN113608742A (en) Detection method, code packet processing method, operation control method and computing device
CN113157426A (en) Task scheduling method, system, equipment and storage medium
US20120222023A1 (en) Automatic runtime dependency lookup
CN109947488B (en) Object initialization method, device, equipment and storage medium of universal function module
WO2019091216A1 (en) Data management method and apparatus, computing device and storage medium
US10635483B2 (en) Automatic synopsis generation for command-line interfaces
CN114756362A (en) Resource quota management method and system, intelligent terminal and storage medium
CN111124386B (en) Animation event processing method, device, equipment and storage medium based on Unity
CN109150993B (en) Method for obtaining network request tangent plane, terminal device and storage medium
CN113360299A (en) Transaction processing method and related product
CN113535143A (en) Stack information processing method and device, electronic equipment and storage medium
JP6555908B2 (en) Information processing apparatus, control method therefor, and program
CN112988592B (en) Code detection method, device, equipment and storage medium
CN113656606B (en) Code query method, device and equipment of application program and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant