FileDocCategorySizeDatePackage
MessageReceiver.javaAPI DocGlassfish v2 API3432Fri May 04 22:30:28 BST 2007com.sun.enterprise.jbi.serviceengine.comm

MessageReceiver

public class MessageReceiver extends com.sun.enterprise.jbi.serviceengine.work.OneWork
An instance of this class is used to receive a reply for a 2-way message exchane from NMR. The object that need to receive the message calls receive() on the instance of this class, after setting MessageExchange. receive() method will block until MessageAcceptor releases it when it receives a reply for the MEP. Typically MessageReceiver.receive() is called on the application thread.
author
Binod PG

Fields Summary
Constructors Summary
Methods Summary
public voiddoWork()
Register the receiver with MessageAcceptor and waits for the reply/notification.

        MessageAcceptor acceptor = getWorkManager().getMessageAcceptor();
        acceptor.register(this);

        synchronized (this) {
            try {
                wait();
            } catch (InterruptedException ie) {
                setException(ie);
            }
        }
    
public voidreceive()
Just calls doWork()

        execute();
    
public voidrelease()
MessageAcceptor executes this method to notify the waiting thread about the arrival of reply message.

        synchronized (this) {
            notify();
        }