Project

General

Profile

7037.diff

Stanislav Lomany, 01/15/2023 03:15 PM

Download (2.41 KB)

View differences:

src/com/goldencode/p2j/persist/dirty/DirtyShareFactory.java 2023-01-15 20:11:23 +0000
2 2
** Module   : DirtyShareFactory.java
3 3
** Abstract : Factory for DirtyShareContext and DirtyShareManager instances
4 4
**
5
** Copyright (c) 2004-2020, Golden Code Development Corporation.
5
** Copyright (c) 2004-2023, Golden Code Development Corporation.
6 6
**
7 7
** -#- -I- --Date-- -JPRM- ------------------------------------Description------------------------------------
8 8
** 001 ECF 20080403 @38630 Created initial version. Factory for DirtyShareContext and 
......
11 11
** 003 CA  20140513        Added a weight for the context-local var, to ensure predetermined order during
12 12
**                         context reset.
13 13
** 004 OM  20200602        New ORM implementation.
14
** 005 SVL 20130116        Dirty sharing can be disabled in the directory.
14 15
*/
15 16

  
16 17
/*
......
73 74
import com.goldencode.p2j.persist.*;
74 75
import com.goldencode.p2j.persist.remote.*;
75 76
import com.goldencode.p2j.security.*;
77
import com.goldencode.p2j.util.*;
76 78

  
77 79
/**
78 80
 * Factory for {@link DirtyShareContext} and {@link DirtyShareManager} instances. The manager keeps a cache of
......
86 88
   
87 89
   /** Map of DirtyShareManager to Session instances. */
88 90
   private static final Map<DirtyShareManager, Session> sessions = new HashMap<>();
89
   
91

  
92
   /** {@code true} if dirty sharing is enabled. */
93
   private static final boolean enabled = Utils.getDirectoryNodeBoolean(null,
94
                                                                        "persistence/dirty_share",
95
                                                                        true,
96
                                                                        false);
97

  
90 98
   /** Context local map of Databases to DirtyShareContext instances */
91 99
   private static final ContextLocal<Map<Database, DirtyShareContext>> local =
92 100
      new ContextLocal<Map<Database, DirtyShareContext>>()
......
124 132
    */
125 133
   public static DirtyShareContext getContextInstance(Database database)
126 134
   {
127
      if (database.getType() == Database.Type.PRIMARY_NON_DIRTY ||
135
      if (!enabled ||
136
          database.getType() == Database.Type.PRIMARY_NON_DIRTY ||
128 137
          DatabaseManager.TEMP_TABLE_DB.equals(database))
129 138
      {
130 139
         return null;