JwsContext.onFinish(boolean) Callback

Received when the current conversation is about to end.

# Syntax

    public void onFinish(boolean expired)

# Parameters

expired

true if the conversation ended by expiring; otherwise false.

# Return Value

None.

# Exceptions

None.

# Remarks

Implement a handler for this callback if you want to add code that executes when a conversation is about to finish. For example, if you think your service's conversation may end before the service has returned a result to a client, you might want to implement an onFinish callback handler that lets the client know a response isn't coming. The conversation finishes after your callback handler has finished executing.

The expired value indicates whether the conversation finished by expiring (in effect, "timing out") or was intentionally finished in keeping with your service's design. Under normal circumstances a conversation ends for the following reasons:

- Your service's execution reaches some item (such as a callback or a method) that is marked to finish the conversation — its conversation property phase attribute is set to "finish."

- Your code calls the JwsContext.finishConversation method. You might do this to "clean up" in error handling code.

In other cases a conversation may not finish by design. If it does not, it may simply continue until it is ended by WebLogic Server. It will be ended if:

- The conversation outlives the value of the service's conversation-lifetime property max-age attribute.

- The conversation has remained idle longer than the service's conversation-lifetime property max-idle-time attribute.

Note that you should not write code to invoke this callback. Rather, you implement a callback handler that will execute when your service receives the callback from WebLogic Server. Your code might look like the following:

    public void context_onFinish(boolean expired)
    {
        /* If the conversation has ended because it expired, tell the client
        that results will not be coming. */
        if(expired){
            callback.onError("Results unavailable at this time. Please try again.");
        }
    }

Related Topics

JwsContext Interface

Managing Conversation Lifetime