本文整理汇总了Java中javax.resource.spi.ConnectionEvent.CONNECTION_CLOSED属性的典型用法代码示例。如果您正苦于以下问题:Java ConnectionEvent.CONNECTION_CLOSED属性的具体用法?Java ConnectionEvent.CONNECTION_CLOSED怎么用?Java ConnectionEvent.CONNECTION_CLOSED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.resource.spi.ConnectionEvent
的用法示例。
在下文中一共展示了ConnectionEvent.CONNECTION_CLOSED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onClose
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();
}
}
}
示例2: onClose
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();
}
}
}
示例3: connectionClosed
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);
}
}
示例4: sendConnectionEvent
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);
}
}
}
示例5: sendConnectionEvent
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);
}
}
}
示例6: connectionClosed
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);
}
}
示例7: closeHandle
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);
}
示例8: sendEvent
void sendEvent(final ConnectionEvent event) {
int type = event.getId();
if (log.isDebugEnabled()) {
log.debug("Sending connection event: " + type);
}
// convert to an array to avoid concurrent modification exceptions
ConnectionEventListener[] list =
(ConnectionEventListener[]) listeners.toArray(new ConnectionEventListener[listeners.size()]);
for (int i = 0; i < list.length; i++) {
switch (type) {
case ConnectionEvent.CONNECTION_CLOSED:
list[i].connectionClosed(event);
break;
case ConnectionEvent.LOCAL_TRANSACTION_STARTED:
list[i].localTransactionStarted(event);
break;
case ConnectionEvent.LOCAL_TRANSACTION_COMMITTED:
list[i].localTransactionCommitted(event);
break;
case ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK:
list[i].localTransactionRolledback(event);
break;
case ConnectionEvent.CONNECTION_ERROR_OCCURRED:
list[i].connectionErrorOccurred(event);
break;
default :
throw new IllegalArgumentException("Illegal eventType: " + type);
}
}
}
示例9: closeHandle
/**
* 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);
}
}
示例10: close
public void close(TransactionAssistant handle) {
ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
event.setConnectionHandle(handle);
for(ConnectionEventListener l : listeners){
l.connectionClosed(event);
}
}
示例11: sendEvent
/**
* 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);
}
}
}
示例12: sendEvent
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());
}
}
}
示例13: closeHandle
/**
* Close handle
*
* @param handle
* The handle
*/
void closeHandle(VertxConnectionImpl handle) {
ConnectionEvent event = new ConnectionEvent(this,
ConnectionEvent.CONNECTION_CLOSED);
event.setConnectionHandle(handle);
for (ConnectionEventListener cel : listeners) {
cel.connectionClosed(event);
}
}
示例14: closeHandle
/**
*
* @param handle
*/
public void closeHandle(BeanstalkdConnectionImpl handle) {
try {
ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
event.setConnectionHandle(handle);
for (ConnectionEventListener cel : listeners) {
cel.connectionClosed(event);
}
} catch (Exception ex) {
System.out.println(ex.getMessage());
ex.printStackTrace(System.err);
LOG.error("Error while closing connection", ex);
}
}
示例15: closeHandle
/**
* Close handle
*
* @param handle The handle
*/
void closeHandle(UnifiedSecurityConnection handle)
{
connectionSet.remove(handle);
ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
event.setConnectionHandle(handle);
List<ConnectionEventListener> copy = new ArrayList<ConnectionEventListener>(listeners);
for (ConnectionEventListener cel : copy)
{
cel.connectionClosed(event);
}
}