Skip to content

Commit 68dfcd4

Browse files
committed
pushing the getProviderStack debugging logs to the limit
1 parent b60e3a2 commit 68dfcd4

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/main/java/picoded/dstack/stack/ProviderConfig.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,21 @@ protected GenericConvertMap<String, Object> getStackConfig(String name) {
134134
* @return the stack provider if found
135135
*/
136136
public CoreStack getProviderStack(String name) {
137+
System.out.println("!! GET getProviderStack : "+name);
138+
137139
// Get and return from cache if found
138140
CoreStack cache = providerStackMap.get(name);
139141
if (cache != null) {
142+
System.out.println("!! CACHE HIT 1 getProviderStack : "+name);
140143
return cache;
141144
}
142145

143146
synchronized (this) {
147+
System.out.println("!! THREAD LOCK getProviderStack : "+name);
144148
// Check the cache again (avoid race condition)
145149
cache = providerStackMap.get(name);
146150
if (cache != null) {
151+
System.out.println("!! CACHE HIT 2 getProviderStack : "+name);
147152
return cache;
148153
}
149154

@@ -155,16 +160,20 @@ public CoreStack getProviderStack(String name) {
155160

156161
// Logging for debugging issue
157162
System.out.println("!! Initializing getProviderStack : "+name);
163+
System.out.println("!! providerStackMap ptr : "+providerStackMap);
158164

159165
// Initialization of stack and store into cache
160166
cache = initStack(providerConfig.getString("type"), providerConfig);
161167
providerStackMap.put(name, cache);
162168

163-
// Lets do a GET validation
169+
// Lets do a GET validation, I dunno why im doing this
164170
if( providerStackMap.get(name) != cache ) {
165171
throw new RuntimeException("providerStackMap : failed GET after PUT safety test");
166172
}
167173

174+
// Logically this should only happen ONCE !
175+
System.out.println("!! Returning Initialized getProviderStack : "+name);
176+
168177
// Return result
169178
return cache;
170179
}

0 commit comments

Comments
 (0)