i-net JDBC drivers for Oracle Server

com.inet.pool
Interface TAFConnection


public interface TAFConnection

This interface allows add and remove FailoverListeners, that are required for the monitored failover. In oracle environment it is also known as TAF. This interface is implemented by Connections, which can be received from com.inet.pool.PoolDriver, com.inet.ora.PDataSource, com.inet.tds.PDataSource, com.inet.syb.PDataSource and com.inet.drda.PDataSource.
example code:
//receive a Connection
Class.forName("com.inet.pool.PoolDriver");
Connection con = DriverManager.getConnection("jdbc:inetpool:inetora:localhost?database=orcl", "scott", "tiger");

//add a FailoverListener
FailoverListener fl = new samples.CounteredFailoverListener(99);
((TAFConnection)con).addFailoverListener(fl);

//remove a FailoverListener
((TAFConnection)con).removeFailoverListener(fl);

//remove all FailoverListener
((TAFConnection)con).removeAllFailoverListener();

//get all registered FailoverListener
FailoverListener[] fls = getFailoverListener();

See Also:
FailoverListener, FailoverEvent

Method Summary
 void addFailoverListener(FailoverListener listener)
          Use this method to register a FailoverListener.
 FailoverListener[] getFailoverListener()
          Returns the registered FailoverListeners.
 void removeAllFailoverListener()
          Removes all FailoverListener from that Connection.
 void removeFailoverListener(FailoverListener listener)
          Use this method to remove a registered FailoverListener.
 

Method Detail

removeFailoverListener

public void removeFailoverListener(FailoverListener listener)
Use this method to remove a registered FailoverListener. The Connection must be a Connection received from:
com.inet.pool.PoolDriver, com.inet.ora.PDataSource, com.inet.tds.PDataSource, com.inet.syb.PDataSource, com.inet.drda.PDataSource.
All these Connections implements the interface com.inet.pool.TAFConnection.

Parameters:
listener - an from class that implements the FailoverListener to handle the FailoverEvents.
See Also:
addFailoverListener(FailoverListener), FailoverListener, FailoverEvent

addFailoverListener

public void addFailoverListener(FailoverListener listener)
Use this method to register a FailoverListener. By adding a FailoverListener it is possible to detect a broken Connection in background of a running application and to initiate the reconnection mechanism. The FailoverListener can get three different Events which indicates if a broken Connection was detected or if reconnecting was successfull or if reconnection failed. In depend of the return value from FailoverListener, reconnection will be initiated or reinitiated or aborted. If reconnection was successfull, all Statements, PreparedStatements and CallableStatements are also restored in that way that you can reexecute them. Set parameter for PreparesStatements and CallableStatements will be set again. The Connection must be a Connection received from inet PoolDriver.
The FailoverListener decides whether the Connection tries to reconnect or not. The Connection must be a Connection received from:
com.inet.pool.PoolDriver, com.inet.ora.PDataSource, com.inet.tds.PDataSource, com.inet.syb.PDataSource, com.inet.drda.PDataSource.
All these Connections implements the interface com.inet.pool.TAFConnection.

Parameters:
listener - an object from class that implements the FailoverListener to handle the FailoverEvents.
See Also:
removeFailoverListener(FailoverListener), FailoverListener, FailoverEvent

getFailoverListener

public FailoverListener[] getFailoverListener()
Returns the registered FailoverListeners. If no FailoverListener is registered, the return value is null

Returns:
the registered FailoverListeners.

removeAllFailoverListener

public void removeAllFailoverListener()
Removes all FailoverListener from that Connection.


i-net JDBC drivers for Oracle Server


copyright by i-net software