001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.geronimo.connector.outbound.connectiontracking;
018
019 import javax.resource.ResourceException;
020 import javax.transaction.Transaction;
021
022 import org.apache.geronimo.transaction.manager.TransactionManagerMonitor;
023 import org.slf4j.Logger;
024 import org.slf4j.LoggerFactory;
025
026 /**
027 * @version $Rev: 723385 $ $Date: 2008-12-04 12:55:02 -0500 (Thu, 04 Dec 2008) $
028 */
029 public class GeronimoTransactionListener implements TransactionManagerMonitor {
030 private static final Logger log = LoggerFactory.getLogger(GeronimoTransactionListener.class);
031 private final TrackedConnectionAssociator trackedConnectionAssociator;
032
033 public GeronimoTransactionListener(TrackedConnectionAssociator trackedConnectionAssociator) {
034 this.trackedConnectionAssociator = trackedConnectionAssociator;
035 }
036
037 public void threadAssociated(Transaction transaction) {
038 try {
039 trackedConnectionAssociator.newTransaction();
040 } catch (ResourceException e) {
041 log.warn("Error notifying connection tranker of transaction association", e);
042 }
043 }
044
045 public void threadUnassociated(Transaction transaction) {
046 }
047 }