Changeset 771 for trunk/zoo-project/zoo-kernel
- Timestamp:
- Jun 10, 2016, 1:40:44 AM (9 years ago)
- Location:
- trunk/zoo-project/zoo-kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/main_conf_read.l
r676 r771 34 34 %} 35 35 36 attname [a-zA-Z0-9_\-: ]+36 attname [a-zA-Z0-9_\-:.]+ 37 37 38 38 attvalue1 [%\*,;@a-zA-Z0-9_\-.:" "\"\'/\\\(\)\+\x41-\xff?&=]+ -
trunk/zoo-project/zoo-kernel/service_internal_java.c
r767 r771 92 92 #endif 93 93 #ifndef WIN32 94 int nb=3+njdb; 95 #endif 94 int nb=2+njdb; 95 #endif 96 int nbs[3]={0,0,0}; 97 maps* javaMap=getMaps(*main_conf,"java"); 98 if(javaMap!=NULL){ 99 nbs[0]+=count(javaMap->content); 100 } 101 int nbc1=0; 102 maps* javaXMap=getMaps(*main_conf,"javax"); 103 if(javaXMap!=NULL){ 104 nbs[1]+=count(javaXMap->content); 105 } 96 106 int nbc0=0; 97 107 maps* javaXXMap=getMaps(*main_conf,"javaxx"); 98 108 if(javaXXMap!=NULL){ 99 nbc0+=count(javaXXMap->content); 100 } 101 int nbc1=0; 102 maps* javaXMap=getMaps(*main_conf,"javax"); 103 if(javaXMap!=NULL){ 104 nbc1+=count(javaXMap->content); 109 nbs[2]+=count(javaXXMap->content); 105 110 } 106 111 #ifdef WIN32 107 //#define nb (2+nbc0+nbc1) 108 const int nb=2+nbc0+nbc1; 112 const int nb=2+nbs[1]+nbs[2]+nbs[0]; 109 113 JavaVMOption *options=(JavaVMOption*)malloc(nb*sizeof(JavaVMOption)); 110 114 #else 111 JavaVMOption options[nb+nb c0+nbc1+1];115 JavaVMOption options[nb+nbs[1]+nbs[2]+nbs[0]+1]; 112 116 #endif 113 117 JavaVMInitArgs vm_args; … … 123 127 #endif 124 128 int i,start; 125 map *cursorxx=NULL;126 if(javaXXMap!=NULL)127 cursorxx=javaXXMap->content;128 map *cursorx=NULL;129 if(javaXMap!=NULL)130 cursorx=javaXMap->content;131 129 options[0].optionString = oclasspath; 132 130 options[0].extraInfo=NULL; 133 131 options[1].optionString = "-server"; 134 132 options[1].extraInfo=NULL; 135 char tmp1[100]; 136 sprintf(tmp1,"-Djava.library.path=%s",cwdMap->value); 137 fprintf(stderr,"%s\n",tmp1); 138 options[2].optionString = tmp1; 133 #ifdef USE_JDB 134 options[2].optionString = "-Xdebug"; 139 135 options[2].extraInfo=NULL; 140 #ifdef USE_JDB 141 options[3].optionString = "-Xdebug"; 136 options[3].optionString = "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7896"; 142 137 options[3].extraInfo=NULL; 143 options[4].optionString = "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7896";144 options[4].extraInfo=NULL;145 138 #endif 146 139 #ifdef WIN32 … … 148 141 options[1].optionString = "-Xmx512m"; 149 142 #else 150 start=3+njdb; 151 #endif 152 for(i=0;i<nbc0;i++){ 153 char *tmp=parseJVMXXOption(cursorxx); 143 start=2+njdb; 144 #endif 145 map *cursors[3]={NULL,NULL,NULL}; 146 if(javaMap!=NULL) 147 cursors[0]=javaMap->content; 148 if(javaXMap!=NULL) 149 cursors[1]=javaXMap->content; 150 if(javaXXMap!=NULL) 151 cursors[2]=javaXXMap->content; 152 for(i=0;i<nbs[0];i++){ 153 char *tmp=parseJVMOption(cursors[0]); 154 154 options[start+i].optionString = zStrdup(tmp); 155 155 options[start+i].extraInfo=NULL; 156 156 free(tmp); 157 cursor xx=cursorxx->next;158 } 159 for(;i<nb c1+nbc0;i++){160 char *tmp=parseJVMXOption(cursor x);157 cursors[0]=cursors[0]->next; 158 } 159 for(;i<nbs[0]+nbs[1];i++){ 160 char *tmp=parseJVMXOption(cursors[1]); 161 161 options[start+i].optionString = zStrdup(tmp); 162 162 options[start+i].extraInfo=NULL; 163 163 free(tmp); 164 cursorx=cursorx->next; 164 cursors[1]=cursors[1]->next; 165 } 166 for(;i<nbs[0]+nbs[2]+nbs[1];i++){ 167 char *tmp=parseJVMXXOption(cursors[2]); 168 options[start+i].optionString = zStrdup(tmp); 169 options[start+i].extraInfo=NULL; 170 free(tmp); 171 cursors[2]=cursors[2]->next; 165 172 } 166 173 … … 168 175 vm_args.version = JNI_VERSION_1_6; 169 176 vm_args.options = options; 170 vm_args.nOptions = start+nb c0+nbc1;177 vm_args.nOptions = start+nbs[0]+nbs[1]+nbs[2]; 171 178 vm_args.ignoreUnrecognized = JNI_TRUE; 172 179 … … 209 216 if (cls != NULL) { 210 217 #ifdef JAVA7 211 (*env).ExceptionClear();218 @ (*env).ExceptionClear(); 212 219 pmid=(*env).GetStaticMethodID(cls, s->name, "(Ljava/util/HashMap;Ljava/util/HashMap;Ljava/util/HashMap;)I"); 213 220 #else … … 281 288 (*jvm)->DestroyJavaVM(jvm); 282 289 #endif 283 for(i=0;i<nb c1+nbc0;i++){290 for(i=0;i<nbs[2]+nbs[1]+nbs[0];i++){ 284 291 free(options[start+i].optionString); 285 292 } … … 334 341 335 342 /** 343 * Create a string containing the JVM -D* options for a given map 344 * The result will be : -Dname=value 345 * 346 * @param m the map containing the option 347 * @return a char* containing the valide JVM option (-D*) 348 */ 349 char *parseJVMOption(map* m){ 350 char *res=(char*)malloc((strlen(m->name)+strlen(m->value)+4)*sizeof(char)); 351 sprintf(res,"-D%s=%s",m->name,m->value); 352 return res; 353 } 354 355 /** 336 356 * Create a string containing the JVM -XX:* option for a given map 337 357 * Depending on the map' name: … … 458 478 459 479 for(i=0;i<alen1;i++){ 460 map* vMap=getMapArray(tmp->content,"value",i); 480 map* vMap=getMapArray(tmp->content,"value",i); 461 481 map* sMap=getMapArray(tmp->content,"size",i); 462 482 map* mMap=getMapArray(tmp->content,tmap->value,i); -
trunk/zoo-project/zoo-kernel/service_internal_java.h
r580 r771 45 45 char *parseJVMXOption(map*); 46 46 47 char *parseJVMOption(map*); 48 47 49 int zoo_java_support(maps**,map*,service*,maps**,maps**); 48 50
Note: See TracChangeset
for help on using the changeset viewer.