Subversion Repository Public Repository

litesoft

Diff Revisions 950 vs 953 for /trunk/Java/core/Server/src/org/litesoft/core/ServerContext.java

Diff revisions: vs.
  @@ -3,9 +3,7 @@
3 3
4 4 import org.litesoft.commonfoundation.base.*;
5 5
6 - import java.util.*;
7 -
8 - @SuppressWarnings({"UnusedDeclaration"})
6 + @SuppressWarnings({"UnusedDeclaration", "Convert2Diamond"})
9 7 public class ServerContext {
10 8 private static final ThreadLocal<ServerContext> DATA = new ThreadLocal<ServerContext>();
11 9
  @@ -14,7 +12,7 @@
14 12 *
15 13 * @return the current Server Context
16 14 *
17 - * @throws IllegalStateException if 'set' has not been called on this Thread.
15 + * @throws IllegalStateException if 'register' has not been called on this Thread.
18 16 */
19 17 public static ServerContext get() {
20 18 ServerContext zContext = DATA.get();
  @@ -54,50 +52,7 @@
54 52 return mServerSession;
55 53 }
56 54
57 - private static final ServerStore TEMPLATE_ServerStore = new ServerStore();
58 -
59 - public static ServerStore getTemplateServerStore() {
60 - return TEMPLATE_ServerStore;
61 - }
62 -
63 - private static final ServerStore MASTER_ServerStore = new ServerStore();
64 -
65 - public static ServerStore getMasterServerStore() {
66 - return MASTER_ServerStore;
67 - }
68 -
69 55 public ServerStore getServerStore() {
70 - synchronized ( SERVER_STORES ) {
71 - ServerStore zServerStore = SERVER_STORES.get( mContextID );
72 - if ( zServerStore == null ) {
73 - SERVER_STORES.put( mContextID, zServerStore = new ServerStore( TEMPLATE_ServerStore ) );
74 - }
75 - return zServerStore;
76 - }
77 - }
78 -
79 - public static void clearServerStore( ContextID pContextID ) {
80 - if ( pContextID != null ) {
81 - synchronized ( SERVER_STORES ) {
82 - LLremoveServerStore( pContextID );
83 - }
84 - }
85 - }
86 -
87 - private static final Map<ContextID, ServerStore> SERVER_STORES = new HashMap<ContextID, ServerStore>();
88 -
89 - public static void clearAllServerStores() {
90 - synchronized ( SERVER_STORES ) {
91 - for ( ContextID zContextID : SERVER_STORES.keySet() ) {
92 - LLremoveServerStore( zContextID );
93 - }
94 - }
95 - }
96 -
97 - private static void LLremoveServerStore( ContextID pContextID ) {
98 - ServerStore zServerStore = SERVER_STORES.remove( pContextID );
99 - if ( zServerStore != null ) {
100 - zServerStore.dispose();
101 - }
56 + return ServerStores.get( mContextID );
102 57 }
103 58 }