当前位置: 首页>>代码示例>>Java>>正文


Java ConnectionEvent.setConnectionHandle方法代码示例

本文整理汇总了Java中javax.resource.spi.ConnectionEvent.setConnectionHandle方法的典型用法代码示例。如果您正苦于以下问题:Java ConnectionEvent.setConnectionHandle方法的具体用法?Java ConnectionEvent.setConnectionHandle怎么用?Java ConnectionEvent.setConnectionHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.resource.spi.ConnectionEvent的用法示例。


在下文中一共展示了ConnectionEvent.setConnectionHandle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onError

import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
private void onError(Exception e) {

    this.localTran = null;

    synchronized (this.connections) {
      Iterator<GFConnectionImpl> connsItr = this.connections.iterator();
      while (connsItr.hasNext()) {
        GFConnectionImpl conn = connsItr.next();
        conn.invalidate();
        synchronized (this.listeners) {
          Iterator<ConnectionEventListener> itr = this.listeners.iterator();
          ConnectionEvent ce =
              new ConnectionEvent(this, ConnectionEvent.CONNECTION_ERROR_OCCURRED, e);
          ce.setConnectionHandle(conn);
          while (itr.hasNext()) {
            itr.next().connectionErrorOccurred(ce);
          }
        }
        connsItr.remove();
      }
    }

  }
 
开发者ID:ampool,项目名称:monarch,代码行数:24,代码来源:JCAManagedConnection.java

示例2: onClose

import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
public void onClose(GFConnectionImpl conn) throws ResourceException {
  conn.invalidate();
  this.connections.remove(conn);
  synchronized (this.listeners) {
    Iterator<ConnectionEventListener> itr = this.listeners.iterator();
    ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
    ce.setConnectionHandle(conn);
    while (itr.hasNext()) {
      itr.next().connectionClosed(ce);
    }
  }
  if (this.connections.isEmpty()) {
    // safe to dissociate this managedconnection so that it can go to pool
    if (this.initDone && !this.cache.isClosed()) {
      this.localTran = new JCALocalTransaction(this.cache, this.gfTxMgr);
    } else {
      this.localTran = new JCALocalTransaction();
    }
  }

}
 
开发者ID:ampool,项目名称:monarch,代码行数:22,代码来源:JCAManagedConnection.java

示例3: onError

import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
private void onError(Exception e)
{

  this.localTran = null;

  synchronized (this.connections) {
    Iterator<GFConnectionImpl> connsItr = this.connections.iterator();
    while (connsItr.hasNext()) {
      GFConnectionImpl conn = connsItr.next();
      conn.invalidate();
      synchronized (this.listeners) {
        Iterator<ConnectionEventListener> itr = this.listeners.iterator();
        ConnectionEvent ce = new ConnectionEvent(this,
            ConnectionEvent.CONNECTION_ERROR_OCCURRED, e);
        ce.setConnectionHandle(conn);
        while (itr.hasNext()) {
          itr.next().connectionErrorOccurred(ce);
        }
      }
      connsItr.remove();
    }
  }

}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:25,代码来源:JCAManagedConnection.java

示例4: onClose

import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
public void onClose(GFConnectionImpl conn) throws ResourceException
{
  conn.invalidate();
  this.connections.remove(conn);
  synchronized (this.listeners) {
    Iterator<ConnectionEventListener> itr = this.listeners.iterator();
    ConnectionEvent ce = new ConnectionEvent(this,
        ConnectionEvent.CONNECTION_CLOSED);
    ce.setConnectionHandle(conn);
    while (itr.hasNext()) {
      itr.next().connectionClosed(ce);
    }
  }
  if (this.connections.isEmpty()) {
    // safe to dissociate this managedconnection so that it can go to pool
    if (this.initDone && !this.cache.isClosed()) {
      this.localTran = new JCALocalTransaction(this.cache, this.gfTxMgr);
    }
    else {
      this.localTran = new JCALocalTransaction();
    }
  }

}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:25,代码来源:JCAManagedConnection.java

