Ignore:
Timestamp:
Oct 27, 2014, 4:46:05 PM (10 years ago)
Author:
djay
Message:

Use unique identifier as reference for asynchronous service execution.

Location:
trunk/zoo-project/zoo-kernel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/configure.ac

    r466 r514  
    446446        then
    447447                JAVA_LDFLAGS="-framework JavaVM"
    448                 JAVA_CPPFLAGS="-I/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/"
     448                JAVA_CPPFLAGS="-I/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/"
    449449        else
    450450                if test -d "$JDKHOME/jre/lib/i386";
  • trunk/zoo-project/zoo-kernel/service.h

    r508 r514  
    4141#define zWrite _write
    4242#define zSleep Sleep
     43#include <sys/timeb.h>
     44struct ztimeval {
     45  long tv_sec; /* seconds */
     46  long tv_usec; /* and microseconds */
     47};
     48void zGettimeofday(struct mstimeval* tp, void* tzp)
     49{
     50  struct _timeb theTime;
     51  _ftime(&theTime);
     52  tp->tv_sec = theTime.time;
     53  tp->tv_usec = theTime.millitm * 1000;
     54}
    4355#else
    4456#define zStrdup strdup
     
    4759#define zWrite write
    4860#define zSleep sleep
     61#define zGettimeofday gettimeofday
     62#define ztimeval timeval
    4963#endif
    5064
  • trunk/zoo-project/zoo-kernel/service_internal.c

    r510 r514  
    125125
    126126char* getKeyValue(maps* conf){
     127  if(conf==NULL)
     128     return "700666";
    127129  map *tmpMap=getMapFromMaps(conf,"lenv","lid");
    128130  if(tmpMap==NULL)
    129     tmpMap=getMapFromMaps(conf,"lenv","sid");
     131    tmpMap=getMapFromMaps(conf,"lenv","usid");
    130132  char* key="-1";
    131133  if(tmpMap!=NULL){
     
    202204  char *s=NULL;
    203205  map *tmpMap1;
    204   map *tmpMap=getMapFromMaps(conf,"lenv","sid");
     206  map *tmpMap=getMapFromMaps(conf,"lenv","usid");
    205207  semid lockid=getShmLockId(conf,1);
    206208  if(lockid==NULL){
     
    337339
    338340int getKeyValue(maps* conf){
     341  if(conf==NULL)
     342     return 700666;
    339343  map *tmpMap=getMapFromMaps(conf,"lenv","lid");
    340344  if(tmpMap==NULL)
    341     tmpMap=getMapFromMaps(conf,"lenv","sid");
     345    tmpMap=getMapFromMaps(conf,"lenv","usid");
    342346  int key=-1;
    343347  if(tmpMap!=NULL)
     
    449453  void *shm;
    450454  struct shmid_ds shmids;
    451   map *tmpMap=getMapFromMaps(conf,"lenv","sid");
     455  map *tmpMap=getMapFromMaps(conf,"lenv","usid");
    452456  if(tmpMap!=NULL){
    453457    key=atoi(tmpMap->value);
     
    531535#endif
    532536    }else{
    533       return (char*)shm;
     537      char *ret=strdup((char*)shm);
     538      shmdt((void *)shm);
     539      return ret;
    534540    }
    535541  }
     
    17181724      map* tmpm=getMap(tmp_maps->content,"rewriteUrl");
    17191725      map *tmp_lenv=NULL;
    1720       tmp_lenv=getMapFromMaps(m,"lenv","sid");
     1726      tmp_lenv=getMapFromMaps(m,"lenv","usid");
    17211727      if(tmp_lenv==NULL)
    17221728        sprintf(currentSid,"%i",pid);
     
    17351741      }
    17361742    }else{
    1737       map* tmpm2=getMap(tmp_maps->content,"tmpUrl");
     1743      int lpid;
     1744      map* tmpm2=getMapFromMaps(m,"lenv","usid");
     1745      lpid=atoi(tmpm2->value);
     1746      tmpm2=getMap(tmp_maps->content,"tmpUrl");
    17381747      if(tmpm1!=NULL && tmpm2!=NULL){
    17391748        if( strncasecmp( tmpm2->value, "http://", 7) == 0 ||
    17401749            strncasecmp( tmpm2->value, "https://", 8 ) == 0 ){
    1741           sprintf(url,"%s/%s_%i.xml",tmpm2->value,service,pid);
     1750          sprintf(url,"%s/%s_%i.xml",tmpm2->value,service,lpid);
    17421751        }else
    1743           sprintf(url,"%s/%s/%s_%i.xml",tmpm1->value,tmpm2->value,service,pid);
     1752          sprintf(url,"%s/%s/%s_%i.xml",tmpm1->value,tmpm2->value,service,lpid);
    17441753      }
    17451754    }
    17461755    if(tmpm1!=NULL)
    17471756      sprintf(tmp,"%s",tmpm1->value);
     1757    int lpid;
     1758    tmpm1=getMapFromMaps(m,"lenv","usid");
     1759    lpid=atoi(tmpm1->value);
    17481760    tmpm1=getMapFromMaps(m,"main","TmpPath");
    1749     sprintf(stored_path,"%s/%s_%i.xml",tmpm1->value,service,pid);
     1761    sprintf(stored_path,"%s/%s_%i.xml",tmpm1->value,service,lpid);
    17501762  }
    17511763
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r510 r514  
    25042504  _tmpMaps->name=zStrdup("lenv");
    25052505  char tmpBuff[100];
    2506   sprintf(tmpBuff,"%i",(cpid+(int)time(NULL)));
     2506  int lid=getShmLockId(NULL,1);
     2507  lockShm(lid);
     2508  struct ztimeval tp;
     2509  if(zGettimeofday(&tp,NULL)==0)
     2510    sprintf(tmpBuff,"%i",(cpid+((int)tp.tv_sec+(int)tp.tv_usec)));
     2511  else
     2512    sprintf(tmpBuff,"%i",(cpid+(int)time(NULL)));
     2513  unlockShm(lid);
     2514  removeShmLock(NULL,1);
    25072515  _tmpMaps->content=createMap("usid",tmpBuff);
    25082516  _tmpMaps->next=NULL;
     
    25752583  freeMaps(&_tmpMaps);
    25762584  free(_tmpMaps);
    2577  
     2585
    25782586#ifdef DEBUG
    25792587  dumpMap(request_inputs);
     
    26342642      zSleep(1);
    26352643#endif
     2644      r_inputs=getMapFromMaps(m,"lenv","usid");
     2645      int cpid=atoi(r_inputs->value);
    26362646      r_inputs=getMapFromMaps(m,"main","tmpPath");
    26372647      map* r_inputs1=getMap(s1->content,"ServiceProvider");
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