Patent ID: 8572584

Claim:
A method of converting a first program code in a multi-threaded program into a second program code which causes less lock contention, the method comprising the steps of: loading the first program code from a storage unit into a memory using a processing unit; determining, using the processing unit, whether the first program code includes either (i) a first class having a method call to a class that operates while taking synchronization by locking, or (ii) a second class inheriting a parent class that operates while taking synchronization by locking; in response to the determination that the first program code includes the first class, converting, using the processing unit, the first class having the method call to a third class that operates while taking synchronization by locking, into a class having a first method call to a concurrent operation executable fourth class that has a functionality equivalent to that of the third class, and having a shorter lock holding section than the third class; and in response to the determination that the first program code includes the second class, converting, using the processing unit, the second class having a method call to the parent class, into a class having a second method call to a concurrent operation executable class that has a functionality equivalent to that of the parent class, and having a shorter lock holding section than the second class, wherein: if code including the class having the first method call is enclosed in a first synchronized block code, then the step of converting into the class having the first method call further comprises changing the position of the first synchronized block code, and if the code enclosed in the first synchronized block code includes code including a first method call to retrieve a thread-shared value while locking and a path to be executed if a predetermined value is returned as a result of the first method call, then the step of changing the position of the first synchronized block code includes the steps of: deleting the first synchronized block code; enclosing the path in a new synchronized block code; and adding, to the code enclosed in the new synchronized block code, the code including the first method call to retrieve the thread-shared value while locking.