|
dxFeed Graal Native SDK 3.16.0-rc1
|
Java helper types and functions that every other header uses: object handles, lists, strings, executors, time zones, time periods and formats, authorization tokens. More...
Data Structures | |
| struct | dxfg_java_object_handler |
| The handle of a Java object: the reference by which the C code refers to an object that lives in Java. More... | |
| struct | dxfg_java_object_t |
| A handle of a Java object with the same layout as dxfg_java_object_handler. More... | |
| struct | dxfg_list |
| The common layout of the lists of the SDK: the number of elements and the array of pointers to them. More... | |
| struct | dxfg_java_object_handler_list |
| A list of handles of Java objects. More... | |
| struct | dxfg_string_list |
| A list of strings. More... | |
| struct | dxfg_executor_t |
| A handle of a Java Executor object; release it with dxfg_JavaObjectHandler_release(). More... | |
| struct | dxfg_input_stream_t |
| A handle of a Java InputStream object; release it with dxfg_JavaObjectHandler_release(). More... | |
| struct | dxfg_time_period_t |
| A handle of a Java TimePeriod object; release it with dxfg_JavaObjectHandler_release(). More... | |
| struct | dxfg_time_format_t |
| A handle of a Java TimeFormat object; release it with dxfg_JavaObjectHandler_release(). More... | |
| struct | dxfg_time_zone_t |
| A handle of a Java TimeZone object; release it with dxfg_JavaObjectHandler_release(). More... | |
| struct | dxfg_auth_token_t |
| A handle of a Java AuthToken object; release it with dxfg_JavaObjectHandler_release(). More... | |
Typedefs | |
| typedef struct dxfg_java_object_handler | dxfg_java_object_handler |
| The handle of a Java object: the reference by which the C code refers to an object that lives in Java. | |
| typedef struct dxfg_java_object_t | dxfg_java_object_t |
| A handle of a Java object with the same layout as dxfg_java_object_handler. | |
| typedef struct dxfg_list | dxfg_list |
| The common layout of the lists of the SDK: the number of elements and the array of pointers to them. | |
| typedef struct dxfg_java_object_handler_list | dxfg_java_object_handler_list |
| A list of handles of Java objects. | |
| typedef struct dxfg_string_list | dxfg_string_list |
| A list of strings. | |
| typedef struct dxfg_executor_t | dxfg_executor_t |
| A handle of a Java Executor object; release it with dxfg_JavaObjectHandler_release(). | |
| typedef struct dxfg_input_stream_t | dxfg_input_stream_t |
| A handle of a Java InputStream object; release it with dxfg_JavaObjectHandler_release(). | |
| typedef struct dxfg_time_period_t | dxfg_time_period_t |
| A handle of a Java TimePeriod object; release it with dxfg_JavaObjectHandler_release(). | |
| typedef struct dxfg_time_format_t | dxfg_time_format_t |
| A handle of a Java TimeFormat object; release it with dxfg_JavaObjectHandler_release(). | |
| typedef struct dxfg_time_zone_t | dxfg_time_zone_t |
| A handle of a Java TimeZone object; release it with dxfg_JavaObjectHandler_release(). | |
| typedef struct dxfg_auth_token_t | dxfg_auth_token_t |
| A handle of a Java AuthToken object; release it with dxfg_JavaObjectHandler_release(). | |
| typedef enum dxfg_rounding_mode_t | dxfg_rounding_mode_t |
| The rounding behavior of numerical operations that can discard precision (java.math.RoundingMode), e.g. of dxfg_PriceIncrements_roundPrice3(). | |
| typedef void(*) | dxfg_finalize_function(graal_isolatethread_t *thread, void *user_data) |
| The function registered by dxfg_Object_finalize(): called after the Java object has been garbage collected. | |
Enumerations | |
| enum | dxfg_rounding_mode_t { DXFG_ROUNDING_MODE_UP = 0 , DXFG_ROUNDING_MODE_DOWN , DXFG_ROUNDING_MODE_CEILING , DXFG_ROUNDING_MODE_FLOOR , DXFG_ROUNDING_MODE_HALF_UP , DXFG_ROUNDING_MODE_HALF_DOWN , DXFG_ROUNDING_MODE_HALF_EVEN , DXFG_ROUNDING_MODE_UNNECESSARY } |
| The rounding behavior of numerical operations that can discard precision (java.math.RoundingMode), e.g. of dxfg_PriceIncrements_roundPrice3(). More... | |
Java helper types and functions that every other header uses: object handles, lists, strings, executors, time zones, time periods and formats, authorization tokens.
This group is the reference for the ownership rules of the C API:
| typedef struct dxfg_auth_token_t dxfg_auth_token_t |
A handle of a Java AuthToken object; release it with dxfg_JavaObjectHandler_release().
An authorization token: an authorization scheme (e.g. "Basic" or "Bearer") and its value. Create it with dxfg_AuthToken_valueOf() or one of the dxfg_AuthToken_create*() functions.
| typedef struct dxfg_executor_t dxfg_executor_t |
A handle of a Java Executor object; release it with dxfg_JavaObjectHandler_release().
An executor runs the tasks that the SDK gives it, e.g. the calls of the listeners of a subscription or a model. Create it with dxfg_Executors_newFixedThreadPool(), dxfg_Executors_newScheduledThreadPool() or dxfg_ExecutorBaseOnConcurrentLinkedQueue_new().
https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/concurrent/Executor.html
| typedef void(*) dxfg_finalize_function(graal_isolatethread_t *thread, void *user_data) |
The function registered by dxfg_Object_finalize(): called after the Java object has been garbage collected.
It is called by a daemon Java thread of the SDK, not by the thread that registered it. The calls are made one after another on that thread, so a function that blocks delays the other ones. A registration is called once. The SDK does not use the user data and does not free it.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | user_data | The pointer that was passed to dxfg_Object_finalize(). |
| typedef struct dxfg_input_stream_t dxfg_input_stream_t |
A handle of a Java InputStream object; release it with dxfg_JavaObjectHandler_release().
A stream of bytes that the SDK reads, e.g. the instrument profile readers. Create it with dxfg_ByteArrayInputStream_new().
https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/io/InputStream.html
| typedef struct dxfg_java_object_handler dxfg_java_object_handler |
The handle of a Java object: the reference by which the C code refers to an object that lives in Java.
The handle is allocated by the SDK and owned by the caller: release it with dxfg_JavaObjectHandler_release(), which frees the structure and drops the reference to the Java object. As long as any handle of an object exists, the object is not garbage collected. Use dxfg_JavaObjectHandler_clone() to get another handle of the same object.
The typed handle structures (e.g. dxfg_executor_t, dxfg_time_zone_t) consist of this structure only (the field handler), so a pointer to a typed handle is passed to the functions that take a dxfg_java_object_handler * as &typed->handler (or by a cast).
Use dxfg_Object_toString() to get the string representation of the object, dxfg_Object_equals() to compare objects and dxfg_Object_hashCode() to get the hash code.
| typedef struct dxfg_java_object_handler_list dxfg_java_object_handler_list |
A list of handles of Java objects.
A list that a function returns is allocated by the SDK: release it with dxfg_CList_JavaObjectHandler_release(), which releases every handle of the list, frees the array of the elements and the list itself. A list that is passed to a function is only read by the SDK: the caller keeps its ownership.
| typedef struct dxfg_java_object_t dxfg_java_object_t |
A handle of a Java object with the same layout as dxfg_java_object_handler.
No function of this API takes it: the functions use dxfg_java_object_handler.
| typedef struct dxfg_list dxfg_list |
The common layout of the lists of the SDK: the number of elements and the array of pointers to them.
The concrete list types (dxfg_string_list, dxfg_java_object_handler_list, ...) have their own element types and their own release functions; there is no function that frees a dxfg_list as such.
| typedef enum dxfg_rounding_mode_t dxfg_rounding_mode_t |
The rounding behavior of numerical operations that can discard precision (java.math.RoundingMode), e.g. of dxfg_PriceIncrements_roundPrice3().
Specifies a rounding behavior for numerical operations capable of discarding precision. Each rounding mode indicates how the least significant returned digit of a rounded result is to be calculated. If fewer digits are returned than the digits needed to represent the exact numerical result, the discarded digits will be referred to as the discarded fraction regardless the digits' contribution to the value of the number. In other words, considered as a numerical value, the discarded fraction could have an absolute value greater than one.
https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/math/RoundingMode.html
| typedef struct dxfg_string_list dxfg_string_list |
A list of strings.
A list that a function returns is allocated by the SDK: release it with dxfg_CList_String_release(), which frees every string, the array of the strings and the list itself. A list that is passed to a function is only read by the SDK: the caller keeps its ownership.
| typedef struct dxfg_time_format_t dxfg_time_format_t |
A handle of a Java TimeFormat object; release it with dxfg_JavaObjectHandler_release().
A parser and a formatter of dates and times in an ISO-compatible format for a time zone. Create it with dxfg_TimeFormat_DEFAULT(), dxfg_TimeFormat_GMT() or dxfg_TimeFormat_getInstance().
| typedef struct dxfg_time_period_t dxfg_time_period_t |
A handle of a Java TimePeriod object; release it with dxfg_JavaObjectHandler_release().
A period of time with a precision of milliseconds that is never negative. Create it with dxfg_TimePeriod_ZERO(), dxfg_TimePeriod_UNLIMITED() or dxfg_TimePeriod_valueOf().
| typedef struct dxfg_time_zone_t dxfg_time_zone_t |
A handle of a Java TimeZone object; release it with dxfg_JavaObjectHandler_release().
Create it with dxfg_TimeZone_getTimeZone(), dxfg_TimeZone_getDefault() or dxfg_TimeFormat_getTimeZone().
https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/TimeZone.html
| enum dxfg_rounding_mode_t |
The rounding behavior of numerical operations that can discard precision (java.math.RoundingMode), e.g. of dxfg_PriceIncrements_roundPrice3().
Specifies a rounding behavior for numerical operations capable of discarding precision. Each rounding mode indicates how the least significant returned digit of a rounded result is to be calculated. If fewer digits are returned than the digits needed to represent the exact numerical result, the discarded digits will be referred to as the discarded fraction regardless the digits' contribution to the value of the number. In other words, considered as a numerical value, the discarded fraction could have an absolute value greater than one.
https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/math/RoundingMode.html
| Enumerator | |||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| DXFG_ROUNDING_MODE_UP | Rounding mode to round away from zero. Always increments the digit prior to a non-zero discarded fraction. Note that this rounding mode never decreases the magnitude of the calculated value. Example:
| ||||||||||||||||||||||
| DXFG_ROUNDING_MODE_DOWN | Rounding mode to round towards zero. Never increments the digit prior to a discarded fraction (i.e., truncates). Note that this rounding mode never increases the magnitude of the calculated value. Example:
| ||||||||||||||||||||||
| DXFG_ROUNDING_MODE_CEILING | Rounding mode to round towards positive infinity. If the result is positive, behaves as for DXFG_ROUNDING_MODE_UP; if negative, behaves as for DXFG_ROUNDING_MODE_DOWN. Note that this rounding mode never decreases the calculated value. Example:
| ||||||||||||||||||||||
| DXFG_ROUNDING_MODE_FLOOR | Rounding mode to round towards negative infinity. If the result is positive, behave as for DXFG_ROUNDING_MODE_DOWN; if negative, behave as for DXFG_ROUNDING_MODE_UP. Note that this rounding mode never increases the calculated value. Example:
| ||||||||||||||||||||||
| DXFG_ROUNDING_MODE_HALF_UP | Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up. Behaves as for DXFG_ROUNDING_MODE_UP if the discarded fraction is <= 0.5; otherwise, behaves as for DXFG_ROUNDING_MODE_DOWN. Note that this is the rounding mode commonly taught at school. Example:
| ||||||||||||||||||||||
| DXFG_ROUNDING_MODE_HALF_DOWN | Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down. Behaves as for DXFG_ROUNDING_MODE_UP if the discarded fraction is > 0.5; otherwise, behaves as for DXFG_ROUNDING_MODE_DOWN. Example:
| ||||||||||||||||||||||
| DXFG_ROUNDING_MODE_HALF_EVEN | Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant, in which case, round towards the even neighbor. Behaves as for DXFG_ROUNDING_MODE_HALF_UP if the digit to the left of the discarded fraction is odd; behaves as for DXFG_ROUNDING_MODE_HALF_DOWN if it's even. Note that this is the rounding mode that statistically minimizes cumulative error when applied repeatedly over a sequence of calculations. It is sometimes known as "Banker's rounding" and is chiefly used in the USA. This rounding mode is analogous to the rounding policy used for float and double arithmetic in Java. Example:
| ||||||||||||||||||||||
| DXFG_ROUNDING_MODE_UNNECESSARY | Rounding mode to assert that the requested operation has an exact result, hence no rounding is necessary. If this rounding mode is specified on an operation that yields an inexact result, a Java ArithmeticException is thrown. Example:
| ||||||||||||||||||||||
| dxfg_auth_token_t * dxfg_AuthToken_createBasicToken | ( | graal_isolatethread_t * | thread, |
| const char * | userPassword ) |
Creates the "Basic" authorization token (RFC 2617) from the string user:password. The user name and the password can be empty.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | userPassword | The string user:password; a string without a colon or NULL is an error. |
Java: AuthToken.createBasicToken(String).
| dxfg_auth_token_t * dxfg_AuthToken_createBasicToken2 | ( | graal_isolatethread_t * | thread, |
| const char * | user, | ||
| const char * | password ) |
Creates the "Basic" authorization token (RFC 2617) from the user name and the password. They can be empty.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | user | The user name; NULL is an error. |
| [in] | password | The password; NULL is an error. |
Java: AuthToken.createBasicToken(String, String).
| dxfg_auth_token_t * dxfg_AuthToken_createBasicTokenOrNull | ( | graal_isolatethread_t * | thread, |
| const char * | user, | ||
| const char * | password ) |
Creates the "Basic" authorization token (RFC 2617) from the user name and the password, or returns NULL if both of them are NULL or empty (it is not an error). A NULL user name or password is taken as empty.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | user | The user name. |
| [in] | password | The password. |
Java: AuthToken.createBasicTokenOrNull(String, String).
| dxfg_auth_token_t * dxfg_AuthToken_createBearerToken | ( | graal_isolatethread_t * | thread, |
| const char * | token ) |
Creates the "Bearer" authorization token (RFC 6750) from the access token.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | token | The access token; NULL or an empty string is an error. |
Java: AuthToken.createBearerToken(String).
| dxfg_auth_token_t * dxfg_AuthToken_createBearerTokenOrNull | ( | graal_isolatethread_t * | thread, |
| const char * | token ) |
Creates the "Bearer" authorization token (RFC 6750) from the access token, or returns NULL if the access token is NULL or empty (it is not an error).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | token | The access token. |
Java: AuthToken.createBearerTokenOrNull(String).
| dxfg_auth_token_t * dxfg_AuthToken_createCustomToken | ( | graal_isolatethread_t * | thread, |
| const char * | scheme, | ||
| const char * | value ) |
Creates the authorization token with a custom scheme and value.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | scheme | The scheme; NULL or an empty string is an error. |
| [in] | value | The value; NULL or an empty string is an error. |
Java: AuthToken.createCustomToken(String, String).
| const char * dxfg_AuthToken_getHttpAuthorization | ( | graal_isolatethread_t * | thread, |
| dxfg_auth_token_t * | authToken ) |
Returns the value of the HTTP authorization header: the scheme and the value separated by a space.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | authToken | The token. |
Java: AuthToken.getHttpAuthorization().
| const char * dxfg_AuthToken_getPassword | ( | graal_isolatethread_t * | thread, |
| dxfg_auth_token_t * | authToken ) |
Returns the password of the token.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | authToken | The token. |
Java: AuthToken.getPassword().
| const char * dxfg_AuthToken_getScheme | ( | graal_isolatethread_t * | thread, |
| dxfg_auth_token_t * | authToken ) |
Returns the authorization scheme of the token, e.g. "Basic" or "Bearer".
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | authToken | The token. |
Java: AuthToken.getScheme().
| const char * dxfg_AuthToken_getUser | ( | graal_isolatethread_t * | thread, |
| dxfg_auth_token_t * | authToken ) |
Returns the user name of the token.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | authToken | The token. |
Java: AuthToken.getUser().
| const char * dxfg_AuthToken_getValue | ( | graal_isolatethread_t * | thread, |
| dxfg_auth_token_t * | authToken ) |
Returns the value of the token: the access token of the "Bearer" scheme (RFC 6750) or the Base64-encoded user:password of the "Basic" scheme (RFC 2617).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | authToken | The token. |
Java: AuthToken.getValue().
| dxfg_auth_token_t * dxfg_AuthToken_valueOf | ( | graal_isolatethread_t * | thread, |
| const char * | string ) |
Creates the authorization token from the string of the scheme and the value separated by a space, e.g. Bearer <token> or Basic <Base64 of user:password>. The value of the "Basic" scheme must be the Base64-encoded user:password.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | string | The string; NULL is an error. |
Java: AuthToken.valueOf(String).
| dxfg_input_stream_t * dxfg_ByteArrayInputStream_new | ( | graal_isolatethread_t * | thread, |
| const char * | bytes, | ||
| int32_t | size ) |
Creates an input stream that reads the bytes of the memory block. The bytes are copied: the caller keeps the memory block and may free it after the function returns.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | bytes | The bytes of the stream; must point to at least size bytes. |
| [in] | size | The number of bytes; must not be negative. |
Java: ByteArrayInputStream(byte[]).
| int32_t dxfg_CList_JavaObjectHandler_release | ( | graal_isolatethread_t * | thread, |
| dxfg_java_object_handler_list * | list ) |
Releases a list of handles that a function returned: releases every handle of the list, frees the array of the elements and the list itself.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | list | The list to release. If it is NULL, nothing is done. |
| int32_t dxfg_CList_String_release | ( | graal_isolatethread_t * | thread, |
| dxfg_string_list * | stringList ) |
Releases a list of strings that a function returned: frees every string of the list, the array of the strings and the list itself.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | stringList | The list to release. If it is NULL, nothing is done. |
| int32_t dxfg_Comparable_compareTo | ( | graal_isolatethread_t * | thread, |
| dxfg_java_object_handler * | object, | ||
| dxfg_java_object_handler * | other ) |
Compares the Java objects by their natural order. The objects must implement the Java Comparable interface and be comparable to each other, otherwise the function fails. The handles of the same object are equal; a NULL handle is less than a non-NULL handle.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | object | The handle of the first object. |
| [in] | other | The handle of the second object. |
Java: Comparable.compareTo(Object).
| dxfg_executor_t * dxfg_ExecutorBaseOnConcurrentLinkedQueue_new | ( | graal_isolatethread_t * | thread | ) |
Creates an executor that does not run the tasks by itself: a submitted task is added to a queue and runs when dxfg_ExecutorBaseOnConcurrentLinkedQueue_processAllPendingTasks() is called, on the thread that calls it. Use it to have the calls of the listeners made on a thread of your own.
| [in] | thread | The current GraalVM Isolate's thread. |
| int32_t dxfg_ExecutorBaseOnConcurrentLinkedQueue_processAllPendingTasks | ( | graal_isolatethread_t * | thread, |
| dxfg_executor_t * | executor ) |
Runs the tasks that are in the queue of the executor, on the calling thread, until the queue is empty (the tasks added by the running tasks are run as well). If a task throws an exception, the function fails and the rest of the tasks stay in the queue.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | executor | The executor created by dxfg_ExecutorBaseOnConcurrentLinkedQueue_new(); any other executor makes the function fail. |
| dxfg_executor_t * dxfg_Executors_newFixedThreadPool | ( | graal_isolatethread_t * | thread, |
| int | nThreads, | ||
| const char * | nameThreads ) |
Creates an executor with a fixed number of threads that runs the submitted tasks. The threads are daemon threads. The SDK has no function that shuts the executor down.
Read the "Threads and locks" section of https://docs.dxfeed.com/dxfeed/api/com/dxfeed/api/DXFeedSubscription.html for how the executor is used by the listeners.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | nThreads | The number of threads of the pool; must be positive. |
| [in] | nameThreads | The prefix of the names of the threads: they are named <nameThreads>-1, <nameThreads>-2, and so on. |
Java: Executors.newFixedThreadPool(int, ThreadFactory).
| dxfg_executor_t * dxfg_Executors_newScheduledThreadPool | ( | graal_isolatethread_t * | thread, |
| int | nThreads, | ||
| const char * | nameThreads ) |
Creates an executor that runs the submitted tasks, also with a delay or periodically. The threads are daemon threads. The SDK has no function that shuts the executor down.
See dxfg_Executors_newFixedThreadPool() for how the listeners use the executor.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | nThreads | The number of threads to keep in the pool, even if they are idle; must not be negative. |
| [in] | nameThreads | The prefix of the names of the threads: they are named <nameThreads>-1, <nameThreads>-2, and so on. |
Java: Executors.newScheduledThreadPool(int, ThreadFactory).
| int32_t dxfg_gc | ( | graal_isolatethread_t * | thread | ) |
Requests a garbage collection. It is only for testing, e.g. of the functions registered by dxfg_Object_finalize().
| [in] | thread | The current GraalVM Isolate's thread. |
Java: System.gc().
| int32_t dxfg_JavaObjectHandler_array_release | ( | graal_isolatethread_t * | thread, |
| const dxfg_java_object_handler ** | handlersArray, | ||
| int32_t | size ) |
Releases an array of handles (or simple structures containing only a handle) that a function returned as one block of consecutive structures: releases every handle of the array and frees the memory of the array.
Sample:
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | handlersArray | The array of handles. If it is NULL or size is 0, nothing is done. |
| [in] | size | The number of handles in the array. |
| int32_t dxfg_JavaObjectHandler_clone | ( | graal_isolatethread_t * | thread, |
| dxfg_java_object_handler * | javaObjectHandler, | ||
| dxfg_java_object_handler ** | javaObjectHandlerClone ) |
Creates another handle of the Java object: allocates the memory of the new handle structure. Both handles refer to the same object and are released independently: the object stays alive until all of its handles are released.
Sample:
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | javaObjectHandler | The handle to clone; it stays valid. |
| [out] | javaObjectHandlerClone | The pointer to which the pointer to the new handle is written; must not be NULL. |
| int32_t dxfg_JavaObjectHandler_release | ( | graal_isolatethread_t * | thread, |
| dxfg_java_object_handler * | handler ) |
Frees the memory of the handle structure and releases the reference to the Java object. Do not use the handle after that. Passing NULL does nothing.
If the handle is the last handle (see dxfg_JavaObjectHandler_clone()) of a listener created by a dxfg_*Listener_new function, the listener is deactivated (see dxfg_NativeListener_deactivate()): the function waits for the listener's callbacks that are in progress on other threads and after it returns the listener's function is not called anymore, so its user data can be freed. Remove the listener (e.g. dxfg_DXFeedSubscription_removeEventListener()) before releasing it, otherwise it stays added and does nothing.
Do not hold the locks that the listener's function may take while releasing the listener: it may deadlock. Releasing a listener from its own callback is allowed (the function does not wait for that call).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | handler | The handle to release (e.g. &executor->handler for a dxfg_executor_t). |
| int32_t dxfg_NativeListener_deactivate | ( | graal_isolatethread_t * | thread, |
| dxfg_java_object_handler * | listener ) |
Deactivates a listener created by a dxfg_*Listener_new function (e.g. dxfg_DXFeedEventListener_new(), dxfg_PropertyChangeListener_new()) regardless of the number of its handles: waits for the listener's callbacks that are in progress on other threads, after that the listener's function is not called anymore, so its user data can be freed. The listener stays added where it was added, but does nothing, and cannot be activated again.
Releasing the last handle of the listener with dxfg_JavaObjectHandler_release() deactivates it as well. Do not hold the locks that the listener's function may take while deactivating the listener: it may deadlock. Deactivating a listener from its own callback is allowed (the function does not wait for that call).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | listener | The listener handle. |
| int32_t dxfg_Object_equals | ( | graal_isolatethread_t * | thread, |
| dxfg_java_object_handler * | object, | ||
| dxfg_java_object_handler * | other ) |
Checks whether the Java objects are equal: the handles of the same object, and the handles of the objects that are equal in the sense of the Java equals method of the first object. Two NULL handles are equal, a NULL handle and a non-NULL handle are not.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | object | The handle of the first object. |
| [in] | other | The handle of the second object. |
Java: Objects.equals(Object, Object).
| int32_t dxfg_Object_finalize | ( | graal_isolatethread_t * | thread, |
| dxfg_java_object_handler * | handler, | ||
| dxfg_finalize_function | finalize, | ||
| void * | user_data ) |
Registers a function that is called with the user data after the Java object is garbage collected.
The Java object is not collected while a handle of it exists, so the function is called after all the handles of the object have been released and nothing else in Java refers to the object. The collected objects are checked about once a second. The function is called by a daemon Java thread of the SDK (see dxfg_finalize_function), once for each registration.
It does not stop the callbacks of a listener: see dxfg_NativeListener_deactivate() for that.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | handler | The handle of the object to watch. |
| [in] | finalize | The function to call. |
| [in] | user_data | The user data to pass to the function; the SDK does not free it. |
| int32_t dxfg_Object_hashCode | ( | graal_isolatethread_t * | thread, |
| dxfg_java_object_handler * | object ) |
Returns the hash code of the Java object: the result of its Java hashCode method, or 0 for a NULL handle.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | object | The handle of the object. |
Java: Objects.hashCode(Object).
| int32_t dxfg_Object_new | ( | graal_isolatethread_t * | thread, |
| DXFG_OUT dxfg_java_object_handler ** | object ) |
Creates a new Java Object.
| [in] | thread | The current GraalVM Isolate's thread. |
| [out] | object | The pointer to which the pointer to the handle of the new object is written; must not be NULL. |
Java: Object().
| const char * dxfg_Object_toString | ( | graal_isolatethread_t * | thread, |
| dxfg_java_object_handler * | object ) |
Returns the string representation of the Java object. It works for the handle of any Java object, including the typed handles (e.g. dxfg_time_zone_t, dxfg_auth_token_t).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | object | The handle of the object. A NULL handle is an error. |
Java: Object.toString().
| int32_t dxfg_String_release | ( | graal_isolatethread_t * | thread, |
| const char * | string ) |
Frees a string that a function returned (e.g. dxfg_Object_toString()). Do not pass a string that is a field of a structure, such as a string of an event: it is freed with the structure.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | string | The string to free. If it is NULL, nothing is done. |
| dxfg_java_object_handler * dxfg_throw_exception | ( | graal_isolatethread_t * | thread | ) |
Always fails: throws a Java exception (a RuntimeException "recursion" with a cause "cause", thrown several calls deep, so that its stack trace has several frames). It is only for testing of dxfg_get_and_clear_thread_exception_t().
| [in] | thread | The current GraalVM Isolate's thread. |
| dxfg_time_format_t * dxfg_TimeFormat_asFullIso | ( | graal_isolatethread_t * | thread, |
| dxfg_time_format_t * | timeFormat ) |
Returns the time format that produces the full ISO8601 string of yyyy-MM-dd'T'HH:mm:ss.SSSX.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeFormat | The time format. |
Java: TimeFormat.asFullIso().
| dxfg_time_format_t * dxfg_TimeFormat_DEFAULT | ( | graal_isolatethread_t * | thread | ) |
Returns the time format of the default time zone of the Java virtual machine.
| [in] | thread | The current GraalVM Isolate's thread. |
Java: TimeFormat.DEFAULT.
| const char * dxfg_TimeFormat_format | ( | graal_isolatethread_t * | thread, |
| dxfg_time_format_t * | timeFormat, | ||
| int64_t | value ) |
Converts the time to a string like yyyyMMdd-HHmmss in the time zone of the time format. The time zone (RFC 822, e.g. +0300) and the milliseconds (.sss) are included if the format was obtained with dxfg_TimeFormat_withTimeZone() and dxfg_TimeFormat_withMillis(). The time 0 is formatted as "0". If the year of the time is outside of 0001 to 9999, the result is the decimal number of the milliseconds.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeFormat | The time format. |
| [in] | value | The time: the number of milliseconds since 1970-01-01T00:00:00Z. |
Java: TimeFormat.format(long).
| dxfg_time_format_t * dxfg_TimeFormat_getInstance | ( | graal_isolatethread_t * | thread, |
| dxfg_time_zone_t * | timeZone ) |
Returns the time format of the time zone. The format keeps a copy of the time zone: later changes of the time zone do not affect it.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeZone | The time zone; NULL is an error. |
Java: TimeFormat.getInstance(TimeZone).
| dxfg_time_zone_t * dxfg_TimeFormat_getTimeZone | ( | graal_isolatethread_t * | thread, |
| dxfg_time_format_t * | timeFormat ) |
Returns the time zone of the time format.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeFormat | The time format. |
Java: TimeFormat.getTimeZone().
| dxfg_time_format_t * dxfg_TimeFormat_GMT | ( | graal_isolatethread_t * | thread | ) |
Returns the time format of the GMT time zone.
| [in] | thread | The current GraalVM Isolate's thread. |
Java: TimeFormat.GMT.
| int64_t dxfg_TimeFormat_parse | ( | graal_isolatethread_t * | thread, |
| dxfg_time_format_t * | timeFormat, | ||
| const char * | value ) |
Parses the date and the time from the string in an ISO 8601 format. The string can be:
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeFormat | The time format. |
| [in] | value | The string to parse; NULL is an error. |
Java: TimeFormat.parse(String).
| dxfg_time_format_t * dxfg_TimeFormat_withMillis | ( | graal_isolatethread_t * | thread, |
| dxfg_time_format_t * | timeFormat ) |
Returns the time format that also includes the milliseconds into the string of dxfg_TimeFormat_format().
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeFormat | The time format. |
Java: TimeFormat.withMillis().
| dxfg_time_format_t * dxfg_TimeFormat_withTimeZone | ( | graal_isolatethread_t * | thread, |
| dxfg_time_format_t * | timeFormat ) |
Returns the time format that also includes the time zone into the string of dxfg_TimeFormat_format().
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeFormat | The time format. |
Java: TimeFormat.withTimeZone().
| int64_t dxfg_TimePeriod_getNanos | ( | graal_isolatethread_t * | thread, |
| dxfg_time_period_t * | timePeriod ) |
Returns the time period in nanoseconds. A period longer than about 292 years, e.g. dxfg_TimePeriod_UNLIMITED(), overflows int64_t and gives a wrong value, which may be negative (-1000000 for the unlimited period); use dxfg_TimePeriod_getTime() for such periods.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timePeriod | The time period. |
Java: TimePeriod.getNanos().
| int32_t dxfg_TimePeriod_getSeconds | ( | graal_isolatethread_t * | thread, |
| dxfg_time_period_t * | timePeriod ) |
Returns the time period in whole seconds (rounded down). A period longer than about 68 years, e.g. dxfg_TimePeriod_UNLIMITED(), does not fit into int32_t: the result is truncated to its lower 32 bits.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timePeriod | The time period. |
Java: TimePeriod.getSeconds().
| int64_t dxfg_TimePeriod_getTime | ( | graal_isolatethread_t * | thread, |
| dxfg_time_period_t * | timePeriod ) |
Returns the time period in milliseconds.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timePeriod | The time period. |
Java: TimePeriod.getTime().
| dxfg_time_period_t * dxfg_TimePeriod_UNLIMITED | ( | graal_isolatethread_t * | thread | ) |
Returns the time period of "infinity": its time is the maximum value of int64_t milliseconds.
| [in] | thread | The current GraalVM Isolate's thread. |
Java: TimePeriod.UNLIMITED.
| dxfg_time_period_t * dxfg_TimePeriod_valueOf | ( | graal_isolatethread_t * | thread, |
| int64_t | value ) |
Returns the time period of the given number of milliseconds.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | value | The value in milliseconds; a negative value is an error. |
Java: TimePeriod.valueOf(long).
| dxfg_time_period_t * dxfg_TimePeriod_valueOf2 | ( | graal_isolatethread_t * | thread, |
| const char * | value ) |
Returns the time period that the string represents. The string is an ISO8601 duration with these simplifications: the letters are case insensitive; the letters "P" and "T" can be omitted; the letter "S" can be omitted, then the last number is the seconds; the seconds can be fractional (milliseconds precision); an omitted part is zero; the string "inf" is the unlimited period.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | value | The string, e.g. "PT1H30M", "1d" or "0.5". |
Java: TimePeriod.valueOf(String).
| dxfg_time_period_t * dxfg_TimePeriod_ZERO | ( | graal_isolatethread_t * | thread | ) |
Returns the time period of zero.
| [in] | thread | The current GraalVM Isolate's thread. |
Java: TimePeriod.ZERO.
| dxfg_time_zone_t * dxfg_TimeZone_getDefault | ( | graal_isolatethread_t * | thread | ) |
Returns the default time zone of the Java virtual machine.
| [in] | thread | The current GraalVM Isolate's thread. |
Java: TimeZone.getDefault().
| const char * dxfg_TimeZone_getDisplayName | ( | graal_isolatethread_t * | thread, |
| dxfg_time_zone_t * | timeZone ) |
Returns the long name of the time zone (for the standard time) in the default locale of the Java virtual machine.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeZone | The time zone. |
Java: TimeZone.getDisplayName().
| const char * dxfg_TimeZone_getDisplayName2 | ( | graal_isolatethread_t * | thread, |
| dxfg_time_zone_t * | timeZone, | ||
| int32_t | daylight, | ||
| int32_t | style ) |
Returns the name of the time zone in the default locale of the Java virtual machine, for the standard or the daylight saving time, in the long or the short style.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeZone | The time zone. |
| [in] | daylight | 1 for the name of the daylight saving time, any other value for the name of the standard time. |
| [in] | style | 0 for the short name (TimeZone.SHORT), 1 for the long name (TimeZone.LONG); any other value is an error. |
Java: TimeZone.getDisplayName(boolean, int).
| int32_t dxfg_TimeZone_getDSTSavings | ( | graal_isolatethread_t * | thread, |
| dxfg_time_zone_t * | timeZone ) |
Returns the amount of time to be added to the local standard time to get the local wall clock time, in milliseconds. It is 0 if the time zone does not observe the daylight saving time.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeZone | The time zone. |
Java: TimeZone.getDSTSavings().
| const char * dxfg_TimeZone_getID | ( | graal_isolatethread_t * | thread, |
| dxfg_time_zone_t * | timeZone ) |
Returns the ID of the time zone.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeZone | The time zone. |
Java: TimeZone.getID().
| int32_t dxfg_TimeZone_getOffset | ( | graal_isolatethread_t * | thread, |
| dxfg_time_zone_t * | timeZone, | ||
| int64_t | date ) |
Returns the offset of the time zone from UTC at the date, in milliseconds. If the daylight saving time is in effect at the date, the offset includes the saving.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeZone | The time zone. |
| [in] | date | The date: the number of milliseconds since 1970-01-01T00:00:00Z. |
Java: TimeZone.getOffset(long).
| int32_t dxfg_TimeZone_getOffset2 | ( | graal_isolatethread_t * | thread, |
| dxfg_time_zone_t * | timeZone, | ||
| int32_t | era, | ||
| int32_t | year, | ||
| int32_t | month, | ||
| int32_t | day, | ||
| int32_t | dayOfWeek, | ||
| int32_t | milliseconds ) |
Returns the offset of the time zone from UTC at the local date, in milliseconds, adjusted for the daylight saving time.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeZone | The time zone. |
| [in] | era | The era of the date: 1 for AD (GregorianCalendar.AD) or 0 for BC (GregorianCalendar.BC). |
| [in] | year | The year in the era. |
| [in] | month | The month of the year, 0-based: 0 for January. |
| [in] | day | The day of the month. |
| [in] | dayOfWeek | The day of the week: 1 for Sunday (Calendar.SUNDAY) to 7 for Saturday. |
| [in] | milliseconds | The milliseconds in the day, in the standard local time. |
Java: TimeZone.getOffset(int, int, int, int, int, int).
| int32_t dxfg_TimeZone_getRawOffset | ( | graal_isolatethread_t * | thread, |
| dxfg_time_zone_t * | timeZone ) |
Returns the offset of the time zone from UTC, in milliseconds, that does not include the daylight saving time.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeZone | The time zone. |
Java: TimeZone.getRawOffset().
| dxfg_time_zone_t * dxfg_TimeZone_getTimeZone | ( | graal_isolatethread_t * | thread, |
| const char * | ID ) |
Returns the time zone for the ID. If the ID is not known, the result is the GMT zone.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | ID | The ID of the time zone, e.g. "America/New_York" or "GMT+03:00". |
Java: TimeZone.getTimeZone(String).
| int32_t dxfg_TimeZone_hasSameRules | ( | graal_isolatethread_t * | thread, |
| dxfg_time_zone_t * | timeZone, | ||
| dxfg_time_zone_t * | other ) |
Checks whether the time zone has the same rules and offset as the other time zone (they may differ only in the ID).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeZone | The time zone. |
| [in] | other | The other time zone. |
Java: TimeZone.hasSameRules(TimeZone).
| int32_t dxfg_TimeZone_inDaylightTime | ( | graal_isolatethread_t * | thread, |
| dxfg_time_zone_t * | timeZone, | ||
| int64_t | date ) |
Checks whether the date is in the daylight saving time of the time zone.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeZone | The time zone. |
| [in] | date | The date: the number of milliseconds since 1970-01-01T00:00:00Z. |
Java: TimeZone.inDaylightTime(Date).
| int32_t dxfg_TimeZone_observesDaylightTime | ( | graal_isolatethread_t * | thread, |
| dxfg_time_zone_t * | timeZone ) |
Checks whether the time zone is currently in the daylight saving time, or a transition from the standard time to the daylight saving time occurs at any future time.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeZone | The time zone. |
Java: TimeZone.observesDaylightTime().
| int32_t dxfg_TimeZone_setID | ( | graal_isolatethread_t * | thread, |
| dxfg_time_zone_t * | timeZone, | ||
| const char * | ID ) |
Sets the ID of the time zone. It changes the Java object, so all the handles of the time zone see the new ID.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeZone | The time zone. |
| [in] | ID | The new ID. |
Java: TimeZone.setID(String).
| int32_t dxfg_TimeZone_setRawOffset | ( | graal_isolatethread_t * | thread, |
| dxfg_time_zone_t * | timeZone, | ||
| int32_t | offsetMillis ) |
Sets the offset of the time zone from UTC that does not include the daylight saving time. It changes the Java object, so all the handles of the time zone see the new offset.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeZone | The time zone. |
| [in] | offsetMillis | The raw offset in milliseconds. |
Java: TimeZone.setRawOffset(int).
| int32_t dxfg_TimeZone_useDaylightTime | ( | graal_isolatethread_t * | thread, |
| dxfg_time_zone_t * | timeZone ) |
Checks whether the time zone uses the daylight saving time.
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | timeZone | The time zone. |
Java: TimeZone.useDaylightTime().