当前位置: 首页>>代码示例>>Java>>正文


Java RestExpress.awaitShutdown方法代码示例

本文整理汇总了Java中org.restexpress.RestExpress.awaitShutdown方法的典型用法代码示例。如果您正苦于以下问题:Java RestExpress.awaitShutdown方法的具体用法?Java RestExpress.awaitShutdown怎么用?Java RestExpress.awaitShutdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.restexpress.RestExpress的用法示例。


在下文中一共展示了RestExpress.awaitShutdown方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.restexpress.RestExpress; //导入方法依赖的package包/类
/**
 * Main method.
 *
 * @param args Command line arguments. Should be one parameter with either
 * an environment or a path to a URL with the proper configuration via a
 * REST GET.
 * @throws Exception
 */
public static void main(String[] args) throws Exception
{
    try
    {
        RestExpress server = initializeServer(args, null);
        logger.info("Server started up on port: " + server.getPort() + "!");
        server.awaitShutdown();
        Runtime.getRuntime().addShutdownHook(new Thread(new Runnable()
        {
            @Override
            public void run()
            {
                logger.info("Shutting down Docussandra...");
                CacheFactory.shutdownCacheManger();
            }
        }, "Shutdown-thread"));
    } catch (RuntimeException e)
    {
        logger.error("Runtime exception when starting/running Docussandra/RestExpress. Could not start.", e);
    }
}
 
开发者ID:PearsonEducation,项目名称:Docussandra,代码行数:30,代码来源:Main.java

示例2: main

import org.restexpress.RestExpress; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception
{
	RestExpress.setSerializationProvider(new SerializationProvider());

	Configuration config = Environment.load(args, Configuration.class);
	RestExpress server = new RestExpress()
	    .setName(SERVICE_NAME)
	    .setBaseUrl(config.getBaseUrl())
	    .setExecutorThreadCount(config.getExecutorThreadPoolSize())
	    .addPostprocessor(new LastModifiedHeaderPostprocessor())
	    .addMessageObserver(new SimpleConsoleLogMessageObserver());

	Routes.define(config, server);
	Relationships.define(server);
	configurePlugins(config, server);
	mapExceptions(server);
	registerDomainEvents(server, config);
	server.bind(config.getPort());
	server.awaitShutdown();
}
 
开发者ID:RestExpress,项目名称:RestExpress-Examples,代码行数:21,代码来源:Main.java

示例3: main

import org.restexpress.RestExpress; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception
{
	RestExpress.setSerializationProvider(new SerializationProvider());
	Configuration config = Environment.load(args, Configuration.class);
	RestExpress server = new RestExpress()
	    .setName(config.getName())
	    .setPort(config.getPort());

	defineRoutes(server, config);

	if (config.getWorkerCount() > 0)
	{
		server.setIoThreadCount(config.getWorkerCount());
	}

	if (config.getExecutorThreadCount() > 0)
    {
    	server.setExecutorThreadCount(config.getExecutorThreadCount());
    }

	mapExceptions(server);
	server.bind();
	server.awaitShutdown();
}
 
开发者ID:RestExpress,项目名称:RestExpress-Examples,代码行数:25,代码来源:Main.java

示例4: main

import org.restexpress.RestExpress; //导入方法依赖的package包/类
public static void main(String[] args) {
	RestExpress server = new RestExpress().setName("Echo");

	server.uri("/echo", new RestfulHandler()).method(HttpMethod.GET)
			.noSerialization();

	server.bind(8000);
	server.awaitShutdown();
}
 
开发者ID:duchien85,项目名称:netty-cookbook,代码行数:10,代码来源:Echo.java

示例5: main

import org.restexpress.RestExpress; //导入方法依赖的package包/类
public static void main(String[] args)
{
    RestExpress server = new RestExpress()
        .setName("Echo");

    server.uri("/echo", new Object()
    {
        @SuppressWarnings("unused")
        public String read(Request req, Response res)
        {
            String value = req.getHeader("echo");
            res.setContentType("text/xml");

            if (value == null)
            {
                return "<http_test><error>no value specified</error></http_test>";
            }
            else
            {
                return String.format("<http_test><value>%s</value></http_test>", value);
            }
        }
    })
    .method(HttpMethod.GET)
    .noSerialization();

    server.bind(8000);
    server.awaitShutdown();
}
 
开发者ID:RestExpress,项目名称:RestExpress-Examples,代码行数:30,代码来源:Main.java

示例6: main

import org.restexpress.RestExpress; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    RestExpress server = initializeServer(args);
    server.awaitShutdown();
}
 
开发者ID:caratarse,项目名称:caratarse-auth,代码行数:5,代码来源:Main.java


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