use of org.apache.geode.internal.ra.GFConnectionImpl in project geode by apache.
the class JCAManagedConnection method cleanup.
@Override
public void cleanup() throws ResourceException {
synchronized (this.connections) {
Iterator<GFConnectionImpl> iterator = this.connections.iterator();
while (iterator.hasNext()) {
GFConnectionImpl connection = iterator.next();
connection.invalidate();
iterator.remove();
}
}
if (this.localTransaction == null || this.localTransaction.transactionInProgress()) {
if (this.initialized && !this.cache.isClosed()) {
this.localTransaction = new JCALocalTransaction(this.cache, this.transactionManager);
} else {
this.localTransaction = new JCALocalTransaction();
}
}
}
use of org.apache.geode.internal.ra.GFConnectionImpl in project geode by apache.
the class JCAManagedConnection method destroy.
@Override
public void destroy() throws ResourceException {
synchronized (this.connections) {
Iterator<GFConnectionImpl> iterator = this.connections.iterator();
while (iterator.hasNext()) {
GFConnectionImpl connection = iterator.next();
connection.invalidate();
iterator.remove();
}
}
this.transactionManager = null;
this.cache = null;
this.localTransaction = null;
this.listeners.clear();
}
use of org.apache.geode.internal.ra.GFConnectionImpl in project geode by apache.
the class JCAManagedConnection method getConnection.
@Override
public Object getConnection(Subject arg0, ConnectionRequestInfo arg1) throws ResourceException {
if (!this.initialized || this.cache.isClosed()) {
init();
}
LogWriter logger = this.cache.getLogger();
if (logger.fineEnabled()) {
logger.fine("JCAManagedConnection:getConnection. Returning new Connection");
}
GFConnectionImpl connection = new GFConnectionImpl(this);
this.connections.add(connection);
return connection;
}
use of org.apache.geode.internal.ra.GFConnectionImpl in project geode by apache.
the class JCAManagedConnection method onError.
private void onError(Exception e) {
// TODO: currently unused
this.localTransaction = null;
synchronized (this.connections) {
Iterator<GFConnectionImpl> iterator = this.connections.iterator();
while (iterator.hasNext()) {
GFConnectionImpl connection = iterator.next();
connection.invalidate();
synchronized (this.listeners) {
ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_ERROR_OCCURRED, e);
event.setConnectionHandle(connection);
for (ConnectionEventListener listener : this.listeners) {
listener.connectionErrorOccurred(event);
}
}
iterator.remove();
}
}
}
Aggregations