• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SelectorThread类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.grizzly.http.SelectorThread的典型用法代码示例。如果您正苦于以下问题:Java SelectorThread类的具体用法?Java SelectorThread怎么用?Java SelectorThread使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SelectorThread类属于com.sun.grizzly.http包,在下文中一共展示了SelectorThread类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: runServer

import com.sun.grizzly.http.SelectorThread; //导入依赖的package包/类
private static void runServer(RefAppConfigurator configurator) throws IOException, InterruptedException {
    URI baseUri = UriBuilder.fromUri("http://localhost/").port(configurator.getServerPort()).build();

    Map<String, String> params = new HashMap<String, String>();
    params.put("com.sun.jersey.config.property.packages", "com.comcast.xfinity.sirius.refapplication.endpoints");

    SelectorThread thread = GrizzlyWebContainerFactory.create(baseUri, params);

    System.out.println();
    System.out.println("Server fired up, using akka over TCP. Akka address for this server:");
    System.out.println(configurator.getAkkaPath());
    System.out.println("Hit ctrl-c to quit.");
    try {
        while (true) {
            // put the local thread to sleep, let grizzly do its thing
            Thread.sleep(1000L);
        }
    } finally {
        thread.stopEndpoint();
    }
}
 
开发者ID:Comcast,项目名称:sirius-reference-app,代码行数:22,代码来源:StartServer.java


示例2: main

import com.sun.grizzly.http.SelectorThread; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
  // TODO(markf): Eventually we'll figure out how to appropriately start and stop the server when
  // it's run in a production environment.   For now, just kill the process

  CmdLineParser cmdLineParser = new CmdLineParser(commandLineOptions);
  try {
    cmdLineParser.parseArgument(args);
  } catch (CmdLineException e) {
    LOG.severe(e.getMessage());
    cmdLineParser.printUsage(System.err);
    System.exit(1);
  }

  // Now that the command line options have been processed, we can create the buildExecutor.
  buildExecutor = new NonQueuingExecutor(commandLineOptions.maxSimultaneousBuilds);

  int port = commandLineOptions.port;
  SelectorThread threadSelector = GrizzlyServerFactory.create("http://localhost:" + port + "/");
  String hostAddress = InetAddress.getLocalHost().getHostAddress();
  LOG.info("App Inventor Build Server - Version: " + GitBuildId.getVersion());
  LOG.info("App Inventor Build Server - Git Fingerprint: " + GitBuildId.getFingerprint());
  LOG.info("Running at: http://" + hostAddress + ":" + port + "/buildserver");
  if (commandLineOptions.maxSimultaneousBuilds == 0) {
    LOG.info("Maximum simultanous builds = unlimited!");
  } else {
    LOG.info("Maximum simultanous builds = " + commandLineOptions.maxSimultaneousBuilds);
  }
  LOG.info("Visit: http://" + hostAddress + ":" + port +
    "/buildserver/health for server health");
  LOG.info("Visit: http://" + hostAddress + ":" + port +
    "/buildserver/vars for server values");
  LOG.info("Server running");
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:34,代码来源:BuildServer.java


示例3: startServer

import com.sun.grizzly.http.SelectorThread; //导入依赖的package包/类
protected static SelectorThread startServer() throws IOException {
    final Map<String, String> initParams = new HashMap<String, String>();

    initParams.put("com.sun.jersey.config.property.packages",
            "com.melon");

    System.out.println("Starting grizzly...");
    SelectorThread threadSelector = GrizzlyWebContainerFactory.create(BASE_URI, initParams);
    return threadSelector;
}
 
开发者ID:ansafari,项目名称:melon,代码行数:11,代码来源:Main.java


示例4: main

import com.sun.grizzly.http.SelectorThread; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
    SelectorThread threadSelector = startServer();
    System.out.println(String.format("Jersey app started with WADL available at "
                    + "%sapplication.wadl\nHit enter to stop it...",
            BASE_URI));
    System.in.read();
    threadSelector.stopEndpoint();
}
 
开发者ID:ansafari,项目名称:melon,代码行数:9,代码来源:Main.java


示例5: getSelectorThread

