hgomez      2004/03/16 01:03:13

  Modified:    jk/native2/common jk_shm.c
  Log:
  add the getAttribute feature to shm object

  

  Provider by Guenter/NormW
  
  Revision  Changes    Path
  1.44      +24 -1     jakarta-tomcat-connectors/jk/native2/common/jk_shm.c
  
  Index: jk_shm.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_shm.c,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- jk_shm.c  15 Mar 2004 20:09:30 -0000      1.43
  +++ jk_shm.c  16 Mar 2004 09:03:12 -0000      1.44
  @@ -352,6 +352,25 @@
   
   }
   
  +static char *jk2_shm_getAttributeInfo[] = {"file", "size", "slots", "useMemory", 
NULL};
  +
  +static void * JK_METHOD jk2_shm_getAttribute(jk_env_t *env, jk_bean_t *mbean, char 
*name )
  +{
  +    jk_shm_t *shm = (jk_shm_t *)mbean->object;
  +
  +    if( strcmp( name, "file" )==0 ) {
  +        return shm->fname;
  +    } else if( strcmp( name, "size" ) == 0 ) {
  +        return jk2_env_itoa( env, shm->size );
  +    } else if( strcmp( name, "slots" ) == 0 ) {
  +        return jk2_env_itoa( env, shm->slotMaxCount );
  +    } else if( strcmp( name, "useMemory" ) == 0 ) {
  +        return jk2_env_itoa( env, shm->inmem );
  +    }
  +    return NULL;
  +}
  +
  +
   /** Copy a chunk of data into a named slot
    */
   static int jk2_shm_writeSlot( jk_env_t *env, jk_shm_t *shm,
  @@ -444,7 +463,11 @@
       
       result->setAttribute = jk2_shm_setAttribute;
       result->setAttributeInfo = jk2_shm_setAttributeInfo;
  -    /* result->getAttribute=jk2_shm_getAttribute; */
  +    /* Add the following to this function - seems someone else */
  +    /* thought of it based on the 'comment' previously there */
  +    result->getAttributeInfo = jk2_shm_getAttributeInfo;
  +    result->getAttribute = jk2_shm_getAttribute;
  +    result->multiValueInfo = NULL;
       shm->mbean = result; 
       result->object = shm;
       result->invoke=jk2_shm_invoke;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to