@Local public void cyclic(long interval, Callable<Boolean> toRun) { if ( ! isStopped() ) { Boolean res = true; try { res = toRun.call(); } catch (Exception e) { Log.Warn(this,e); } if (res) self().delayed(interval,() -> cyclic(interval,toRun) ); } }
@Local public void cyclic(long interval, Callable<Boolean> toRun) { if ( ! isStopped() ) { Boolean res = true; try { res = toRun.call(); } catch (Exception e) { Log.Warn(this,e); } if (res) self().delayed(interval,() -> cyclic(interval,toRun) ); } }
public static IPromise<Object> connectClient(ConnectableActor connectable, Consumer<Actor> disconnectCallback) { Promise p = promise(); connectable.connect(null, disconnectCallback ).then( (r,e) -> { if ( r != null ) { getPinger().cyclic(CLIENT_PING_INTERVAL_MS, () -> { long[] paids = null; if ( r.__clientConnection != null ) paids = r.__clientConnection.getRemotedActorIds(); // System.out.println("remoted ids:"+ Arrays.toString(paids)); // System.out.println("published ids:"+ Arrays.toString(r.__clientConnection.getPublishedActorIds())); r.router$clientPing(System.currentTimeMillis(),paids); return true; }); } p.complete(r,e); }); return p; }
public static IPromise<Object> connectClient(ConnectableActor connectable, Consumer<Actor> disconnectCallback) { Promise p = promise(); connectable.connect(null, disconnectCallback ).then( (r,e) -> { if ( r != null ) { getPinger().cyclic(CLIENT_PING_INTERVAL_MS, () -> { long[] paids = null; if ( r.__clientConnection != null ) paids = r.__clientConnection.getRemotedActorIds(); // System.out.println("remoted ids:"+ Arrays.toString(paids)); // System.out.println("published ids:"+ Arrays.toString(r.__clientConnection.getPublishedActorIds())); r.router$clientPing(System.currentTimeMillis(),paids); return true; }); } p.complete(r,e); }); return p; }