Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (中文) » MobiLink - 服务器管理 » MobiLink 服务器 API » 使用 Java 语言编写同步脚本 » 用于 Java 的 MobiLink 服务器 API 参考

 

SynchronizationException 类

语法
public ianywhere.ml.script.SynchronizationException
注释

抛出此异常说明出现了使当前同步无法完成的错误状况。这强制 MobiLink 服务器回退。

成员

ianywhere.ml.script.SynchronizationException 的所有成员,包括所有继承的成员。

示例

以下代码是一个函数,可在发生问题时抛出 SynchronizationException,从而致使 MobiLink 服务器回退。

public void handleUpload(UploadData ud)
    throws SQLException, IOException, SynchronizationException
{

    UploadedTableData tables[] = ud.getUploadedTables();

    for (int i = 0; i < tables.length; i++) {
        UploadedTableData currentTable = tables[i];
        println("table " + java.lang.Integer.toString(i)
            + " name: " + currentTable.getName());

        // Print out delete result set.
        println("Deletes");
        printRSInfo(currentTable.getDeletes());

        // Print out insert result set.
        println("Inserts");
        printRSInfo(currentTable.getInserts());

        // print out update result set
        println("Updates");
        printUpdateRSInfo(currentTable.getUpdates());

        if (/* Reason for Sync failure */) {
            throw new SynchronizationException("Sync Failed");
        }
    }
}

SynchronizationException 构造函数