Audit - Rules - Performance

Description
This group contains audit rules that report coding practices that can sometimes cause performance problems. These rules will not find every source of performance problems, nor will everything found by these rules be the cause of a performance problem. The use of these rules is in no way a substitute for the use of a good performance profiling tool, but they can be used to promote programming practices that minimize performance problems.

Rules:

Details

Nested Synchronized Calls

Summary
Invoking one synchronized method of an object from another synchronized method of the same object affects the performance of an application.

Description
This audit rule looks for invocations of a synchronized method from another synchronized method in the same class.

Security Implications
Such calls both affect the performance of an application and indicate a poorly designed synchronization aspect of the code, which usually results in synchronization errors that could be exploited to create unexpected states of an application.

Example
The following code would be flagged as a violation because it invokes one synchronized method of an object from another synchronized method of the same object:

    public class SyncDataSource {
        public synchronized Object getData() {
            return internalGetData();
        }
        private synchronized Object internalGetData() {
            ...
        }
    }