3 Replies Latest reply on Mar 19, 2008 12:28 PM by mars1412

    Application scope and synchronisation

    mars1412 Apprentice

      in the DVD store example application, there is this application scoped component:



      @Name("processDefinitionSwitcher")
      @Scope(ScopeType.APPLICATION)
      public class ProcessDefinitionSwitcher
      ...
          private String currentProcessDefinition;
          
          public String getCurrentProcessDefinition()
          {
             return currentProcessDefinition;
          }
          
          public void setCurrentProcessDefinition(String def)
          {
             currentProcessDefinition = def;
          }
      ...



      since the currentProcessDefinition member is now in application scope and has getters and setters, why don't we need any synchronization for it?



      from the seam reference
      Since the session context is multithreaded, and often contains volatile state, session scope components are always
      protected by Seam from concurrent access. [...]. This is not the default behaviour for
      application scoped components
      ...