本文整理汇总了Java中javax.resource.spi.ConnectionEventListener.localTransactionStarted方法的典型用法代码示例。如果您正苦于以下问题:Java ConnectionEventListener.localTransactionStarted方法的具体用法?Java ConnectionEventListener.localTransactionStarted怎么用?Java ConnectionEventListener.localTransactionStarted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.resource.spi.ConnectionEventListener
的用法示例。
在下文中一共展示了ConnectionEventListener.localTransactionStarted方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendConnectionEvent
import javax.resource.spi.ConnectionEventListener; //导入方法依赖的package包/类
protected void sendConnectionEvent(ConnectionEvent connEvent) {
for (int i = listeners.size() - 1; i >= 0; i--) {
ConnectionEventListener listener =
(ConnectionEventListener) listeners.get(i);
if (connEvent.getId() == ConnectionEvent.CONNECTION_CLOSED) {
listener.connectionClosed(connEvent);
} else if (connEvent.getId() ==
ConnectionEvent.CONNECTION_ERROR_OCCURRED) {
listener.connectionErrorOccurred(connEvent);
} else if (connEvent.getId() ==
ConnectionEvent.LOCAL_TRANSACTION_STARTED) {
listener.localTransactionStarted(connEvent);
} else if (connEvent.getId() ==
ConnectionEvent.LOCAL_TRANSACTION_COMMITTED) {
listener.localTransactionCommitted(connEvent);
} else if (connEvent.getId() ==
ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK) {
listener.localTransactionRolledback(connEvent);
}
}
}
示例2: sendConnectionEvent
import javax.resource.spi.ConnectionEventListener; //导入方法依赖的package包/类
protected void sendConnectionEvent(ConnectionEvent connEvent) {
for (int i = listeners.size() - 1; i >= 0; i--) {
ConnectionEventListener listener =
listeners.get(i);
if (connEvent.getId() == ConnectionEvent.CONNECTION_CLOSED) {
listener.connectionClosed(connEvent);
} else if (connEvent.getId() ==
ConnectionEvent.CONNECTION_ERROR_OCCURRED) {
listener.connectionErrorOccurred(connEvent);
} else if (connEvent.getId() ==
ConnectionEvent.LOCAL_TRANSACTION_STARTED) {
listener.localTransactionStarted(connEvent);
} else if (connEvent.getId() ==
ConnectionEvent.LOCAL_TRANSACTION_COMMITTED) {
listener.localTransactionCommitted(connEvent);
} else if (connEvent.getId() ==
ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK) {
listener.localTransactionRolledback(connEvent);
}
}
}
示例3: fireConnectionEvent
import javax.resource.spi.ConnectionEventListener; //导入方法依赖的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);
}
}
}
示例4: begin
import javax.resource.spi.ConnectionEventListener; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public void begin() throws ResourceException
{
if (txBeginDuration > 0)
{
try
{
Thread.sleep(txBeginDuration);
}
catch (Exception e)
{
// Ignore
}
}
ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.LOCAL_TRANSACTION_STARTED);
for (ConnectionEventListener cel : listeners)
{
cel.localTransactionStarted(ce);
}
}
示例5: localTransactionStart
import javax.resource.spi.ConnectionEventListener; //导入方法依赖的package包/类
protected void localTransactionStart(boolean isSPI) throws ResourceException {
if (!isSPI) {
ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.LOCAL_TRANSACTION_STARTED);
if (listeners != null) {
for (ConnectionEventListener listener : reverse(listeners)) {
listener.localTransactionStarted(event);
}
}
if (listener != null) {
listener.localTransactionStarted(event);
}
}
}
示例6: sendEvent
import javax.resource.spi.ConnectionEventListener; //导入方法依赖的package包/类
/**
* Send an event.
*
* @param event The event to send.
*/
protected void sendEvent(final ConnectionEvent event) {
if (logger.isTraceEnabled()) {
ActiveMQRALogger.LOGGER.trace("sendEvent(" + event + ")");
}
int type = event.getId();
// convert to an array to avoid concurrent modification exceptions
ConnectionEventListener[] list = eventListeners.toArray(new ConnectionEventListener[eventListeners.size()]);
for (ConnectionEventListener l : list) {
switch (type) {
case ConnectionEvent.CONNECTION_CLOSED:
l.connectionClosed(event);
break;
case ConnectionEvent.LOCAL_TRANSACTION_STARTED:
l.localTransactionStarted(event);
break;
case ConnectionEvent.LOCAL_TRANSACTION_COMMITTED:
l.localTransactionCommitted(event);
break;
case ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK:
l.localTransactionRolledback(event);
break;
case ConnectionEvent.CONNECTION_ERROR_OCCURRED:
l.connectionErrorOccurred(event);
break;
default:
throw new IllegalArgumentException("Illegal eventType: " + type);
}
}
}
示例7: sendEvent
import javax.resource.spi.ConnectionEventListener; //导入方法依赖的package包/类
void sendEvent(ConnectionEvent ce)
{
Vector list = (Vector) m_listeners.clone();
int size = list.size();
for (int i = 0; i < size; i++)
{
ConnectionEventListener l =
(ConnectionEventListener) list.elementAt(i);
switch (ce.getId())
{
case ConnectionEvent.CONNECTION_CLOSED:
l.connectionClosed(ce);
break;
case ConnectionEvent.LOCAL_TRANSACTION_STARTED:
l.localTransactionStarted(ce);
break;
case ConnectionEvent.LOCAL_TRANSACTION_COMMITTED:
l.localTransactionCommitted(ce);
break;
case ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK:
l.localTransactionRolledback(ce);
break;
case ConnectionEvent.CONNECTION_ERROR_OCCURRED:
l.connectionErrorOccurred(ce);
break;
default:
throw new IllegalArgumentException("Illegal eventType: " + ce.getId());
}
}
}
示例8: begin
import javax.resource.spi.ConnectionEventListener; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public void begin() throws ResourceException
{
log.trace("begin()");
addTxState(TX_LOCAL_BEGIN);
ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.LOCAL_TRANSACTION_STARTED);
for (ConnectionEventListener cel : listeners)
{
cel.localTransactionStarted(ce);
}
}