主权项 |
1. A method comprising:
allocating, by one or more computers, a plurality of first type data structures into a specified number of object groups; allocating, by the one or more computers, a plurality of second type data structures into the object groups; determining, by the one or more computers, an object pool containing a plurality of lock objects, each lock object being configured to allow no more than a designated number of instances of executing computer programs to access data structures in a corresponding object group; receiving, by the one or more computers, a first request from a first instance of an executing computer program to access a first type data structure and then a second request from a second instance of a same or different executing computer program to access a second type data structure; determining, by the one or more computers, whether to allow the second instance to access the second type data structure based at least in part on whether the first type data structure and the second type data structure belong to a same object group, wherein: the one or more computers prevent the second instance to access the second type data structure upon determining that:
the first type data structure and the second type data structure are in the same object group, which is locked by a lock object corresponding to that object group; andthe lock object corresponding to the object group indicates that, if the second instance is allowed to access the second type data structure, a number of instances of executing computer programs simultaneously accessing data structures in the locked object group exceeds the designated number. |