Ignore:
Timestamp:
Nov 17, 2014, 3:35:53 PM (6 years ago)
Author:
djay
Message:

Fix yaml service naming. Add javax javaxx optional sections in the main.cfg #105.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/service_internal_java.c

    r527 r539  
    5151      sprintf(classpath,"%s/%s/",ntmp,tmp->value);
    5252    }
    53     sprintf(oclasspath,"-Djava.class.path=%s",classpath);
    5453  }else{
    5554    if(cclasspath!=NULL){
     
    6766      sprintf(classpath,"%s/",ntmp);
    6867    }
    69     sprintf(oclasspath,"-Djava.class.path=%s",classpath);
    7068
    7169  }
     
    7775#endif
    7876
     77  int nb=1;
     78  int nbc0=0;
     79  maps* javaXXMap=getMaps(main_conf,"javaxx");
     80  if(javaXXMap!=NULL){
     81    nbc0+=count(javaXXMap->content);
     82  }
     83  int nbc1=0;
     84  maps* javaXMap=getMaps(main_conf,"javax");
     85  if(javaXMap!=NULL){
     86    nbc1+=count(javaXMap->content);
     87  }
    7988#ifdef WIN32
    80   JavaVMOption options[2];
    81 #else
    82   JavaVMOption options[1];
     89  nb=2+nbc0+nbc1;
     90  JavaVMOption options[nb];
     91#else
     92  JavaVMOption options[nb+nbc0+nbc1];
    8393#endif
    8494  JavaVMInitArgs vm_args;
     
    95105  jclass cls_gr;
    96106#endif
    97   int i;
    98 
     107  int i,start;
     108  map *cursorxx=NULL;
     109  if(javaXXMap!=NULL)
     110    cursorxx=javaXXMap->content;
     111  map *cursorx=NULL;
     112  if(javaXMap!=NULL)
     113    cursorx=javaXMap->content;
    99114  options[0].optionString = oclasspath;
    100115#ifdef WIN32
     116  start=2;
    101117  options[1].optionString = "-Xmx512m";
    102   /*options[2].optionString = "-Xms128m";
    103   options[3].optionString = "-XX:MaxPermSize=256m";
    104   options[4].optionString = "-XX:MaxHeapFreeRatio=70";*/
    105 #endif
     118#else
     119  start=1;
     120#endif
     121  for(i=0;i<nbc0;i++){
     122    char *tmp=parseJVMXXOption(cursorxx);
     123    options[start+i].optionString = tmp;
     124    free(tmp);
     125    cursorxx=cursorxx->next;
     126  }
     127  for(;i<nbc1+nbc0;i++){
     128    char *tmp=parseJVMXOption(cursorx);
     129    options[start+i].optionString = tmp;
     130    free(tmp);
     131    cursorx=cursorx->next;
     132  }
    106133
    107134  JNI_GetDefaultJavaVMInitArgs(&vm_args);
    108135  vm_args.version = JNI_VERSION_1_6;
    109136  vm_args.options = options;
    110 #ifdef WIN32
    111   vm_args.nOptions = 2;
    112 #else
    113   vm_args.nOptions = 1;
    114 #endif
     137  vm_args.nOptions = start+nbc0+nbc1;
    115138  vm_args.ignoreUnrecognized = JNI_TRUE;
    116139
     
    264287}
    265288
     289char *parseJVMXXOption(map* m){
     290  char *res=(char*)malloc((strlen(m->name)+strlen(m->value)+5)*sizeof(char));
     291  if(strncasecmp(m->value,"minus",5)==0)
     292    sprintf(res,"-XX:-%s",m->name);
     293  else if(strncasecmp(m->value,"plus",5)==0)
     294    sprintf(res,"-XX:+%s",m->name);
     295  else
     296    sprintf(res,"-XX:%s=%s",m->name,m->value);
     297  return res;
     298}
     299
     300char *parseJVMXOption(map* m){
     301  char *res=(char*)malloc((strlen(m->name)+strlen(m->value)+5)*sizeof(char));
     302  sprintf(res,"-X%s:%s",m->name,m->value);
     303  return res;
     304}
     305
    266306jobject HashMap_FromMaps(JNIEnv *env,maps* t,jclass scHashMapClass,jclass scHashMap_class,jmethodID scHashMap_constructor){
    267307  jobject scObject,scObject1;
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png