Create a custom callback handler if the application requires a callback (for example, to allow the client framework to provide notification of synchronization results).
import com.sybase.persistence.DefaultCallbackHandler; …… public class Test { public static void main(String[] args) { XXDB.loginToSync(); XXDB.registerCallbackHandler(new MyCallbackHandler()); GenericList sgs = new GenericList( 2 ); sgs.add(SortDB.getSynchronizationGroup("sg1")); sgs.add(SortDB.getSynchronizationGroup("sg2")); XXDB.beginSynchronize(sgs, new SynchronizationNotification()); } } class MyCallbackHandler extends DefaultCallbackHandler { public int onSynchronize(GenericList groups, SynchronizationContext context) { if ( context == null ) { return SynchronizationAction.CANCEL; } if (!(context.getUserContext() instanceof SynchronizationNotification)) { return super.onSynchronize(groups, context); } switch (context.getStatus()) { case SynchronizationStatus.STARTING: return beforeSynchronize(groups); case SynchronizationStatus.FINISHING: return afterSynchronize(groups); default: return SynchronizationAction.CONTINUE; } } private int beforeSynchronize(GenericList groups) { // ..... logic before sync if ( groups == null || groups.size() == 0 ) { return SynchronizationAction.CANCEL; } return SynchronizationAction.CONTINUE; } private int afterSynchronize(GenericList groups) { // ..... logic after sync if ( groups == null || groups.size() == 0 ) { return SynchronizationAction.CANCEL; } return SynchronizationAction.CONTINUE; } }