Uploaded image for project: 'Rules Repository'
  1. Rules Repository
  2. RSPEC-2654

JEE applications should not use threads or synchronization

    XMLWordPrintable

    Details

    • Message:
      Remove this use of threads.
    • Default Severity:
      Critical
    • Impact:
      High
    • Likelihood:
      Low
    • Default Quality Profiles:
      Sonar way
    • Targeted languages:
      Java
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      45min
    • Implementation details:
    • CWE:
      CWE-383, CWE-574
    • PMD:
      DoNotUseThreads

      Description

      Proper synchronization and thread management can be tricky under the best of circumstances, but it's particularly difficult in JEE application, and is even forbidden under some circumstances by the JEE standard.

      This rule raises an issue for each Runnable, and use of the synchronized keyword.

      Noncompliant Code Example

      public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // ...
      
        Runnable r = new Runnable() {  // Noncompliant 
          public void run() {
            // ...
          }
        };
        new Thread(r).start();
      

      See

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            ann.campbell.2 Ann Campbell
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: