KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > jms > asf > StdServerSessionPoolFactory


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.jms.asf;
23
24 import java.io.Serializable JavaDoc;
25 import java.security.AccessController JavaDoc;
26 import java.security.PrivilegedAction JavaDoc;
27
28 import javax.jms.Connection JavaDoc;
29 import javax.jms.Destination JavaDoc;
30 import javax.jms.JMSException JavaDoc;
31 import javax.jms.MessageListener JavaDoc;
32 import javax.jms.ServerSessionPool JavaDoc;
33 import javax.transaction.TransactionManager JavaDoc;
34
35 import org.jboss.tm.XidFactoryMBean;
36
37 /**
38  * An implementation of ServerSessionPoolFactory.
39  *
40  * @author <a HREF="mailto:peter.antman@tim.se">Peter Antman</a> .
41  * @author <a HREF="mailto:hiram.chirino@jboss.org">Hiram Chirino</a> .
42  * @author <a HREF="mailto:adrian@jboss.com">Adrian Brock</a>
43  * @version $Revision: 44582 $
44  */

45 public class StdServerSessionPoolFactory implements ServerSessionPoolFactory, Serializable JavaDoc
46 {
47    private static final long serialVersionUID = 4969432475779524576L;
48
49    public static final boolean USE_OLD;
50    
51    static
52    {
53       USE_OLD = ((Boolean JavaDoc) AccessController.doPrivileged(new PrivilegedAction JavaDoc()
54       {
55          public Object JavaDoc run()
56          {
57             return new Boolean JavaDoc(System.getProperty("org.jboss.jms.asf.useold", "false"));
58          }
59       })).booleanValue();
60    }
61    
62    /** The name of this factory. */
63    private String JavaDoc name;
64
65    private XidFactoryMBean xidFactory;
66
67    private TransactionManager JavaDoc transactionManager;
68
69    public StdServerSessionPoolFactory()
70    {
71       super();
72    }
73
74    public void setName(final String JavaDoc name)
75    {
76       this.name = name;
77    }
78
79    public String JavaDoc getName()
80    {
81       return name;
82    }
83
84    public void setXidFactory(final XidFactoryMBean xidFactory)
85    {
86       this.xidFactory = xidFactory;
87    }
88
89    public XidFactoryMBean getXidFactory()
90    {
91       return xidFactory;
92    }
93
94    public void setTransactionManager(TransactionManager JavaDoc transactionManager)
95    {
96       this.transactionManager = transactionManager;
97    }
98
99    public TransactionManager JavaDoc getTransactionManager()
100    {
101       return transactionManager;
102    }
103
104    public ServerSessionPool JavaDoc getServerSessionPool(Destination JavaDoc destination, Connection JavaDoc con, int minSession, int maxSession, long keepAlive, boolean isTransacted, int ack, boolean useLocalTX, MessageListener JavaDoc listener) throws JMSException JavaDoc
105    {
106       ServerSessionPool JavaDoc pool = new StdServerSessionPool(destination, con, isTransacted, ack, useLocalTX, listener, minSession, maxSession, keepAlive, xidFactory, transactionManager);
107       return pool;
108    }
109 }
110
Popular Tags