All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.guicedee.guicedservlets.websockets.WebSocketsConfiguration Maven / Gradle / Ivy

package com.guicedee.guicedservlets.websockets;

import com.guicedee.guicedinjection.GuiceContext;
import com.guicedee.guicedinjection.interfaces.IGuicePreStartup;
import com.guicedee.guicedservlets.websockets.services.IWebSocketPreConfiguration;

import java.util.ServiceLoader;
import java.util.Set;
import java.util.TreeSet;

public class WebSocketsConfiguration
		implements IGuicePreStartup
{
	@Override
	public void onStartup()
	{
		Set loader = GuiceContext.instance()
		                                                     .getLoader(IWebSocketPreConfiguration.class, true, ServiceLoader.load(IWebSocketPreConfiguration.class));
		Set sortedSet = new TreeSet<>(loader);
		sortedSet.removeIf(preConfiguration -> !preConfiguration.enabled());
		sortedSet.forEach(IWebSocketPreConfiguration::configure);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy