All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mockrunner.mock.jms.MockServerSession Maven / Gradle / Ivy

There is a newer version: 2.0.7
Show newest version
package com.mockrunner.mock.jms;

import java.io.Serializable;

import javax.jms.JMSException;
import javax.jms.QueueSession;
import javax.jms.ServerSession;
import javax.jms.Session;

/**
 * Mock implementation of JMS ServerSession.
 * The ServerSession is not meant for application
 * use.
 */
public class MockServerSession implements ServerSession, Serializable
{
    private MockConnection connection;
    private Session session;
    private boolean started;
    
    public MockServerSession(MockConnection connection)
    {
        this.connection = connection;
        session = new MockSession(connection, false, QueueSession.AUTO_ACKNOWLEDGE);
        started = false;
    }
    
    /**
     * Returns if this server session was started.
     * @return true if this server session is started
     */
    public boolean isStarted()
    {
        return started;
    }
    
    public void setSession(Session session)
    {
        this.session = session;
    }
    
    public Session getSession() throws JMSException
    {
        connection.throwJMSException();
        return session;
    }

    public void start() throws JMSException
    {
        connection.throwJMSException();
        started = true;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy