Sniffer exposes the eXtremeDB recovery API used to inspect live database connections, detect stale or dead connections, and trigger cleanup in shared-memory or other multi-process configurations. It is primarily intended for watchdog-style recovery code rather than normal database access.
public class Sniffer
{
public const int MCO_SNIFFER_INSPECT_ACTIVE_CONNECTIONS = 0x00;
public const int MCO_SNIFFER_INSPECT_ACTIVE_TRANSACTIONS = 0x01;
public const int MCO_SNIFFER_INSPECT_HANGED_TRANSACTIONS = 0x02;
public interface IConnIterator
{
bool IsConnectionAlive(byte[] context, long transNo);
}
public Sniffer(Connection con);
public void IterateConnections(IConnIterator iterator, int policy);
public bool IsProcessAlive(int procID);
public static bool IsProcessAlive(Connection con, int procID);
public static bool IsProcessAlive(Database db, int procID);
public int GetCurrentProcessID();
public static int GetCurrentProcessID(Connection con);
public static int GetCurrentProcessID(Database db);
public byte[] ProcessIDtoBytes(int procID);
public static byte[] ProcessIDtoBytes(Connection con, int procID);
public static byte[] ProcessIDtoBytes(Database db, int procID);
public int BytesToProcessID(byte[] connectionContext);
public static int BytesToProcessID(Connection con, byte[] connectionContext);
public static int BytesToProcessID(Database db, byte[] connectionContext);
public int GetProcessIDSize();
public static int GetProcessIDSize(Connection con);
public static int GetProcessIDSize(Database db);
}
Sniffer classMCO_SNIFFER_INSPECT_ACTIVE_CONNECTIONS
MCO_SNIFFER_INSPECT_ACTIVE_TRANSACTIONS
MCO_SNIFFER_INSPECT_HANGED_TRANSACTIONS
IConnIterator interfaceIterateConnections() to decide whether an inspected connection is still alive.IConnIterator.IsConnectionAlive(byte[] context, long transNo)
context is the raw connection-context buffer stored with that connection, and transNo is the current transaction number. Return true if the connection is alive, or false to report the connection as dead and allow recovery cleanup to proceed for that connection.Sniffer(Connection con)
IterateConnections(IConnIterator, int)
IsProcessAlive(... overloads)
GetCurrentProcessID(... overloads)
ProcessIDtoBytes(... overloads)
mco_process_t. This is the form commonly stored in the connection context when sniffer-based recovery is used.BytesToProcessID(... overloads)
mco_process_t. Throws ArgumentException if the buffer size does not match the expected context size.GetProcessIDSize(... overloads)
Database.Parameters.ConnectionContextSize when process identifiers are stored in connection contexts for sniffer-based recovery.Database.Parameters.ConnectionContextSize to Sniffer.GetProcessIDSize(...) before opening the database, then create each connection with Sniffer.ProcessIDtoBytes(...) as its context.Sniffer on that connection, periodically call IterateConnections(), and use IsProcessAlive() inside IConnIterator.IsConnectionAlive() to decide whether cleanup is needed.