TibrvMsg.dispose()

Method

Declaration

void dispose()

Purpose

Release native storage associated with the message.

Remarks

In the native (JNI) preferred implementations, messages occupy storage outside of the Java environment (that is, in the native C environment) and also within the Java environment. When the Java garbage collector recycles the Java message object, this action triggers release of the corresponding native storage as well.

However, the timing of garbage collection is unpredictable, delaying the release of native storage as well. In applications where efficient management of native storage is a critical performance factor, you can use this method to explicitly free the native storage.

Call this dispose method at the end of a message callback method to immediately free the native storage associated with the message. The Java message object is independent of the native storage (and independent of this method), and it remains intact until the Java garbage collector recycles it in the usual way.

Attempting to access the message after calling this method results in an exception. (However, TibrvMsg.getSendSubject() and TibrvMsg.setReplySubject() retrieve null rather than throwing an exception

Restrictions

dispose() is available only in the JNI preferred implementation. It is not available in the JNI backward compatibility implementation, nor in the pure Java implementation.