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

SQL Anywhere 11.0.1 (日本語) » Ultra Light J » Ultra Light J リファレンス » Ultra Light J API リファレンス

 

SyncObserver インタフェース

同期の進行状況の情報を受け取ります。

構文
public SyncObserver
備考

同期中に進行状況のレポートを受け取るには、そのタスクを実行する新しいクラスを作成し、setSyncObserver 関数を使用して実装します。

次の例は、単純な SyncObserver インタフェースを示しています。

class MyObserver implements SyncObserver {
    public boolean syncProgress(int state, SyncResult result) {
        System.out.println(
            "sync progress state = " + state
            + " bytes sent = " + result.getSentByteCount()
            + " bytes received = " + result.getReceivedByteCount()
        );
        return false;   // Always continue synchronization.
    }
    public MyObserver() {} // The default constructor.
}

上記の observer クラスは次のようにして有効にします。

// J2ME Sample
Connection conn;
ConfigRecordStore config = DatabaseManager.createConfigurationRecordStore(
    "test.ulj"
    );
try {
    conn = DatabaseManager.connect(config);
} catch(ULjException ex) {
    conn = DatabaseManager.createDatabase(config);
    // Create the schema here.
}
SyncParms.setSyncObserver(new MyObserver());
メンバ

SyncObserver のすべてのメンバ (継承されたメンバも含みます) を以下に示します。


syncProgress メソッド