本文整理了Java中org.mortbay.jetty.Server.setStopAtShutdown()
方法的一些代码示例,展示了Server.setStopAtShutdown()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.setStopAtShutdown()
方法的具体详情如下:
包路径:org.mortbay.jetty.Server
类名称:Server
方法名:setStopAtShutdown
暂无
代码示例来源:origin: ltsopensource/light-task-scheduler
webapp.setInitParams(initParams);
server.setHandler(webapp);
server.setStopAtShutdown(true);
server.start();
代码示例来源:origin: tjake/Solandra
public JettySolandraRunner( String context, int port, String host)
{
this.context = context;
server = new Server( port );
server.getConnectors()[0].setHost(host);
server.setStopAtShutdown( true );
// Initialize the servlets
Context root = new Context( server, context, Context.SESSIONS );
// for some reason, there must be a servlet for this to get applied
root.addServlet( Servlet404.class, "/*" );
dispatchFilter = root.addFilter( SolandraDispatchFilter.class, "*", Handler.REQUEST );
}
代码示例来源:origin: twitter/ambrose
server.setStopAtShutdown(false);
代码示例来源:origin: com.github.albfernandez.test-jsf/jsf-test-jetty
@Override
public void destroy() {
try {
server.stop();
server.setStopAtShutdown(false);
server.destroy();
} catch (Exception e) {
throw new TestException(e.getMessage(), e);
} finally {
session = null;
server = null;
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
/**
* Stop all the started servers.
*/
public void stop() {
synchronized (joinLock) {
joinLock.notifyAll();
}
try {
Set<Entry<Integer, Port>> entries = new HashSet<Entry<Integer, Port>>(ports.entrySet());
for (Entry<Integer, Port> entry : entries) {
Port port = entry.getValue();
Server server = port.getServer();
server.stop();
server.setStopAtShutdown(false);
ports.remove(entry.getKey());
}
} catch (Exception e) {
throw new ServletMappingException(e);
} finally {
if (jettyLogger != null) {
Log.setLog(jettyLogger);
jettyLogger = null;
}
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-host-jetty
/**
* Stop all the started servers.
*/
public void stop() {
synchronized (joinLock) {
joinLock.notifyAll();
}
try {
Set<Entry<Integer, Port>> entries = new HashSet<Entry<Integer, Port>>(ports.entrySet());
for (Entry<Integer, Port> entry : entries) {
Port port = entry.getValue();
Server server = port.getServer();
server.stop();
server.setStopAtShutdown(false);
ports.remove(entry.getKey());
}
} catch (Exception e) {
throw new ServletMappingException(e);
} finally {
if (jettyLogger != null) {
Log.setLog(jettyLogger);
jettyLogger = null;
}
}
}
代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-server
private void init( String context, int port )
{
this.context = context;
server = new Server( port );
server.setStopAtShutdown( true );
// Initialize the servlets
Context root = new Context( server, context, Context.SESSIONS );
// for some reason, there must be a servlet for this to get applied
root.addServlet( Servlet404.class, "/*" );
dispatchFilter = root.addFilter( SolrDispatchFilter.class, "*", Handler.REQUEST );
}
代码示例来源:origin: org.sonatype.plexus/plexus-jetty6
public void stop()
throws StoppingException
{
try
{
getServer().stop();
// NEXUS-2465 memory leak here, since jetty is already stopped but kept in memory by shutdown hook
getServer().setStopAtShutdown( false );
setServer( null );
PlexusContainerHolder.clear();
}
catch ( Exception e )
{
throw new StoppingException( "Error stopping embedded Jetty server.", e );
}
}
代码示例来源:origin: apache/chukwa
@Before
public void setUp() throws Exception {
metricsMap.put("FreeSpace", "10GB");
metricsMap.put("UsedSpace", "90GB");
metricsMap.put("maps_killed", "20");
jettyServer = new Server(9090);
Context root = new Context(jettyServer, "/metrics/instrumentation/data",
Context.SESSIONS);
root.addServlet(new ServletHolder(new RestServlet()), "/*");
System.out.println(" Rest Server starting..");
jettyServer.start();
jettyServer.setStopAtShutdown(true);
}
代码示例来源:origin: org.apache.maven.plugins/maven-site-plugin
server.setStopAtShutdown( true );
代码示例来源:origin: opoo/opoopress
protected Server createJettyServer(Site site){
Server server = new Server();
server.setStopAtShutdown(true);
代码示例来源:origin: apache/chukwa
server.setStopAtShutdown(false);
Thread.sleep(1000);
agent.processAddCommand("add adaptor_constSend = " + ConstRateAdaptor.class.getCanonicalName() +
代码示例来源:origin: com.github.albfernandez.test-jsf/jsf-test-jetty
server.setStopAtShutdown(true);
} catch (Exception e) {
throw new TestException(e.getMessage(), e);
代码示例来源:origin: spring-projects/spring-hadoop-samples-old
public void start() throws Exception {
this.server = new Server(this.port);
WebAppContext root = new WebAppContext();
root.setContextPath("/");
root.setDescriptor(webappDirLocation + "/web.xml");
root.setResourceBase(webappDirLocation);
root.setParentLoaderPriority(true);
this.server.setHandler(root);
this.server.setStopAtShutdown(true);
this.server.start();
databaseServer = org.h2.tools.Server.createTcpServer(new String[]{"-tcpAllowOthers"}).start();
this.server.join();
}
代码示例来源:origin: org.jboss.errai/errai-cdi-jetty
@Override
public void stop() throws UnableToCompleteException {
TreeLogger branch = logger.branch(TreeLogger.INFO,
"Stopping Jetty server");
// Temporarily log Jetty on the branch.
Log.setLog(new JettyTreeLogger(branch));
try {
server.stop();
server.setStopAtShutdown(false);
branch.log(TreeLogger.TRACE, "Stopped successfully");
}
catch (Exception e) {
branch.log(TreeLogger.ERROR, "Unable to stop embedded Jetty server", e);
throw new UnableToCompleteException();
}
finally {
// Reset the top-level logger.
Log.setLog(new JettyTreeLogger(logger));
}
}
}
代码示例来源:origin: com.jayway.restassured.examples/rest-assured-itest-support
server.setStopAtShutdown(true);
server.start();
代码示例来源:origin: apache/chukwa
jettyServer.setStopAtShutdown(true);
代码示例来源:origin: apache/chukwa
public static Server startCollectorOnPort(Configuration conf, int port,
ServletCollector collector) throws Exception {
Server server = new Server(port);
Context root = new Context(server, "/", Context.SESSIONS);
root.addServlet(new ServletHolder(collector), "/*");
root.addServlet(new ServletHolder(new CommitCheckServlet(conf)), "/"+CommitCheckServlet.DEFAULT_PATH);
server.start();
server.setStopAtShutdown(false);
return server;
}
代码示例来源:origin: com.twitter.hraven/hraven-core
@Override
protected void startUp() throws Exception {
// setup the jetty config
ServletHolder sh = new ServletHolder(ServletContainer.class);
sh.setInitParameter("com.sun.jersey.config.property.packages", "com.twitter.hraven.rest");
sh.setInitParameter(JSONConfiguration.FEATURE_POJO_MAPPING, "true");
server = new Server();
Connector connector = new SelectChannelConnector();
connector.setPort(this.port);
connector.setHost(address);
server.addConnector(connector);
// TODO: in the future we may want to provide settings for the min and max threads
// Jetty sets the default max thread number to 250, if we don't set it.
//
QueuedThreadPool threadPool = new QueuedThreadPool();
server.setThreadPool(threadPool);
server.setSendServerVersion(false);
server.setSendDateHeader(false);
server.setStopAtShutdown(true);
// set up context
Context context = new Context(server, "/", Context.SESSIONS);
context.addServlet(sh, "/*");
// start server
server.start();
}
代码示例来源:origin: twitter/hraven
@Override
protected void startUp() throws Exception {
// setup the jetty config
ServletHolder sh = new ServletHolder(ServletContainer.class);
sh.setInitParameter("com.sun.jersey.config.property.packages", "com.twitter.hraven.rest");
sh.setInitParameter(JSONConfiguration.FEATURE_POJO_MAPPING, "true");
server = new Server();
Connector connector = new SelectChannelConnector();
connector.setPort(this.port);
connector.setHost(address);
server.addConnector(connector);
// TODO: in the future we may want to provide settings for the min and max threads
// Jetty sets the default max thread number to 250, if we don't set it.
//
QueuedThreadPool threadPool = new QueuedThreadPool();
server.setThreadPool(threadPool);
server.setSendServerVersion(false);
server.setSendDateHeader(false);
server.setStopAtShutdown(true);
// set up context
Context context = new Context(server, "/", Context.SESSIONS);
context.addServlet(sh, "/*");
// start server
server.start();
}
内容来源于网络,如有侵权,请联系作者删除!