theLink 10.0
Loading...
Searching...
No Matches
MqFactoryC_jv.c File Reference

tag: nhi1-release-250425 More...

#include "jni_h/jvmqmsgque_MqFactoryC.h"
#include "LibMqMsgque_private_jv.h"
#include "jni_h/jvmkkernel_MkObjectC.h"
#include "jni_h/jvmqmsgque_MqContextC.h"
+ Include dependency graph for MqFactoryC_jv.c:

Go to the source code of this file.

Classes

struct  FactoryCallS
 

Macros

#define META_FILE_NAME   "MqFactoryC_jv.c"
 
#define ClassInit   \
 

Functions

jobject jvmqmsgque_MqFactoryC_ObjNew (MK_RT mkrt, JNIEnv *env, MQ_FCT hdl)
 
static MK_UNUSED jobject jvmqmsgque_MqFactoryC_ObjCreate (MK_RT mkrt, JNIEnv *env, MQ_FCT hdl)
 
static MK_PTR jvmqmsgque_MqFactoryC_selfCreate (MK_RT mkrt, MK_OBJ obj, MK_PTR envP)
 
static MK_PTR jvmqmsgque_sFactorySetup (MK_RT mkrt, JNIEnv *env, jclass class, jmethodID method)
 
static void jvmqmsgque_sFactoryDataCopy (MK_RT mkrt, MK_PTR *dataP)
 
static void jvmqmsgque_sFactoryDataFree (MK_RT mkrt, MK_PTR *dataP)
 
static void jvmqmsgque_sFactoryDTor (MK_RT mkrt, MQ_CTX context, bool dofactoryCleanup, MQ_FCT const fct)
 
static enum MkErrorE jvmqmsgque_sFactoryCTor (MQ_CALLBACK_FACTORY_CTOR_ARGS)
 
JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqFactoryC_HandleResolve (JNIEnv *env, jclass class, jint netHdl)
  Java: [static] MqFactoryC MqFactoryC.HandleResolve(int netHdl) C-API
Handle-Resolve-Slot - return a MqFactoryC from netHdl or null if invalid…
 
JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqFactoryC_Next (JNIEnv *env, jobject self)
  Java: MqFactoryC fct.Next() C-API
get next instance from linked-list of MqFactoryS type
 
JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqFactoryC_Prev (JNIEnv *env, jobject self)
  Java: MqFactoryC fct.Prev() C-API
get previous instance from linked-list of MqFactoryS type
 
JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqFactoryC_Instances (JNIEnv *env, jclass class)
  Java: [static] MqFactoryC MqFactoryC.Instances() C-API
get head-instance from linked-list of MqFactoryS type …
 
JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqFactoryC_GetNull (JNIEnv *env, jclass class)
  Java: [static] MqFactoryC MqFactoryC.GetNull() C-API
Null-Slot - return a MqFactoryC typed NULL instance …
 
JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqFactoryC_Get (JNIEnv *env, jclass class, jstring ident)
  Java: [static] MqFactoryC MqFactoryC.Get(?String ident = ""?) C-API
return the MqFactoryC
 
JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqFactoryC_GetCalled__Ljava_lang_String_2 (JNIEnv *env, jclass class, jstring ident)
  Java: [static] MqFactoryC MqFactoryC.GetCalled(?String ident = ""?) C-API
returns the MqFactoryC identified by ident
 
JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqFactoryC_GetCalled__Ljvmkkernel_MkBufferListC_2 (JNIEnv *env, jclass class, jobject largs)
  Java: [static] MqFactoryC MqFactoryC.GetCalled(MkBufferListC largs) C-API
returns the MqFactoryC identified as first argument in the largs MkBufferListC
 
JNIEXPORT jstring JNICALL Java_jvmqmsgque_MqFactoryC_GetOriginalIdent (JNIEnv *env, jobject self)
  Java: String fct.GetOriginalIdent() C-API
helper function to return MqFactoryS::originalIdent
 
JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqFactoryC_Default (JNIEnv *env, jobject self)
  Java: MqFactoryC fct.Default() C-API
set the default-attribute to the factory
 
JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqFactoryC_Initial (JNIEnv *env, jobject self)
  Java: MqFactoryC fct.Initial() C-API
set the initial-attribut to fct
 
JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqFactoryC_New (JNIEnv *env, jobject self)
  Java: MqContextC fct.New() C-API
create a new MqContextC from a MqFactoryC
 
JNIEXPORT jstring JNICALL Java_jvmqmsgque_MqFactoryC_DefaultIdent (JNIEnv *env, jclass class)
  Java: [static] String MqFactoryC.DefaultIdent() C-API
return the factory-identifier of the default MqFactoryC
 
JNIEXPORT jstring JNICALL Java_jvmqmsgque_MqFactoryC_InitialIdent (JNIEnv *env, jclass class)
  Java: [static] String MqFactoryC.InitialIdent() C-API
return the factory-identifier of the initial MqFactoryC
 
JNIEXPORT void JNICALL Java_jvmqmsgque_MqFactoryC_LogAll (JNIEnv *env, jclass class, jstring callfunc)
  Java: [static] MqFactoryC.LogAll(?String callfunc = null?) C-API
log all "factories" to stderr
 
JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqFactoryC_Dup2 (JNIEnv *env, jobject self, jstring ident)
  Java: [constructor] MqFactoryC fct.Dup2(String ident) C-API
create a duplicate of the singleton object MqFactoryC using a new factory-identifer
 
JNIEXPORT jobject JNICALL Java_jvmqmsgque_MqFactoryC_Add (JNIEnv *env, jclass class, jclass constructor, jstring ident)
  Java: [constructor,static] MqFactoryC MqFactoryC.Add(Class<?> constructor, ?String ident = null?) C-API
Add a new MqFactoryC identified by factory-identifier and defined by factory-constructor
 
JNIEXPORT jlong JNICALL Java_jvmqmsgque_MqFactoryC_CTOR (JNIEnv *env, jclass class, jclass constructor, jstring ident)
  Java: [constructor,static] MqFactoryC MqFactoryC.Add(Class<?> constructor, ?String ident = null?) C-API
Add a new MqFactoryC identified by factory-identifier and defined by factory-constructor
 
void jvmqmsgque_MqFactoryC_Init (MK_RT mkrt, MQ_RT mqrt)
 

Detailed Description

tag: nhi1-release-250425

Definition in file MqFactoryC_jv.c.

Macro Definition Documentation

◆ ClassInit

#define ClassInit   \

Definition at line 31 of file MqFactoryC_jv.c.

31#define ClassInit \
32

◆ META_FILE_NAME

#define META_FILE_NAME   "MqFactoryC_jv.c"

Definition at line 10 of file MqFactoryC_jv.c.

Function Documentation

◆ jvmqmsgque_MqFactoryC_Init()

void jvmqmsgque_MqFactoryC_Init ( MK_RT mkrt,
MQ_RT mqrt )

Definition at line 465 of file MqFactoryC_jv.c.

465 {
467
468 MqFactoryC_TT->selfCreate = NS(MqFactoryC_selfCreate);
469 MqFactoryC_TT->selfUnlink = MK(AtomSelfUnlink);
470}
#define ClassInit
#define MqFactoryC_TT
class as MkTypeS-class-type, useable in a class-macro as: class##_TT …

◆ jvmqmsgque_MqFactoryC_ObjCreate()

static MK_UNUSED jobject jvmqmsgque_MqFactoryC_ObjCreate ( MK_RT mkrt,
JNIEnv * env,
MQ_FCT hdl )
static

Definition at line 22 of file MqFactoryC_jv.c.

22 {
23 return MK(AtomObjCreate)(MK_RT_CALL env, MqFactoryC_X2obj(hdl));
24}
#define MK_RT_CALL
#define MqFactoryC_X2obj(x)

◆ jvmqmsgque_MqFactoryC_ObjNew()

jobject jvmqmsgque_MqFactoryC_ObjNew ( MK_RT mkrt,
JNIEnv * env,
MQ_FCT hdl )

Definition at line 16 of file MqFactoryC_jv.c.

16 {
17 static MkThreadLocal jobject NS_NULL = NULL;
18 return (hdl ? MK(AtomObjNew)(MK_RT_CALL env, MqFactoryC_X2obj(hdl)) : MK_GET__NS_NULL(MqFactoryC));
19}
#define MkThreadLocal

◆ jvmqmsgque_MqFactoryC_selfCreate()

static MK_PTR jvmqmsgque_MqFactoryC_selfCreate ( MK_RT mkrt,
MK_OBJ obj,
MK_PTR envP )
static

Definition at line 26 of file MqFactoryC_jv.c.

26 {
27 JNIEnv *env = (JNIEnv*) envP;
28 return (*env)->NewObject(env, NS(Class_MqFactoryC), NS(MID_MqFactoryC_INIT), (jlong) obj, JNI_TRUE);
29}

◆ jvmqmsgque_sFactoryCTor()

static enum MkErrorE jvmqmsgque_sFactoryCTor ( MQ_CALLBACK_FACTORY_CTOR_ARGS )
static

Definition at line 101 of file MqFactoryC_jv.c.

102{
103 MQ_CTX mqctx = NULL;
104 JNIEnv * env = NULL;
105 struct FactoryCallS const * const call = (struct FactoryCallS const * const) fct->fct_ctor.data;
106 jclass clazz = call->class;
107 jmethodID meth = call->method;
108
109 // get env
110 MkErrorCheck(MK(GetJniEnv)(MK_RT_CALL &env));
111
112 jobject tmplO = ( create == MQ_FACTORY_NEW_INIT || tmpl == NULL ? NULL : AtomObjNew_X(env,tmpl) );
113
114 // get "class" and "meth" from "parent"
115 if (create & (MQ_FACTORY_NEW_CHILD)) {
116 JavaErrorCheckNULL(clazz = (*env)->GetObjectClass (env, tmplO));
117 JavaErrorCheckNULL(meth = (*env)->GetMethodID(env,clazz,"<init>","(Ljvmqmsgque/MqContextC;)V"));
118 }
119
120 // create new object
121 {
122 jobject obj = (*env)->NewObject(env, clazz, meth, tmplO);
123 if (obj == NULL || MkErrorCheckE_0E()) {
124 // special: JAVA does NOT call the destructor of a "broken" instance, this create a "left-over"
125 // MkRuntimeS::cid (not bad but different from other languages)
126 // set at: MqContextInit->MQ_RT_REF.cid = context
127 MkRuntimeSetCID(NULL);
128 goto error;
129 }
130 mqctx = (MQ_CTX) pObj2Hdl(env,"MqContextC",obj);
131 }
132
133 // copy setup data and initialize "setup" data
134 if (create & (MQ_FACTORY_NEW_CHILD)) {
135 MqSetupDup(mqctx, tmpl);
136 }
137
138 *contextP = mqctx;
139 return MK_OK;
140
141error:
142 *contextP = NULL;
143
145 if((*env)->ExceptionCheck(env) == JNI_TRUE) {
146 OT_ERROR_LNG_2_META(NULL);
147 }
148 return MkErrorStack_0E();
149}
#define mqctx
#define MkErrorStack_0E()
MK_OK
void MkRuntimeSetCID(MK_OBJ const cid)
struct MqContextS * MQ_CTX
class-shortcut for struct MqContextS *, all shortcut using the XX_YYY syntax (only for public API) …
#define MqSetupDup(...)
#define MqContextDelete(x)
@ MQ_FACTORY_NEW_INIT
initial object, nothing else is known
@ MQ_FACTORY_NEW_CHILD
create object as a child of an other object
PUBLIC data structure for the jvmqmsgque-specific-data

◆ jvmqmsgque_sFactoryDataCopy()

static void jvmqmsgque_sFactoryDataCopy ( MK_RT mkrt,
MK_PTR * dataP )
static

Definition at line 65 of file MqFactoryC_jv.c.

69{
70 SETUP_env
71 struct FactoryCallS * call = (struct FactoryCallS *) *dataP;
72 *dataP = NS(sFactorySetup) (MK_RT_CALL env, call->class, call->method);
73error:
74 return;
75}
jmethodID method

◆ jvmqmsgque_sFactoryDataFree()

static void jvmqmsgque_sFactoryDataFree ( MK_RT mkrt,
MK_PTR * dataP )
static

Definition at line 77 of file MqFactoryC_jv.c.

81{
82 SETUP_env
83 struct FactoryCallS * call = (struct FactoryCallS *) *dataP;
84 // this function will be called on !exit! but "java" is already gone -> no java cleanup
85 // update windows require this code
86 (*env)->DeleteGlobalRef(env, call->class);
87error:
88 MkSysFree(*dataP);
89}
#define MkSysFree(pointer)

◆ jvmqmsgque_sFactoryDTor()

static void jvmqmsgque_sFactoryDTor ( MK_RT mkrt,
MQ_CTX context,
bool dofactoryCleanup,
MQ_FCT const fct )
static

Definition at line 91 of file MqFactoryC_jv.c.

97{
98 MqContextDelete(context);
99}

◆ jvmqmsgque_sFactorySetup()

static MK_PTR jvmqmsgque_sFactorySetup ( MK_RT mkrt,
JNIEnv * env,
jclass class,
jmethodID method )
static

Definition at line 49 of file MqFactoryC_jv.c.

55{
56 struct FactoryCallS *call = MkSysMalloc(MK_ERROR_PANIC, sizeof(*call));
57 JavaErrorCheckNULL (call->class = (*env)->NewGlobalRef(env, class));
58 call->method = method;
59 return call;
60error:
61 MkSysFree(call);
62 return NULL;
63}
#define MK_ERROR_PANIC
MK_PTR MkSysMalloc(MK_OBJN fmtobj, size_t const size)