本文整理汇总了Java中org.atmosphere.cache.UUIDBroadcasterCache类的典型用法代码示例。如果您正苦于以下问题:Java UUIDBroadcasterCache类的具体用法?Java UUIDBroadcasterCache怎么用?Java UUIDBroadcasterCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UUIDBroadcasterCache类属于org.atmosphere.cache包,在下文中一共展示了UUIDBroadcasterCache类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createFramework
import org.atmosphere.cache.UUIDBroadcasterCache; //导入依赖的package包/类
private AtmosphereFramework createFramework() {
final AtmosphereFramework atmosphereFramework = new AtmosphereFramework();
atmosphereFramework.addInitParameter(ApplicationConfig.BROADCASTER_SHARABLE_THREAD_POOLS, "true");
atmosphereFramework.addInitParameter(ApplicationConfig.BROADCASTER_LIFECYCLE_POLICY, "EMPTY");
atmosphereFramework.addInitParameter(ApplicationConfig.BROADCASTER_MESSAGE_PROCESSING_THREADPOOL_MAXSIZE, "10");
atmosphereFramework.addInitParameter(ApplicationConfig.BROADCASTER_ASYNC_WRITE_THREADPOOL_MAXSIZE, "10");
atmosphereFramework.addInitParameter(ApplicationConfig.BROADCASTER_CACHE, UUIDBroadcasterCache.class.getName());
atmosphereFramework.addInitParameter(ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTOR, "true");
atmosphereFramework.addInitParameter(ApplicationConfig.JSR356_MAPPING_PATH, myPath);
atmosphereFramework.init();
atmosphereFramework.getBroadcasterFactory().lookup(myPath, true);
atmosphereFramework.addAtmosphereHandler(myPath, myNotificationHandler, Arrays.asList(
new AtmosphereResourceLifecycleInterceptor(),
new HeartbeatInterceptor(),
new IdleResourceInterceptor(),
new TrackMessageSizeInterceptor()));
return atmosphereFramework;
}
开发者ID:dtretyakov,项目名称:teamcity-tray-notifier,代码行数:21,代码来源:NotificationController.java
示例2: initAtmosphereServlet
import org.atmosphere.cache.UUIDBroadcasterCache; //导入依赖的package包/类
/**
* Initializes Atmosphere.
*/
private void initAtmosphereServlet(ServletContext servletContext) {
log.debug("Registering Atmosphere Servlet");
AtmosphereServlet servlet = new AtmosphereServlet();
Field frameworkField = ReflectionUtils.findField(AtmosphereServlet.class, "framework");
ReflectionUtils.makeAccessible(frameworkField);
NoAnalyticsAtmosphereFramework atmosphereFramework = new NoAnalyticsAtmosphereFramework();
ReflectionUtils.setField(frameworkField, servlet, atmosphereFramework);
ServletRegistration.Dynamic atmosphereServlet =
servletContext.addServlet("atmosphereServlet", servlet);
servletContext.setAttribute("AtmosphereServlet", atmosphereFramework);
atmosphereServlet.setInitParameter("org.atmosphere.cpr.packages", "com.jittrack.gts.web.websocket");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcasterCacheClass", UUIDBroadcasterCache.class.getName());
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcaster.shareableThreadPool", "true");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcaster.maxProcessingThreads", "10");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcaster.maxAsyncWriteThreads", "10");
servletContext.addListener(new org.atmosphere.cpr.SessionSupport());
atmosphereServlet.addMapping("/websocket/*");
atmosphereServlet.setLoadOnStartup(3);
atmosphereServlet.setAsyncSupported(true);
}
开发者ID:sanketbajoria,项目名称:jittrackGTS,代码行数:27,代码来源:WebConfigurer.java
示例3: initAtmosphereServlet
import org.atmosphere.cache.UUIDBroadcasterCache; //导入依赖的package包/类
/**
* Initializes Atmosphere.
*/
private void initAtmosphereServlet(ServletContext servletContext) {
log.debug("Registering Atmosphere Servlet");
AtmosphereServlet servlet = new AtmosphereServlet();
Field frameworkField = ReflectionUtils.findField(AtmosphereServlet.class, "framework");
ReflectionUtils.makeAccessible(frameworkField);
ReflectionUtils.setField(frameworkField, servlet, new NoAnalyticsAtmosphereFramework());
ServletRegistration.Dynamic atmosphereServlet =
servletContext.addServlet("atmosphereServlet", servlet);
atmosphereServlet.setInitParameter("org.atmosphere.cpr.packages", "ch.ithings.demo.web.websocket");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcasterCacheClass", UUIDBroadcasterCache.class.getName());
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcaster.shareableThreadPool", "true");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcaster.maxProcessingThreads", "10");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcaster.maxAsyncWriteThreads", "10");
servletContext.addListener(new org.atmosphere.cpr.SessionSupport());
atmosphereServlet.addMapping("/websocket/*");
atmosphereServlet.setLoadOnStartup(3);
atmosphereServlet.setAsyncSupported(true);
}
开发者ID:thpham,项目名称:ithings-demo,代码行数:24,代码来源:WebConfigurer.java
示例4: initAtmosphereServlet
import org.atmosphere.cache.UUIDBroadcasterCache; //导入依赖的package包/类
/**
* Initializes Atmosphere.
*/
private void initAtmosphereServlet(ServletContext servletContext) {
log.debug("Registering Atmosphere Servlet");
AtmosphereServlet servlet = new AtmosphereServlet();
Field frameworkField = ReflectionUtils.findField(AtmosphereServlet.class, "framework");
ReflectionUtils.makeAccessible(frameworkField);
ReflectionUtils.setField(frameworkField, servlet, new NoAnalyticsAtmosphereFramework());
ServletRegistration.Dynamic atmosphereServlet =
servletContext.addServlet("atmosphereServlet", servlet);
atmosphereServlet.setInitParameter("org.atmosphere.cpr.packages", "com.mycompany.myapp.web.websocket");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcasterCacheClass", UUIDBroadcasterCache.class.getName());
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcaster.shareableThreadPool", "true");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcaster.maxProcessingThreads", "10");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcaster.maxAsyncWriteThreads", "10");
atmosphereServlet.addMapping("/websocket/*");
atmosphereServlet.setLoadOnStartup(3);
atmosphereServlet.setAsyncSupported(true);
}
开发者ID:ravikiran438,项目名称:cevent-app,代码行数:23,代码来源:WebConfigurer.java
示例5: initAtmosphere
import org.atmosphere.cache.UUIDBroadcasterCache; //导入依赖的package包/类
private AtmosphereCoordinator initAtmosphere(Router router, VertxVaadinService service) {
final String bufferSize = String.valueOf(PushConstants.WEBSOCKET_BUFFER_SIZE);
AtmosphereInterceptor trackMessageSize = new TrackMessageSizeInterceptor();
VertxAtmosphere.Builder pushBuilder = new VertxAtmosphere.Builder()
.initParam(ApplicationConfig.BROADCASTER_CACHE, UUIDBroadcasterCache.class.getName())
.initParam(ApplicationConfig.ANNOTATION_PROCESSOR, VoidAnnotationProcessor.class.getName())
.initParam(ApplicationConfig.PROPERTY_SESSION_SUPPORT, "true")
.initParam(ApplicationConfig.MESSAGE_DELIMITER, String.valueOf(PushConstants.MESSAGE_DELIMITER))
.initParam(ApplicationConfig.DROP_ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, "false")
// Disable heartbeat (it does not emit correct events client side)
// https://github.com/Atmosphere/atmosphere-javascript/issues/141
.initParam(ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTORS, HeartbeatInterceptor.class.getName())
.initParam(ApplicationConfig.WEBSOCKET_BUFFER_SIZE, bufferSize)
.initParam(ApplicationConfig.WEBSOCKET_MAXTEXTSIZE, bufferSize)
.initParam(ApplicationConfig.WEBSOCKET_MAXBINARYSIZE, bufferSize)
.initParam(ApplicationConfig.PROPERTY_ALLOW_SESSION_TIMEOUT_REMOVAL, "false")
// Disable Atmosphere's message about commercial support
.initParam("org.atmosphere.cpr.showSupportMessage", "false")
.interceptor(trackMessageSize);
AtmosphereCoordinator atmosphereCoordinator = ExposeAtmosphere.newCoordinator(pushBuilder);
AtmosphereFramework framework = atmosphereCoordinator.framework();
trackMessageSize.configure(framework.getAtmosphereConfig());
VertxPushHandler vertxPushHandler = new VertxPushHandler(service);
vertxPushHandler.setLongPollingSuspendTimeout(framework.getAtmosphereConfig()
.getInitParameter(com.vaadin.server.Constants.SERVLET_PARAMETER_PUSH_SUSPEND_TIMEOUT_LONGPOLLING, -1));
PushAtmosphereHandler pushAtmosphereHandler = new PushAtmosphereHandler();
pushAtmosphereHandler.setPushHandler(vertxPushHandler);
framework.addAtmosphereHandler("/*", pushAtmosphereHandler);
atmosphereCoordinator.ready();
service.addServiceDestroyListener(event -> atmosphereCoordinator.shutdown());
return atmosphereCoordinator;
}
开发者ID:mcollovati,项目名称:vaadin-vertx-samples,代码行数:41,代码来源:VertxVaadin.java
示例6: configureAthmosphere
import org.atmosphere.cache.UUIDBroadcasterCache; //导入依赖的package包/类
private void configureAthmosphere(AtmosphereServlet servlet, ServletContext servletContext) {
ServletRegistration.Dynamic atmosphereServlet = servletContext.addServlet("atmosphereServlet", servlet);
atmosphereServlet.setInitParameter(ApplicationConfig.ANNOTATION_PACKAGE, ToastService.class.getPackage().getName());
atmosphereServlet.setInitParameter(ApplicationConfig.BROADCASTER_CACHE, UUIDBroadcasterCache.class.getName());
atmosphereServlet.setInitParameter(ApplicationConfig.BROADCASTER_SHARABLE_THREAD_POOLS, "true");
atmosphereServlet.setInitParameter(ApplicationConfig.BROADCASTER_MESSAGE_PROCESSING_THREADPOOL_MAXSIZE, "10");
atmosphereServlet.setInitParameter(ApplicationConfig.BROADCASTER_ASYNC_WRITE_THREADPOOL_MAXSIZE, "10");
servletContext.addListener(new org.atmosphere.cpr.SessionSupport());
atmosphereServlet.addMapping("/websocket/*");
atmosphereServlet.setLoadOnStartup(0);
atmosphereServlet.setAsyncSupported(true);
}
开发者ID:AndreasKl,项目名称:springboot-angular-atmosphere-quickstart,代码行数:13,代码来源:WebConfigurer.java
示例7: configure
import org.atmosphere.cache.UUIDBroadcasterCache; //导入依赖的package包/类
@Override
protected void configure() {
params.put("suspend.seconds", "20");
params.put("org.atmosphere.cpr.broadcasterClass", BounceProxyBroadcaster.class.getName());
params.put("org.atmosphere.cpr.broadcasterCacheClass", UUIDBroadcasterCache.class.getName());
params.put("org.atmosphere.useBlocking", "false");
params.put("org.atmosphere.cpr.broadcasterLifeCyclePolicy", "NEVER");
params.put("org.atmosphere.cpr.broadcaster.shareableThreadPool", "true");
params.put("com.sun.jersey.config.feature.DisableWADL", "true");
params.put("org.atmosphere.cpr.BroadcasterCache.strategy", "beforeFilter");
bind(new TypeLiteral<Map<String, String>>() {
}).annotatedWith(Names.named("org.atmosphere.guice.AtmosphereGuiceServlet.properties")).toInstance(params);
}
开发者ID:bmwcarit,项目名称:joynr,代码行数:16,代码来源:AtmosphereModule.java
示例8: BounceProxyBroadcaster
import org.atmosphere.cache.UUIDBroadcasterCache; //导入依赖的package包/类
public BounceProxyBroadcaster(String name, AtmosphereConfig config) {
super(name, config);
UUIDBroadcasterCache broadcasterCache = (UUIDBroadcasterCache) bc.getBroadcasterCache();
broadcasterCache.setClientIdleTime(TimeUnit.DAYS.toMillis(7));
// order of filters matters
bc.addFilter(new ExpirationFilter());
bc.addFilter(new MessageSerializationFilter());
}
开发者ID:bmwcarit,项目名称:joynr,代码行数:12,代码来源:BounceProxyBroadcaster.java
示例9: createChannel
import org.atmosphere.cache.UUIDBroadcasterCache; //导入依赖的package包/类
/**
* Creates a long polling channel.
*
* @param ccid
* the identifier of the channel
* @param atmosphereTrackingId
* the tracking ID of the channel
* @return the path segment for the channel. The path, appended to the base
* URI of the channel service, can be used to post messages to the
* channel.
*/
public String createChannel(String ccid, String atmosphereTrackingId) {
throwExceptionIfTrackingIdnotSet(atmosphereTrackingId);
log.info("CREATE channel for cluster controller: {} trackingId: {} ", ccid, atmosphereTrackingId);
Broadcaster broadcaster = null;
// look for an existing broadcaster
BroadcasterFactory defaultBroadcasterFactory = BroadcasterFactory.getDefault();
if (defaultBroadcasterFactory == null) {
throw new JoynrHttpException(500, 10009, "broadcaster was null");
}
broadcaster = defaultBroadcasterFactory.lookup(Broadcaster.class, ccid, false);
// create a new one if none already exists
if (broadcaster == null) {
broadcaster = defaultBroadcasterFactory.get(BounceProxyBroadcaster.class, ccid);
}
// avoids error where previous long poll from browser got message
// destined for new long poll
// especially as seen in js, where every second refresh caused a fail
for (AtmosphereResource resource : broadcaster.getAtmosphereResources()) {
if (resource.uuid() != null && resource.uuid().equals(atmosphereTrackingId)) {
resource.resume();
}
}
UUIDBroadcasterCache broadcasterCache = (UUIDBroadcasterCache) broadcaster.getBroadcasterConfig()
.getBroadcasterCache();
broadcasterCache.activeClients().put(atmosphereTrackingId, System.currentTimeMillis());
// BroadcasterCacheInspector is not implemented corrected in Atmosphere
// 1.1.0RC4
// broadcasterCache.inspector(new MessageExpirationInspector());
return "/channels/" + ccid + "/";
}
开发者ID:bmwcarit,项目名称:joynr,代码行数:51,代码来源:LongPollingMessagingDelegate.java
示例10: configureCache
import org.atmosphere.cache.UUIDBroadcasterCache; //导入依赖的package包/类
/**
* Configure what cache we want to use
* @param config
*/
public void configureCache(BroadcasterConfig config){
config.setBroadcasterCache(new UUIDBroadcasterCache());
config.getBroadcasterCache().configure(broadcaster.getBroadcasterConfig());
config.getBroadcasterCache().start();
}
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:10,代码来源:ResourceStateChangeListener.java
注:本文中的org.atmosphere.cache.UUIDBroadcasterCache类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论