// **********************************************************************
//
// Generated by the ORBacus IDL to Java Translator
//
// Copyright (c) 2005
// IONA Technologies, Inc.
// Waltham, MA, USA
//
// All Rights Reserved
//
// **********************************************************************

// Version: 4.3.2

package org.exolab.jms.jobserver;

//
// IDL:org.exolab.jms/org/exolab/jms/jobserver/ServerSession:1.0
//
public class _ServerSessionStub extends org.omg.CORBA.portable.ObjectImpl
                                implements ServerSession
{
    private static final String[] _ob_ids_ =
    {
        "IDL:org.exolab.jms/org/exolab/jms/jobserver/ServerSession:1.0",
    };

    public String[]
    _ids()
    {
        return _ob_ids_;
    }

    final public static java.lang.Class _ob_opsClass = ServerSessionOperations.class;

    //
    // IDL:org.exolab.jms/org/exolab/jms/jobserver/ServerSession/close:1.0
    //
    public void
    close()
    {
        while(true)
        {
            if(!this._is_local())
            {
                org.omg.CORBA.portable.OutputStream out = null;
                org.omg.CORBA.portable.InputStream in = null;
                try
                {
                    out = _request("close", true);
                    in = _invoke(out);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
                {
                    final String _ob_id = _ob_aex.getId();
                    in = _ob_aex.getInputStream();

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
                }
                finally
                {
                    _releaseReply(in);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("close", _ob_opsClass);
                if(_ob_so == null)
                    continue;
                ServerSessionOperations _ob_self = (ServerSessionOperations)_ob_so.servant;
                try
                {
                    _ob_self.close();
                    return;
                }
                finally
                {
                    _servant_postinvoke(_ob_so);
                }
            }
        }
    }

    //
    // IDL:org.exolab.jms/org/exolab/jms/jobserver/ServerSession/acknowledgeMessage:1.0
    //
    public void
    acknowledgeMessage(long _ob_a0,
                       String _ob_a1)
    {
        while(true)
        {
            if(!this._is_local())
            {
                org.omg.CORBA.portable.OutputStream out = null;
                org.omg.CORBA.portable.InputStream in = null;
                try
                {
                    out = _request("acknowledgeMessage", true);
                    out.write_longlong(_ob_a0);
                    out.write_string(_ob_a1);
                    in = _invoke(out);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
                {
                    final String _ob_id = _ob_aex.getId();
                    in = _ob_aex.getInputStream();

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
                }
                finally
                {
                    _releaseReply(in);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("acknowledgeMessage", _ob_opsClass);
                if(_ob_so == null)
                    continue;
                ServerSessionOperations _ob_self = (ServerSessionOperations)_ob_so.servant;
                try
                {
                    _ob_self.acknowledgeMessage(_ob_a0, _ob_a1);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_ob_so);
                }
            }
        }
    }

    //
    // IDL:org.exolab.jms/org/exolab/jms/jobserver/ServerSession/send:1.0
    //
    public void
    send(MessageData _ob_a0)
    {
        while(true)
        {
            if(!this._is_local())
            {
                org.omg.CORBA.portable.OutputStream out = null;
                org.omg.CORBA.portable.InputStream in = null;
                try
                {
                    out = _request("send", true);
                    MessageDataHelper.write(out, _ob_a0);
                    in = _invoke(out);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
                {
                    final String _ob_id = _ob_aex.getId();
                    in = _ob_aex.getInputStream();

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
                }
                finally
                {
                    _releaseReply(in);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("send", _ob_opsClass);
                if(_ob_so == null)
                    continue;
                ServerSessionOperations _ob_self = (ServerSessionOperations)_ob_so.servant;
                try
                {
                    _ob_self.send(_ob_a0);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_ob_so);
                }
            }
        }
    }

    //
    // IDL:org.exolab.jms/org/exolab/jms/jobserver/ServerSession/receiveNoWait:1.0
    //
    public MessageData
    receiveNoWait(long _ob_a0)
    {
        while(true)
        {
            if(!this._is_local())
            {
                org.omg.CORBA.portable.OutputStream out = null;
                org.omg.CORBA.portable.InputStream in = null;
                try
                {
                    out = _request("receiveNoWait", true);
                    out.write_longlong(_ob_a0);
                    in = _invoke(out);
                    MessageData _ob_r = MessageDataHelper.read(in);
                    return _ob_r;
                }
                catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
                {
                    final String _ob_id = _ob_aex.getId();
                    in = _ob_aex.getInputStream();

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
                }
                finally
                {
                    _releaseReply(in);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("receiveNoWait", _ob_opsClass);
                if(_ob_so == null)
                    continue;
                ServerSessionOperations _ob_self = (ServerSessionOperations)_ob_so.servant;
                try
                {
                    return _ob_self.receiveNoWait(_ob_a0);
                }
                finally
                {
                    _servant_postinvoke(_ob_so);
                }
            }
        }
    }

    //
    // IDL:org.exolab.jms/org/exolab/jms/jobserver/ServerSession/receive:1.0
    //
    public MessageData
    receive(long _ob_a0,
            long _ob_a1)
    {
        while(true)
        {
            if(!this._is_local())
            {
                org.omg.CORBA.portable.OutputStream out = null;
                org.omg.CORBA.portable.InputStream in = null;
                try
                {
                    out = _request("receive", true);
                    out.write_longlong(_ob_a0);
                    out.write_longlong(_ob_a1);
                    in = _invoke(out);
                    MessageData _ob_r = MessageDataHelper.read(in);
                    return _ob_r;
                }
                catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
                {
                    final String _ob_id = _ob_aex.getId();
                    in = _ob_aex.getInputStream();

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
                }
                finally
                {
                    _releaseReply(in);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("receive", _ob_opsClass);
                if(_ob_so == null)
                    continue;
                ServerSessionOperations _ob_self = (ServerSessionOperations)_ob_so.servant;
                try
                {
                    return _ob_self.receive(_ob_a0, _ob_a1);
                }
                finally
                {
                    _servant_postinvoke(_ob_so);
                }
            }
        }
    }

    //
    // IDL:org.exolab.jms/org/exolab/jms/jobserver/ServerSession/createConsumer:1.0
    //
    public long
    createConsumer(DestinationData _ob_a0,
                   String _ob_a1,
                   boolean _ob_a2)
    {
        while(true)
        {
            if(!this._is_local())
            {
                org.omg.CORBA.portable.OutputStream out = null;
                org.omg.CORBA.portable.InputStream in = null;
                try
                {
                    out = _request("createConsumer", true);
                    DestinationDataHelper.write(out, _ob_a0);
                    out.write_string(_ob_a1);
                    out.write_boolean(_ob_a2);
                    in = _invoke(out);
                    long _ob_r = in.read_longlong();
                    return _ob_r;
                }
                catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
                {
                    final String _ob_id = _ob_aex.getId();
                    in = _ob_aex.getInputStream();

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
                }
                finally
                {
                    _releaseReply(in);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("createConsumer", _ob_opsClass);
                if(_ob_so == null)
                    continue;
                ServerSessionOperations _ob_self = (ServerSessionOperations)_ob_so.servant;
                try
                {
                    return _ob_self.createConsumer(_ob_a0, _ob_a1, _ob_a2);
                }
                finally
                {
                    _servant_postinvoke(_ob_so);
                }
            }
        }
    }

    //
    // IDL:org.exolab.jms/org/exolab/jms/jobserver/ServerSession/closeConsumer:1.0
    //
    public void
    closeConsumer(long _ob_a0)
    {
        while(true)
        {
            if(!this._is_local())
            {
                org.omg.CORBA.portable.OutputStream out = null;
                org.omg.CORBA.portable.InputStream in = null;
                try
                {
                    out = _request("closeConsumer", true);
                    out.write_longlong(_ob_a0);
                    in = _invoke(out);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
                {
                    final String _ob_id = _ob_aex.getId();
                    in = _ob_aex.getInputStream();

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
                }
                finally
                {
                    _releaseReply(in);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("closeConsumer", _ob_opsClass);
                if(_ob_so == null)
                    continue;
                ServerSessionOperations _ob_self = (ServerSessionOperations)_ob_so.servant;
                try
                {
                    _ob_self.closeConsumer(_ob_a0);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_ob_so);
                }
            }
        }
    }
}
