public abstract class Channel
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected Connection |
connection
The parent connection for this channel.
|
protected boolean |
valid
The valid channel flag.
|
Modifier | Constructor and Description |
---|---|
protected |
Channel(Connection con)
Creates a new communications channel for the specified connection.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
commit()
Commits any pending changes.
|
Connection |
getConnection()
Returns the connection that this channel belongs to.
|
void |
invalidate()
Marks the channel as invalid, meaning that it should no longer
be used and is scheduled for destruction when returned to the
parent connection.
|
protected abstract boolean |
isPoolable()
Checks if this channel can be pooled (i.e.
|
boolean |
isValid()
Checks if this channel is considered valid.
|
protected abstract void |
release()
Releases and passivates the channel.
|
protected abstract void |
reserve()
Reserves and activates the channel.
|
abstract void |
rollback()
Rolls any pending changes back.
|
abstract void |
validate()
Checks if the channel connection is still valid.
|
protected boolean valid
protected Connection connection
protected Channel(Connection con)
con
- the parent connectionpublic boolean isValid()
protected abstract boolean isPoolable()
public Connection getConnection()
protected abstract void reserve() throws ConnectionException
ConnectionException
- if the channel couldn't be
reserved (channel will be destroyed)protected abstract void release() throws ConnectionException
ConnectionException
- if the channel couldn't be
released (channel will be destroyed)public abstract void validate()
isValid()
,
invalidate()
public void invalidate()
isValid()
,
validate()
public abstract void commit()
In case of error, a subclass should log the message and invalidate the channel.
public abstract void rollback()
In case of error, a subclass should log the message and invalidate the channel.