⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resourceadapterimpl.java

📁 derby database source code.good for you.
💻 JAVA
字号:
/*   Derby - Class org.apache.derby.jdbc.ResourceAdapterImpl   Copyright 1999, 2004 The Apache Software Foundation or its licensors, as applicable.   Licensed under the Apache License, Version 2.0 (the "License");   you may not use this file except in compliance with the License.   You may obtain a copy of the License at      http://www.apache.org/licenses/LICENSE-2.0   Unless required by applicable law or agreed to in writing, software   distributed under the License is distributed on an "AS IS" BASIS,   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   See the License for the specific language governing permissions and   limitations under the License. */package org.apache.derby.jdbc;import org.apache.derby.iapi.services.info.JVMInfo;import org.apache.derby.iapi.services.context.ContextService;import org.apache.derby.iapi.services.monitor.ModuleControl;import org.apache.derby.iapi.services.monitor.Monitor;import org.apache.derby.iapi.services.sanity.SanityManager;import org.apache.derby.iapi.jdbc.ResourceAdapter;//import org.apache.derby.iapi.jdbc.XATransactionResource;import org.apache.derby.iapi.error.StandardException;import org.apache.derby.iapi.store.access.AccessFactory;import org.apache.derby.iapi.store.access.xa.XAResourceManager;import org.apache.derby.iapi.store.access.xa.XAXactId;import java.util.Properties;import java.util.Hashtable;import java.util.Enumeration;public class ResourceAdapterImpl		implements ResourceAdapter, ModuleControl{	private boolean active;	// the real resource manager 	private XAResourceManager rm;		// maps Xid to XATransationResource for run time transactions	private Hashtable connectionTable;	/*	 * Module control	 */	public void boot(boolean create, Properties properties)		throws StandardException	{		// we can only run on jdk1.2 or beyond with JTA and JAVA 20 extension		// loaded.		connectionTable = new Hashtable();		AccessFactory af = 			(AccessFactory)Monitor.findServiceModule(this, AccessFactory.MODULE);		rm = (XAResourceManager) af.getXAResourceManager();		active = true;	}	public void stop()	{		active = false;		for (Enumeration e = connectionTable.elements(); e.hasMoreElements(); ) {			XATransactionState tranState = (XATransactionState) e.nextElement();			try {				tranState.conn.close();			} catch (java.sql.SQLException sqle) {			}		}		active = false;	}	public boolean isActive()	{		return active;	}	/*	 * Resource Adapter methods 	 */	public synchronized Object findConnection(XAXactId xid) {		return connectionTable.get(xid);	}	public synchronized boolean addConnection(XAXactId xid, Object conn) {		if (connectionTable.get(xid) != null)			return false;		// put this into the transaction table, if the xid is already		// present as an in-doubt transaction, we need to remove it from		// the run time list		connectionTable.put(xid, conn);		return true;	}	public synchronized Object removeConnection(XAXactId xid) {		return connectionTable.remove(xid);	}	/**		Return the XA Resource manager to the XA Connection	 */	public XAResourceManager getXAResourceManager()	{		return rm;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -