Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 import java.util.List;
 import java.util.Map;
Acts like a communications satellite in orbit over the attached clients: receives the stream of orientation events from all attached clients, aggregates them, and relays them back to the clients.

Jonathan Fuerth <>
public class OrientationDataSatellite {
  public void startRedistributionService() {
    executor.scheduleWithFixedDelay(new Runnable() {
      public void run() {
        // TODO remove clients who have not sent an update for a while
        List<OrientationEventclientOrientationList =
            new ArrayList<OrientationEvent>(.values());
        .fire(new AllClientOrientations(clientOrientationList));
        long cutoffTime = System.currentTimeMillis() - 2000;
        while (it.hasNext()) {
          Map.Entry<StringOrientationEvententry =;
          if (entry.getValue().getTimestamp() < cutoffTime) {
    }, 1000, 250, .);
New to GrepCode? Check out our FAQ X