void Function_clearFunctionCache(void) { Entry entry; HashMap oldMap = s_funcMap; Iterator itor = Iterator_create(oldMap); s_funcMap = HashMap_create(59, TopMemoryContext); while((entry = Iterator_next(itor)) != 0) { Function func = (Function)Entry_getValue(entry); if(func != 0) { if(Function_inUse(func)) { /* This is the replace_jar function or similar. Just * move it to the new map. */ HashMap_put(s_funcMap, Entry_getKey(entry), func); } else { Entry_setValue(entry, 0); PgObject_free((PgObject)func); } } } PgObject_free((PgObject)itor); PgObject_free((PgObject)oldMap); }
/* * Get the CLASSPATH. Result is always freshly palloc'd. */ static char* getClassPath(const char* prefix) { char* path; HashMap unique = HashMap_create(13, CurrentMemoryContext); StringInfoData buf; initStringInfo(&buf); appendPathParts(classpath, &buf, unique, prefix); appendPathParts(getenv("CLASSPATH"), &buf, unique, prefix); PgObject_free((PgObject)unique); path = buf.data; if(strlen(path) == 0) { pfree(path); path = 0; } return path; }
/* * Get the CLASSPATH. Result is always freshly palloc'd. */ static char* getClassPath(const char* prefix) { char* path; HashMap unique = HashMap_create(13, CurrentMemoryContext); StringInfoData buf; initStringInfo(&buf); /* Put the pljava installed in the $libdir first in the path */ appendPathParts("$libdir/java/pljava.jar", &buf, unique, prefix); #if 0 /* * Currently pljava.classpath is user setable, which makes this a * security problem. If CLASSPATH needs to be setable beyond simply * locating the pljava.jar file then this requires modification. * * The Greenplum version of pljava currently uses the classpath guc * differently anyhow due to differences in storing the jar files * in the filesystem rather than in the database. */ appendPathParts(pljava_classpath, &buf, unique, prefix); /* * For this to be useful it needs to be propagated from the * master to all the segments, otherwise it wouldn't be the * same everyplace and that would be a problem. * * Using a jvm_classpath GUC makes more architectural sense, * for it to be secure it would need to be super-user only, * possibly conf file only. */ appendPathParts(getenv("CLASSPATH"), &buf, unique, prefix); #endif PgObject_free((PgObject)unique); path = buf.data; if(strlen(path) == 0) { pfree(path); path = 0; } return path; }