001 package com.mockrunner.mock.jms; 002 003 import javax.jms.JMSException; 004 import javax.jms.ServerSession; 005 import javax.jms.ServerSessionPool; 006 007 /** 008 * Mock implementation of JMS <code>ServerSessionPool</code>. 009 */ 010 public class MockServerSessionPool implements ServerSessionPool 011 { 012 private MockConnection connection; 013 private ServerSession session; 014 015 public MockServerSessionPool(MockConnection connection) 016 { 017 this.connection = connection; 018 session = new MockServerSession(connection); 019 } 020 021 public void setServerSession(ServerSession session) 022 { 023 this.session = session; 024 } 025 026 public ServerSession getServerSession() throws JMSException 027 { 028 connection.throwJMSException(); 029 return session; 030 } 031 }