FACT++  1.0
JNIEXPORT jint JNICALL Java_dim_Client_infoService ( JNIEnv *  env,
jclass  This,
jstring  name,
jobject  theNativeDataDecoder,
jint  mode,
jint  timeout 
)

Definition at line 977 of file dim_jni.c.

References DBGx, dim_Dbg_INFO_SERVICE, dim_Native_F_STAMPED, dim_Native_F_WAIT, dim_Native_ONCE_ONLY, info_service_callback(), info_service_callback_with_cleanup(), Java_dim_DimTimer_start(), no_link, ReceiveSynchronizer, ReceiveSynchronizer_getCompletionCode, ReceiveSynchronizer_new, and request_service().

Referenced by server_exit_callback().

978 {
979  jint ret;
980  int no_link;
981  int stamped = 0;
982  int service_type = mode & 0x0FFF;
983  void (*callback_function)();
984  jobject callback_param;
985  jobject theReceiveSynchronizer;
986  const char* info = (*env)->GetStringUTFChars(env, name, 0);
987  extern unsigned request_service(char *, int, int , void *, int , void (*)(),
988  dim_long, void *, int, int);
989 
990 // DBGe(dim_Dbg_INFO_SERVICE); /* trap only, we report on exit */
991 
992  if(This){}
993  if(mode & dim_Native_F_STAMPED) stamped = 1;
994  if(mode & dim_Native_F_WAIT)
995  {
996  // Create a ReceiveSynchronizer object using the dataDecoder
997  theReceiveSynchronizer = (*env)->NewObject(env, ReceiveSynchronizer, ReceiveSynchronizer_new, theNativeDataDecoder);
998  callback_param = (*env)->NewGlobalRef(env, theReceiveSynchronizer);
999  }
1000  else
1001  {
1002  callback_param = (*env)->NewGlobalRef(env, theNativeDataDecoder);
1003  }
1004 
1005  if(service_type == dim_Native_ONCE_ONLY)
1006  callback_function = &info_service_callback_with_cleanup;
1007  else
1008  callback_function = &info_service_callback; //TODO who should do the cleanup?
1009 
1010 
1011  ret = (jint)request_service((char *)info, service_type, timeout, 0, 0, callback_function, (dim_long)callback_param, &no_link, 0, stamped);
1012  DBGx(dim_Dbg_INFO_SERVICE) printf("DimJNI: client infoService(%s, DataDecoder@0x%08lx, mode=%d, timeout=%d ) returns %d\n", info, (dim_long)theNativeDataDecoder, mode, timeout, ret);
1013  (*env)->ReleaseStringUTFChars(env, name, info);
1014 
1015  if(mode & dim_Native_F_WAIT)
1016  {
1017  /* we synchronize by calling the getCompletionCode method of the ReceiveSynchronizer */
1018  (*env)->CallIntMethod(env, theReceiveSynchronizer, ReceiveSynchronizer_getCompletionCode, 0);
1019  DBGx(dim_Dbg_INFO_SERVICE) printf("DimJNI: infoService(%s) completed with %08x\n",info, ret);
1020  }
1021 
1022  return ret;
1023 }
#define dim_Native_F_STAMPED
Definition: dim_jni.h:24
#define dim_Dbg_INFO_SERVICE
Definition: dim_jni.h:40
int mode
void info_service_callback_with_cleanup(jobject *_aDataDecoder, void *data, int *_size)
Definition: dim_jni.c:877
jclass ReceiveSynchronizer
Definition: dim_jni.c:100
jmethodID ReceiveSynchronizer_getCompletionCode
Definition: dim_jni.c:103
unsigned request_service(char *serv_name, int req_type, int req_timeout, void *serv_address, int serv_size, void(*usr_routine)(), dim_long tag, void *fill_addr, int fill_size, int stamped)
Definition: dic.c:625
long dim_long
Definition: dim_common.h:57
void info_service_callback(jobject *_aDataDecoder, void *data, int *_size)
Definition: dim_jni.c:868
#define DBGx(test)
Definition: dim_jni.c:66
static char no_link
Definition: did.c:909
jmethodID ReceiveSynchronizer_new
Definition: dim_jni.c:101
if(extraDns) new Dns
#define dim_Native_ONCE_ONLY
Definition: dim_jni.h:10
#define dim_Native_F_WAIT
Definition: dim_jni.h:26

+ Here is the call graph for this function:

+ Here is the caller graph for this function: