01: /*
02: * XAPool: Open Source XA JDBC Pool
03: * Copyright (C) 2003 Objectweb.org
04: * Initial Developer: Lutris Technologies Inc.
05: * Contact: xapool-public@lists.debian-sf.objectweb.org
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation; either
10: * version 2.1 of the License, or any later version.
11: *
12: * This library 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 library; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20: * USA
21: */
22: package org.enhydra.jdbc.core;
23:
24: import java.sql.SQLException;
25:
26: /**
27: * Generic interface for getting threads, modeled after Enhydra
28: * ThreadClientService interface. This allows the JdbcLib code
29: * to be portable across app servers.
30: */
31: public interface JdbcThreadFactory {
32:
33: /**
34: * Get a thread for the client. This thread will belong to the
35: * client's thread group.
36: *
37: * @param target
38: * the Runnable object that will use this thread.
39: * @return
40: * the Thread that the client can now use.
41: */
42: public Thread getThread(Runnable target) throws SQLException;
43:
44: /**
45: * Get a thread for the client. This thread will belong to the
46: * client's thread group.
47: *
48: * @param target
49: * the Runnable object that will use this thread.
50: * @param name
51: * the name of the thread. If a <code>null<code> value is given
52: * an arbitrary name will be provided
53: * @return
54: * the Thread that the client can now use.
55: */
56: public Thread getThread(Runnable target, String name)
57: throws SQLException;
58:
59: /**
60: * Get a thread for the client. This thread will belong to the
61: * the specified thread group, or the client's thread group if none
62: * is specified.
63: *
64: * @param group
65: * the ThreadGroup to which the new thread will be added. If
66: * <code>null</code> the new thread is added to the same thread
67: * group as the currently executing thread.
68: * @param target
69: * the Runnable object that will use this thread.
70: * @return
71: * the Thread that the client can now use.
72: */
73: public Thread getThread(ThreadGroup group, Runnable target)
74: throws SQLException;
75:
76: /**
77: * Get a thread for the client. This thread will belong to the
78: * the specified thread group, or the client's thread group if none
79: * is specified.
80: *
81: * @param group
82: * the ThreadGroup to which the new thread will be added. If
83: * <code>null</code> the new thread is added to the same thread
84: * group as the currently executing thread.
85: * @param target
86: * the Runnable object that will use this thread.
87: * @param name
88: * the String name ofthe new thread. If a <code>null</code> value
89: * is given an arbitrary name will be provided.
90: * @return
91: * the Thread that the client can now use.
92: */
93: public Thread getThread(ThreadGroup group, Runnable target,
94: String name) throws SQLException;
95: }
|