Code example for ConcurrentSkipListSet

0
 * for writes to the client. 
 */ 
public class WsWriteTimeout implements BackgroundProcess { 
 
    private final Set<WsRemoteEndpointImplServer> endpoints =
            new ConcurrentSkipListSet<>(new EndpointComparator());
    private final AtomicInteger count = new AtomicInteger(0);
    private int backgroundProcessCount = 0;
    private volatile int processPeriod = 1;
 
    @Override 
    public void backgroundProcess() { 
        // This method gets called once a second. 
        backgroundProcessCount ++;
 
        if (backgroundProcessCount >= processPeriod) {
            backgroundProcessCount = 0;
 
            long now = System.currentTimeMillis();
            Iterator<WsRemoteEndpointImplServer> iter = endpoints.iterator();
            while (iter.hasNext()) {