tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "NormW" <no...@bocnet.com.au>
Subject PATCH jk_shm.c - Add getAttributes functionality.
Date Tue, 16 Mar 2004 00:40:57 GMT
Greetings All.
The following link provides a patch to add the getAttribute feature to the
shm object, as per a recent 'request'. It has been tested on a Windows
platform by using the qry= command of jkstatus and all values have been
correctly returned and displayed in the 'qry' listing. Unfortunately am
unable to test on a NetWare platform at this time. ;-(

http://www.gknw.com/norm/jk_shm.c.diff

Norm
--------------------------------------------------
--- jk_shm.c.orig Mon Mar 15 16:04:08 2004
+++ jk_shm.c Mon Mar 15 19:40:48 2004
@@ -346,6 +346,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,
@@ -438,7 +457,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;
@@ -451,4 +474,5 @@

     return JK_OK;
 }
+

--------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message