Summary of the invention
The embodiment of the invention provides a kind of method and apparatus of operating shared resource, and in order to solve needing the recording operation daily record for fear of the shared resource operating collision or increasing operator role of existing in the prior art, institute causes the problem of the burden increase of system.
The method of a kind of operating shared resource that the embodiment of the invention provides comprises:
After monitoring the operation of locked share resource state, user ID according to the user who carries out this operation is inquired about first corresponding relation of predefined locking information and user ID, if can determine the locking information of this user ID correspondence, then share resource state is locked, write down described locking information or write down described user ID;
After monitoring the operation of the share resource state that unlocks, user ID according to the user who carries out this operation is inquired about second corresponding relation of predefined release information and user ID, if can determine the release information of this user ID correspondence, then, determine the locking information of described release information correspondence according to the 3rd corresponding relation of predefined locking information and release information;
If write down described locking information, when the release information of determining is identical with the described locking information of record, described share resource state is carried out release; If write down described user ID, according to described first corresponding relation, determine the locking information of the described user ID correspondence of record, when the release information of determining is identical with this locking information of determining, described share resource state is carried out release.
The method of another operating shared resource that the embodiment of the invention provides comprises:
The release information or the record user identifications of record user identifications correspondence, after monitoring the operation of the described share resource state that unlocks, user ID according to the user who carries out this operation is inquired about second corresponding relation of predefined release information and user ID, if can determine the release information of this user ID correspondence, then, determine the locking information of described release information correspondence according to the 3rd corresponding relation of predefined locking information and release information;
If the release information of record user identifications correspondence when the release information of determining is identical with the described locking information of record, is carried out release to described share resource state; If record user identifications, first corresponding relation according to predefined locking information and user ID, determine the locking information of the described user ID correspondence of record, when the release information of determining is identical with this locking information of determining, described share resource state is carried out release.
The equipment of a kind of operating shared resource that the embodiment of the invention provides comprises:
Memory module is used to preserve second corresponding relation of first corresponding relation, release information and user ID of locking information and user ID and the 3rd corresponding relation of locking information and release information;
Locking module after being used to monitor the operation of locked share resource state, is inquired about described first corresponding relation according to the user's who carries out this operation user ID, if can determine the locking information of this user ID correspondence, then share resource state is locked;
Determination module, be used to monitor and unlock after the operation of share resource state, user ID according to the user who carries out this operation is inquired about described second corresponding relation, if can determine the release information of this user ID correspondence, then, determine the locking information of described release information correspondence according to described the 3rd corresponding relation;
First logging modle is used for writing down described locking information after described locking module locks share resource state;
Second logging modle is used for writing down described user ID after described locking module locks share resource state;
The locking information determination module if be used for according to described first corresponding relation, is determined the locking information of the described user ID correspondence of described second logging modle record;
Separate lock module,, when the described locking information that writes down in release information of determining and described logging modle is identical, described share resource state is carried out release if be used for writing down described locking information; If write down described user ID, when the definite locking information of release information of determining and described locking information determination module is identical, described share resource state is carried out release.
The equipment of another operating shared resource that the embodiment of the invention provides comprises:
Memory module is used to preserve second corresponding relation of release information and user ID and the 3rd corresponding relation of locking information and release information;
Determination module, be used to monitor and unlock after the operation of share resource state, user ID according to the user who carries out this operation is inquired about described second corresponding relation, if can determine the release information of this user ID correspondence, then, determine the locking information of described release information correspondence according to described the 3rd corresponding relation;
First logging modle is used for writing down described locking information after described locking module locks share resource state;
Second logging modle is used to preserve first corresponding relation of locking information and user ID, after described locking module locks share resource state, writes down described user ID;
The locking information determination module is used for according to described first corresponding relation, determines the locking information of the described user ID correspondence of described second logging modle record;
Separate lock module,, when the described locking information that writes down in release information of determining and described first logging modle is identical, described share resource state is carried out release if be used for record locking information; If record user identifications when the definite locking information of release information of determining and described locking information determination module is identical, is carried out release to described share resource state.
The embodiment of the invention is provided with second corresponding relation of first corresponding relation, release information and user ID of locking information and user ID and the 3rd corresponding relation of locking information and release information, after the operation that monitors locked share resource state, according to described first corresponding relation, determine the locking information of the user ID correspondence obtained, and described share resource state is locked; After the operation that monitors the described share resource state that unlocks,, determine the release information of the user ID correspondence obtained according to described second corresponding relation; If according to described the 3rd corresponding relation, determine that described release information is corresponding with described locking information, then according to the described release information of determining, described share resource state is carried out release, do not need the recording operation daily record like this or increase operator role, only a plurality of corresponding relations need be set and get final product, and the quantity of corresponding relation is less than Operation Log and the new quantity that increased of limiting operation person far away, thereby alleviated the burden of system.
Embodiment
In embodiments of the present invention: when the user with a certain user ID will lock the state transition path of certain shared resource, check whether this user ID has corresponding locking information, determine that whether the user has the authority of the locking carried out, if having, just locks described share resource state; When the user with a certain user ID wants the release share resource state, check whether this user ID has corresponding release information, determine whether the user has the authority of carrying out release, if have, whether the locking information of checking release information correspondence again is identical with the locking information of locked share resource state, determine whether this release information can be used to cancel this locking information, share resource state can be locked by a plurality of locking informations simultaneously, after having only these locking informations all to be unlocked, just can operate this share resource state, otherwise, just can not operate.
Below in conjunction with Figure of description the embodiment of the invention is described in further detail.
Shown in Figure 1A 1, comprise in first kind of equipment schematic diagram one of embodiment of the invention operating shared resource: memory module 10, locking module 11, determination module 12 are conciliate lock module 13.
Memory module 10 is connected with determination module 12 with locking module 11, is used to preserve second corresponding relation of first corresponding relation, release information and user ID of locking information and user ID and the 3rd corresponding relation of locking information and release information.
Wherein, comprise at least one locking information and at least one user ID in first corresponding relation; Comprise at least one release information and at least one user ID in second corresponding relation; Comprise at least one locking information and at least one release information in the 3rd corresponding relation.
Locking module 11, be connected with memory module 10, after being used to monitor the operation of locked share resource state, inquire about first corresponding relation that memory module 10 is preserved according to the user's who carries out this operation user ID, if can determine the locking information of this user ID correspondence, then share resource state be locked.
Wherein, if comprise at least one locking information in first corresponding relation, then the locking informations determined of locking module 11 are at random or according to the locking information of user's selection Information Selection.
Further, can set priority,, then not select at random, select according to user's selection information if promptly receive user's selection information; Otherwise select at random.
Determination module 12, conciliating lock module 13 with memory module 10 is connected, be used to monitor and unlock after the operation of share resource state, inquire about second corresponding relation that memory module 10 is preserved according to the user's who carries out this operation user ID, if can determine the release information of this user ID correspondence, then, determine the locking information of this release information correspondence according to the 3rd corresponding relation of memory module 10 preservations.
Wherein, if comprise at least one locking information in second corresponding relation, then the locking informations determined of determination module 12 are at random or according to the locking information of user's selection Information Selection.
Further, can set priority,, then not select at random, select according to user's selection information if promptly receive user's selection information; Otherwise select at random.
Separate lock module 13, be connected, be used for then this share resource state being carried out release if this locking information that determination module 12 is determined is identical with the locking information of this share resource state of locking with determination module 12.
Wherein, the equipment of operating shared resource can further include: first logging modle 14.
First logging modle 14 is conciliate lock module 13 with locking module 11 and is connected, and is used for after 11 pairs of share resource state of locking module lock record locking information.
Then separate locking information that release information that lock module 13 determines at determination module 12 and first logging modle 14 write down when identical, described share resource state is carried out release.Or
Wherein, the equipment of operating shared resource can further include: handover module 17.
Handover module 17 and is separated lock module 13 and is connected, and is used for separating after 13 pairs of share resource state of lock module carry out release share resource state being switched.
Share resource state is switched the state that exactly current state of shared resource is switched to user's needs, such as: the current state of shared resource is a lock-out state, and then the user can switch to released state with the current state of shared resource.
Further, if a plurality of locking information locks share resource state, then handover module 17 separate lock module with all locking information releases after, share resource state is switched.
Wherein, the equipment of operating shared resource can further include: refusal operational module 18.
Refusal operational module 18, be connected with locking information determination module 16 with memory module 10, be used for if the locking information that locking information determination module 16 is determined is inequality with the locking information of the described share resource state of locking the then refusal operation of share resource state that unlocks.
Wherein, the equipment of operating shared resource can also replace with second logging modle 15 and locking information determination module 16 with first logging modle 14, shown in Figure 1A 2, and in first kind of device structure schematic diagram two of embodiment of the invention operating shared resource,
Second logging modle 15 with locking module 11, separate lock module 13 and be connected with locking information determination module 16, is used to preserve first corresponding relation of locking information and user ID, after 11 pairs of share resource state of locking module lock, and record user identifications.
Locking information determination module 16 is connected with second logging modle 15 with locking module 11, is used for first corresponding relation according to 15 preservations of second logging modle, determines the locking information of the user ID correspondence of second logging modle, 15 records.
Then separate the definite locking information of release information that lock module 13 determines at determination module 12 and locking information determination module 16 when identical, share resource state is carried out release.
Shown in Figure 1B, the first method of embodiment of the invention operating shared resource comprises the following steps:
Second corresponding relation of step 100, first corresponding relation that preestablishes locking information and user ID, release information and user ID and the 3rd corresponding relation of locking information and release information.
As required can be respectively to first corresponding relation, second corresponding relation and the 3rd corresponding relation add, deletion and retouching operation.
Step 101, monitor the operation of locked share resource state after, inquire about predefined first corresponding relation according to the user's who carries out this operation user ID.
The method that user ID is obtained has a lot: such as obtain corresponding user ID according to the user name of user's input when the user logins, extract user ID or the like from the operation of the locking or the share resource state that unlocks.
Step 102, if can determine the locking information of this user ID correspondence, then share resource state is locked.
The mode of locking includes but not limited to a kind of in the following manner:
Share resource state is provided with password;
Concrete numerical value is set represents the lock-out state of share resource state, such as: 0 is non-locking, and 1 is locking.
Step 103, monitor the operation of the share resource state that unlocks after, inquire about predefined second corresponding relation according to the user's who carries out this operation user ID.
Step 104, if can determine the release information of this user ID correspondence, then according to predefined the 3rd corresponding relation, determine the locking information of release information correspondence,, then share resource state is carried out release if this locking information of determining is identical with the locking information of locked share resource state.
Wherein, can also comprise after the step 104: share resource state is switched.
Further, if a plurality of locking information locks share resource state, then, share resource state is switched after all locking information releases.
Because might same share resource state be locked by different user, because release information can only be opened the share resource state that the locking information corresponding with it locks, so want to change the share resource state that is locked by different user, just all locking informations must be opened, and last user who opens locking information just can change share resource state.
Wherein, in the step 104, if this locking information of determining is inequality with the locking information of locked share resource state, the operation of the share resource state of then refusing to unlock.
Wherein, comprise at least one locking information and at least one user ID in first corresponding relation, then the locking information of determining in the step 101 is at random or according to the locking information of user's selection Information Selection.
Can set priority, if promptly the user sends selection information, then the locking information of selecting according to the user locks;
If the user does not send selection information, then select a locking information to lock at random.
Wherein, comprise at least one release information and at least one user ID in second corresponding relation, then the information of determining in the step 103 of separating is at random or according to the release information of user's selection Information Selection.
Can set priority, if promptly the user sends selection information, then the release information of selecting according to the user is carried out release;
If the user does not send selection information, then select a release information to carry out release at random.
Because each release information can be opened the share resource state of corresponding with it any one locking information locking, so no matter be to select at random or the user specifies the locking information of selection, the locking information in can opening steps 101.
Wherein, can further include between step 102 and the step 103:
The locking information of record locking share resource state then in the step 104, when the locking information of the release information of determining and record is identical, carries out release to share resource state; Or
The user ID of the locking information correspondence of record locking share resource state then comprises between step 103 and the step 104:
According to predefined first corresponding relation, determine the locking information of the user ID correspondence of record;
Then in the step 104, when the release information of determining is identical with this locking information of determining, share resource state is carried out release.
Shown in Fig. 2 A1, comprise in second kind of device structure schematic diagram one of embodiment of the invention operating shared resource: memory module 20, determination module 21 are conciliate lock module 22.
Memory module 20 is connected with determination module 21, is used to preserve second corresponding relation of release information and user ID and the 3rd corresponding relation of locking information and release information.
Wherein, comprise at least one release information and at least one user ID in second corresponding relation, comprise at least one locking information and at least one release information in the 3rd corresponding relation.
Determination module 21, conciliating lock module 22 with memory module 20 is connected, be used to monitor and unlock after the operation of share resource state, inquire about second corresponding relation that memory module 20 is preserved according to the user's who carries out this operation user ID, if can determine the release information of this user ID correspondence, then, determine the locking information of release information correspondence according to the 3rd corresponding relation of memory module 20 preservations.
Wherein, if comprise at least one locking information in second corresponding relation, then the locking informations determined of determination module 21 are at random or according to the locking information of user's selection Information Selection.
Further, can set priority,, then not select at random, select according to user's selection information if promptly receive user's selection information; Otherwise select at random.
Separate lock module 22, be connected, be used for then described share resource state being carried out release if this locking information that determination module 21 is determined is identical with the locking information of locked share resource state with determination module 21.
Wherein, the equipment of operating shared resource can further include: first logging modle 23.
First logging modle 23 and is separated lock module 22 and is connected, and is used for the locking information of record locking share resource state.
Then separate locking information that release information that lock module 22 determines at determination module 21 and first logging modle 23 write down when identical, described share resource state is carried out release.Or
Wherein, the equipment of operating shared resource can further include: handover module 26.
Handover module 26 and is separated lock module 22 and is connected, and is used for separating after 22 pairs of share resource state of lock module carry out release share resource state being switched.
Further, if a plurality of locking information locks share resource state, then handover module separate lock module with all locking information releases after, share resource state is switched.
Wherein, the equipment of operating shared resource can further include: refusal operational module 27.
Refusal operational module 27 is connected with determination module 21, is used for if the locking information of locking information that determination module 21 is determined and locked share resource state is inequality, the operation of the share resource state of then refusing to unlock.
Wherein, the equipment of operating shared resource can also replace with second logging modle 24 and locking information determination module 25 with first logging modle 23, shown in Fig. 2 A2, and in second kind of device structure schematic diagram two of embodiment of the invention operating shared resource,
Second logging modle 24 and is separated lock module 22 and is connected with locking information determination module 25, is used to preserve first corresponding relation of locking information and user ID, the user ID of the locking information correspondence of record locking share resource state.
Locking information determination module 25 and is separated lock module 22 and is connected with second logging modle 24, is used for first corresponding relation preserved according to second logging modle 24, determines the locking information of the user ID correspondence of second logging modle, 24 records.
Then separate the definite locking information of release information that lock module 22 determines at determination module 21 and locking information determination module 25 when identical, share resource state is carried out release.
Shown in Fig. 2 B, the second method of embodiment of the invention operating shared resource comprises the following steps:
The 3rd corresponding relation of step 200, second corresponding relation that preestablishes release information and user ID and locking information and release information.
As required can be respectively to second corresponding relation and the 3rd corresponding relation add, deletion and retouching operation.
Step 201, monitor the operation of the share resource state that unlocks after, inquire about predefined second corresponding relation according to the user's who carries out this operation user ID.
Step 202, if can determine the release information of this user ID correspondence, then according to predefined the 3rd corresponding relation, determine the locking information of release information correspondence,, then share resource state is carried out release if this locking information of determining is identical with the locking information of locked share resource state.
Wherein, can also comprise after the step 202: share resource state is switched.
Further, if a plurality of locking information locks share resource state, then, share resource state is switched after all locking information releases.
Because might same share resource state be locked by different user, because release information can only be opened the share resource state that the locking information corresponding with it locks, so want to change the share resource state that is locked by different user, just all locking informations must be opened, and last user who opens locking information just can change share resource state.
Wherein, in the step 202 if this locking information of determining is inequality with the locking information of locked share resource state, the operation of the share resource state of then refusing to unlock.
Wherein, comprise at least one release information and at least one user ID in second corresponding relation, then the information of determining in the step 201 of separating is at random or according to the release information of user's selection Information Selection.
Can set priority, if promptly the user sends selection information, then the release information of selecting according to the user is carried out release;
If the user does not send selection information, then select a release information to carry out release at random.
Wherein, can further include before the step 200:
The locking information of record locking share resource state then in the step 202, when the locking information of the release information of determining and record is identical, carries out release to share resource state; Or
Preestablish the user ID of the locking information correspondence of first corresponding relation of locking information and user ID and record locking share resource state, then comprise between step 201 and the step 202:
According to this first corresponding relation, determine the locking information of the user ID correspondence of record, then in the step 202, when the release information of determining is identical with this locking information of determining, share resource state is carried out release.
As shown in Figure 3, the method flow schematic diagram of a plurality of locking information locked share resource state of the embodiment of the invention comprises the following steps:
Second corresponding relation of step 300, first corresponding relation that locking information and user ID are set, release information and user ID and the 3rd corresponding relation of locking information and release information.
Step 301, monitor the operation of locked share resource state after, obtain first user ID,, can determine the locking information of the first user ID correspondence obtained if according to first corresponding relation that is provided with, then, share resource state is locked according to the locking information of determining.
If according to first corresponding relation that is provided with, can not determine the locking information of the first user ID correspondence obtained, then refuse the operation of this locked share resource state.
Step 302, monitor the operation of locked share resource state after, obtain second user ID,, can determine the locking information of the second user ID correspondence obtained if according to first corresponding relation that is provided with, then, share resource state is locked according to the locking information of determining.
If according to first corresponding relation that is provided with, can not determine the locking information of the second user ID correspondence obtained, then refuse the operation of this locked share resource state.
Wherein, if first user ID is identical with the pairing locking information of second user ID, then the definite locking information of step 302 can replace the locking information of determining in the step 301; Perhaps share resource state is locked in the execution in step 302 not, the prompting user has had identical locking information that share resource state is locked.
Step 303, monitor the operation of the share resource state that unlocks after, obtain the 3rd user ID, if according to second corresponding relation that is provided with, can determine the release information of the 3rd user ID correspondence obtained, then, determine the locking information of this release information correspondence, check that this locking information is whether identical with the corresponding locking information of first user ID according to the 3rd corresponding relation that is provided with, if then execution in step 305; Otherwise, execution in step 304.
If according to second corresponding relation that is provided with, can not determine the locking information of the 3rd user ID correspondence obtained, then refuse the operation of this share resource state that unlocks.
Step 304, check that this locking information is whether identical with the corresponding locking information of second user ID, if then execution in step 308; Otherwise, execution in step 311.
The release information that step 305, basis are determined is carried out release to share resource state, the locking information in the opening steps 301.
Step 306, monitor the operation of the share resource state that unlocks after, obtain four-function family sign, if according to second corresponding relation that is provided with, can determine that the four-function family that obtains identifies corresponding release information, then, determine the locking information of this release information correspondence, check that this locking information is whether identical with the corresponding locking information of second user ID according to the 3rd corresponding relation that is provided with, if then execution in step 307; Otherwise, execution in step 311.
If according to second corresponding relation that is provided with, can not determine that the four-function family that obtains identifies corresponding locking information, then refuses the operation of this share resource state that unlocks.
Step 307, according to the release information of determining, share resource state is carried out release, the locking information in the opening steps 302, and share resource state switched process ends.
The release information that step 308, basis are determined is carried out release to share resource state, the locking information in the opening steps 302.
Step 309, monitor the operation of the share resource state that unlocks after, obtain four-function family sign, if according to second corresponding relation that is provided with, can determine that the four-function family that obtains identifies corresponding release information, then, determine the locking information of this release information correspondence, check that this locking information is whether identical with the corresponding locking information of first user ID according to the 3rd corresponding relation that is provided with, if then execution in step 310; Otherwise, execution in step 311.
If according to second corresponding relation that is provided with, can not determine that the four-function family that obtains identifies corresponding locking information, then refuses the operation of this share resource state that unlocks.
Step 310, according to the corresponding relation that is provided with, determine the corresponding release information of four-function family sign obtained, according to the release information of determining, share resource state is carried out release, locking information in the opening steps 301, and share resource state switched process ends.
The unlock operation of share resource state of step 311, refusal.
Wherein, present embodiment is that two locking informations lock share resource state, can have a plurality of locking informations that share resource state is locked as the case may be, and concrete steps and present embodiment are similar, repeat no more.
From the foregoing description as can be seen: the embodiment of the invention is after the operation that monitors locked share resource state, user ID according to the user who carries out this operation is inquired about first corresponding relation of predefined locking information and user ID, if can determine the locking information of this user ID correspondence, then share resource state be locked; After monitoring the operation of the share resource state that unlocks, user ID according to the user who carries out this operation is inquired about second corresponding relation of predefined release information and user ID, if can determine the release information of this user ID correspondence, then, determine the locking information of described release information correspondence according to the 3rd corresponding relation of predefined locking information and release information; If this locking information of determining is identical with the locking information of the described share resource state of locking, then described share resource state is carried out release, do not need the recording operation daily record or increase operator role, only a plurality of corresponding relations need be set gets final product, and the quantity of corresponding relation is less than the quantity that Operation Log and new limiting operation person are increased far away, thereby alleviated the burden of system, and do not need to rely on historical record, owing to can there be a plurality of locking informations that share resource state is locked, avoided the management conflict of shared resource, reduced complexity, improved the efficiency of management the shared resource management.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.