示例5: connectionClosed

import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
void connectionClosed(WrappedConnection wc) {
	
	synchronized (this.handles) {
		handles.remove(wc);
	}
	
	ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
	ce.setConnectionHandle(wc);
	
	ArrayList<ConnectionEventListener> copy = null;
	synchronized (this.listeners) {
		copy = new ArrayList<ConnectionEventListener>(this.listeners);
	}
	
	for(ConnectionEventListener l: copy) {
		l.connectionClosed(ce);
	}
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:19,代码来源:BasicManagedConnection.java

示例6: begin

import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
public void begin()
throws ResourceException {

checkEnv("begin");
long id = -1;
try {
    Transaction txn = env.beginTransaction(null, transConfig);
    env.setThreadTransaction(txn);
    id = txn.getId();
} catch (DatabaseException DE) {
    throw new ResourceException("During begin: " + DE.toString());
}

ConnectionEvent connEvent = new ConnectionEvent
    (mgdConn, ConnectionEvent.LOCAL_TRANSACTION_STARTED);
connEvent.setConnectionHandle(mgdConn);
mgdConn.sendConnectionEvent(connEvent);

if (DEBUG) {
    System.out.println("JELocalTransaction.begin " + id);
}
   }
 
开发者ID:nologic,项目名称:nabs,代码行数:23,代码来源:JELocalTransaction.java

示例7: commit

import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
public void commit()
throws ResourceException {

checkEnv("commit");
try {
    env.getThreadTransaction().commit();
} catch (DatabaseException DE) {
    ResourceException ret = new ResourceException(DE.toString());
    ret.initCause(DE);
    throw ret;
} finally {
    env.setThreadTransaction(null);
}

ConnectionEvent connEvent = new ConnectionEvent
    (mgdConn, ConnectionEvent.LOCAL_TRANSACTION_COMMITTED);
connEvent.setConnectionHandle(mgdConn);
mgdConn.sendConnectionEvent(connEvent);

if (DEBUG) {
    System.out.println("JELocalTransaction.commit");
}
   }
 
开发者ID:nologic,项目名称:nabs,代码行数:24,代码来源:JELocalTransaction.java

示例8: rollback

import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
public void rollback()
throws ResourceException {

checkEnv("rollback");
try {
    env.getThreadTransaction().abort();
} catch (DatabaseException DE) {
    ResourceException ret = new ResourceException(DE.toString());
    ret.initCause(DE);
    throw ret;
} finally {
    env.setThreadTransaction(null);
}

ConnectionEvent connEvent = new ConnectionEvent
    (mgdConn, ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK);
connEvent.setConnectionHandle(mgdConn);
mgdConn.sendConnectionEvent(connEvent);

if (DEBUG) {
    System.out.println("JELocalTransaction.rollback");
}
   }
 
开发者ID:nologic,项目名称:nabs,代码行数:24,代码来源:JELocalTransaction.java

示例9: begin

import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
public void begin()
    throws ResourceException {

    checkEnv("begin");
    long id = -1;
    try {
        Transaction txn = env.beginTransaction(null, transConfig);
        env.setThreadTransaction(txn);
        id = txn.getId();
    } catch (DatabaseException DE) {
        throw new ResourceException("During begin: " + DE.toString());
    }

    ConnectionEvent connEvent = new ConnectionEvent
        (mgdConn, ConnectionEvent.LOCAL_TRANSACTION_STARTED);
    connEvent.setConnectionHandle(mgdConn);
    mgdConn.sendConnectionEvent(connEvent);

    if (DEBUG) {
        System.out.println("JELocalTransaction.begin " + id);
    }
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:23,代码来源:JELocalTransaction.java

示例10: commit

import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
public void commit()
    throws ResourceException {

    checkEnv("commit");
    try {
        env.getThreadTransaction().commit();
    } catch (DatabaseException DE) {
        ResourceException ret = new ResourceException(DE.toString());
        ret.initCause(DE);
        throw ret;
    } finally {
        env.setThreadTransaction(null);
    }

    ConnectionEvent connEvent = new ConnectionEvent
        (mgdConn, ConnectionEvent.LOCAL_TRANSACTION_COMMITTED);
    connEvent.setConnectionHandle(mgdConn);
    mgdConn.sendConnectionEvent(connEvent);

    if (DEBUG) {
        System.out.println("JELocalTransaction.commit");
    }
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:24,代码来源:JELocalTransaction.java

示例11: rollback

import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
public void rollback()
    throws ResourceException {

    checkEnv("rollback");
    try {
        env.getThreadTransaction().abort();
    } catch (DatabaseException DE) {
        ResourceException ret = new ResourceException(DE.toString());
        ret.initCause(DE);
        throw ret;
    } finally {
        env.setThreadTransaction(null);
    }

    ConnectionEvent connEvent = new ConnectionEvent
        (mgdConn, ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK);
    connEvent.setConnectionHandle(mgdConn);
    mgdConn.sendConnectionEvent(connEvent);

    if (DEBUG) {
        System.out.println("JELocalTransaction.rollback");
    }
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:24,代码来源:JELocalTransaction.java

示例12: fireConnectionEvent

import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
public void fireConnectionEvent(int event) {
	ConnectionEvent connnectionEvent = new ConnectionEvent(this, event);
	connnectionEvent.setConnectionHandle(this.remoteConnection);
	for (ConnectionEventListener listener : this.listeners) {
		switch (event) {
		case LOCAL_TRANSACTION_STARTED:
			listener.localTransactionStarted(connnectionEvent);
			break;
		case LOCAL_TRANSACTION_COMMITTED:
			listener.localTransactionCommitted(connnectionEvent);
			break;
		case LOCAL_TRANSACTION_ROLLEDBACK:
			listener.localTransactionRolledback(connnectionEvent);
			break;
		case CONNECTION_CLOSED:
			listener.connectionClosed(connnectionEvent);
			break;
		default:
			throw new IllegalArgumentException("Unknown event: " + event);
		}
	}
}
 
开发者ID:scheuchzer,项目名称:outbound-connector,代码行数:23,代码来源:GenericManagedConnection.java

示例13: connectionClosed

import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
public void connectionClosed(CI handle) {
    ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
    event.setConnectionHandle(handle);
    // count down in case sending the event results in a handle getting removed.
    if (listeners != null) {
        for (ConnectionEventListener listener : reverse(listeners)) {
            listener.connectionClosed(event);
        }
    }
    if (listener != null) {
        listener.connectionClosed(event);
    }
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:14,代码来源:AbstractManagedConnection.java

示例14: closeHandle

import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
void closeHandle(Session handle) {

		// remove the handle from the collection safely
		synchronized (handles) {
			handles.remove(handle);
		}

		// create a connection closed event and send
		ConnectionEvent ce =
		new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
		ce.setConnectionHandle(handle);

		sendEvent(ce);
	}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:15,代码来源:ManagedConnectionImpl.java

示例15: closeHandle

import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
/**
 * Close handle
 *
 * @param handle
 *          The handle
 */
void closeHandle(RabbitmqConnection handle) {
  ConnectionEvent event = new ConnectionEvent(this,
      ConnectionEvent.CONNECTION_CLOSED);
  event.setConnectionHandle(handle);
  for (ConnectionEventListener cel : listeners) {
    cel.connectionClosed(event);
  }

}
 
开发者ID:leogsilva,项目名称:rabbitmq-resource-adapter,代码行数:16,代码来源:RabbitmqManagedConnection.java


注:本文中的javax.resource.spi.ConnectionEvent.setConnectionHandle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。