import com.sun.grizzly.http.SelectorThread; //导入依赖的package包/类
public static SelectorThread getSelectorThread(Class<?> applicationConfigClass,
		String testServerUri, int testServerPort,
		String testContextPath, String testServletPath, String[] springContextFiles, boolean enableJPA)
				throws IllegalArgumentException, IOException {
	final URI baseUri = UriBuilder.fromUri(testServerUri).port(testServerPort).build();
	
	final ServletAdapter adapter = initRestTestServletAdapter(applicationConfigClass, testServerPort,
			testContextPath, testServletPath, enableJPA);
	
	adapter.addContextParameter(ContextLoader.CONFIG_LOCATION_PARAM,
			StringUtils.arrayToCommaDelimitedString(springContextFiles));
	
	return GrizzlyServerFactory.create(baseUri, adapter);
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:15,代码来源:RestTestUtils.java


示例6: startWebServices

import com.sun.grizzly.http.SelectorThread; //导入依赖的package包/类
public static void startWebServices(final String baseUri) throws IOException, IllegalArgumentException {
    final Map<String, String> initParams = new HashMap<String, String>();
    initParams.put("com.sun.jersey.config.property.packages", "org.caboclo.webservices");
    System.out.println("Starting backup server on " + baseUri);
    SelectorThread threadSelector = GrizzlyWebContainerFactory.create(baseUri, initParams);
    System.in.read();
    threadSelector.stopEndpoint();
    System.exit(0);
}
 
开发者ID:modcs,项目名称:caboclo,代码行数:10,代码来源:WebServicesMain.java


示例7: main

import com.sun.grizzly.http.SelectorThread; //导入依赖的package包/类
/**
 * Main method.
 * 
 * @param args
 * @throws IOException
 */
public static void main(String[] args) throws IOException {
	final SelectorThread server = startServer();
	System.out.println(String.format(
			"Jersey app started with WADL available at "
					+ "%sapplication.wadl\nHit enter to stop it...",
			BASE_URI));
	System.in.read();
	server.stopEndpoint();
}
 
开发者ID:vdialani,项目名称:CloudComputing,代码行数:16,代码来源:App.java


示例8: startServer

import com.sun.grizzly.http.SelectorThread; //导入依赖的package包/类
private static SelectorThread startServer()
		throws IllegalArgumentException, IOException {
	// TODO Auto-generated method stub
	Map<String, String> initParams = new HashMap<String, String>();
	initParams.put("com.sun.jersey.config.property.packages",
			"course.cloud.computing.rest");
	SelectorThread factory = GrizzlyWebContainerFactory.create(BASE_URI, initParams);
	return factory;
}
 
开发者ID:vdialani,项目名称:CloudComputing,代码行数:10,代码来源:App.java


示例9: setup

import com.sun.grizzly.http.SelectorThread; //导入依赖的package包/类
@Before
public void setup() {
    sslConfig = mock(SSLConfig.class);
    adapter = mock(Adapter.class);
    springComponentProviderFactory = mock(SpringComponentProviderFactory.class);
    ResourceConfig resourceConfig = mock(ResourceConfig.class);
    selectorThread = mock(SelectorThread.class);

    webServer = mock(GrizzlyWebServer.class);
    when(webServer.getSelectorThread()).thenReturn(selectorThread);

    PowerMockito.mockStatic(ContainerFactory.class);
    when(ContainerFactory.createContainer(eq(Adapter.class), eq(resourceConfig), isA(SpringComponentProviderFactory.class))).thenReturn(adapter);

    pisssHttpsServer = new PisssHttpsServer() {
        @Override
        protected GrizzlyWebServer newGrizzlyWebServer(String path) {
            assertThat(path, equalTo("https://localhost:8883/"));
            return webServer;
        }

        @Override
        protected SSLConfig newSSLConfig() {
            return sslConfig;
        }

        @Override
        protected SpringComponentProviderFactory newSpringComponentProviderFactory() {
            return springComponentProviderFactory;
        }
    };
    pisssHttpsServer.setKeyStoreLocation(keystoreLocation);
    pisssHttpsServer.setPassword(keystorePassword);
    pisssHttpsServer.setResourceConfig(resourceConfig);
}
 
开发者ID:barnyard,项目名称:pi,代码行数:36,代码来源:PisssHttpsServerTest.java


示例10: execute

import com.sun.grizzly.http.SelectorThread; //导入依赖的package包/类
public SelectorThread execute() throws IOException {
    final Map<String, String> initParams = new HashMap<String, String>();

    initParams.put("com.sun.jersey.config.property.packages",
                   "org.apache.zookeeper.server.jersey.resources");

    System.out.println("Starting grizzly...");
    SelectorThread threadSelector =
        GrizzlyWebContainerFactory.create(baseUri, initParams);

    return threadSelector;
}
 
开发者ID:prodigeni,项目名称:zookeeper.dsc,代码行数:13,代码来源:RestMain.java


示例11: closeSelectorThread

import com.sun.grizzly.http.SelectorThread; //导入依赖的package包/类
public static void closeSelectorThread(SelectorThread selectorThread) {
	selectorThread.stopEndpoint();
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:4,代码来源:RestTestUtils.java


示例12: main

import com.sun.grizzly.http.SelectorThread; //导入依赖的package包/类
public static void main(String[] args) {
          
    // static content is linked from here
    GrizzlyWebServer server = new GrizzlyWebServer(8010);
    
    
    
    //For very slow response extractors:
    SelectorThread st = server.getSelectorThread();
    st.setTransactionTimeout(700000);
    
    
   
    //create UI resources
    ServletAdapter ui = new ServletAdapter();
    ui.addInitParameter(
          "javax.ws.rs.Application",
          "fr.eurecom.hotspots.web.hypertext.RegisterUI");
    ui.setServletInstance(new ServletContainer());

    // REST resources       
    ServletAdapter api = new ServletAdapter();
    api.addInitParameter(
          "javax.ws.rs.Application",
          "fr.eurecom.hotspots.web.api.RegisterAPI");
    api.setContextPath("/api");
    api.setServletInstance(new ServletContainer());
    

    
    // static content adapter
    ServletAdapter staticContent = new ServletAdapter("ui");
    staticContent.setContextPath("/");
    staticContent.setHandleStaticResources(true);
            
    // register all above defined adapters
    server.addGrizzlyAdapter(api, new String[] {"/api"});
    server.addGrizzlyAdapter(staticContent, new String[] {"/"});
    
    
          
    // let's Grizzly run
    try {
        server.start();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:jluisred,项目名称:HotSpots,代码行数:49,代码来源:Server.java



注:本文中的com.sun.grizzly.http.SelectorThread类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Option类代码示例发布时间:2022-05-22
下一篇:
Java FlowExecutionRepositoryException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap