本文整理匯總了Java中org.eclipse.jetty.util.component.LifeCycle.start方法的典型用法代碼示例。如果您正苦於以下問題:Java LifeCycle.start方法的具體用法?Java LifeCycle.start怎麽用?Java LifeCycle.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jetty.util.component.LifeCycle
的用法示例。
在下文中一共展示了LifeCycle.start方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setUp
import org.eclipse.jetty.util.component.LifeCycle; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
environment = new Environment("test", new ObjectMapper(), Validators.newValidator(),
metricRegistry, ClassLoader.getSystemClassLoader());
DataSourceFactory dataSourceFactory = new DataSourceFactory();
dataSourceFactory.setUrl("jdbc:h2:mem:jdbi3-test");
dataSourceFactory.setUser("sa");
dataSourceFactory.setDriverClass("org.h2.Driver");
dataSourceFactory.asSingleConnectionPool();
dbi = new JdbiFactory(new TimedAnnotationNameStrategy()).build(environment, dataSourceFactory, "h2");
dbi.useTransaction(h -> {
h.createScript(Resources.toString(Resources.getResource("schema.sql"), Charsets.UTF_8)).execute();
h.createScript(Resources.toString(Resources.getResource("data.sql"), Charsets.UTF_8)).execute();
});
dao = dbi.onDemand(GameDao.class);
for (LifeCycle lc : environment.lifecycle().getManagedObjects()) {
lc.start();
}
}
示例2: toggleManagedObjects
import org.eclipse.jetty.util.component.LifeCycle; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private void toggleManagedObjects(boolean start) throws Exception
{
Field managedObjectsField = environment.lifecycle().getClass().getDeclaredField("managedObjects");
managedObjectsField.setAccessible(true);
List<LifeCycle> managedObjects = (List<LifeCycle>) managedObjectsField.get(environment.lifecycle());
for (LifeCycle managedObject : managedObjects)
{
if (start)
{
managedObject.start();
}
else
{
managedObject.stop();
}
}
}
示例3: run
import org.eclipse.jetty.util.component.LifeCycle; //導入方法依賴的package包/類
/**
* Modified from XmlConfiguration.main()
*/
public void run() {
for (LifeCycle lc : _jettys) {
if (!lc.isRunning()) {
try {
lc.start();
} catch (Exception e) {
changeState(START_FAILED, e);
return;
}
}
}
changeState(RUNNING);
if (_mgr != null)
_mgr.register(JettyStart.this);
}
示例4: setUp
import org.eclipse.jetty.util.component.LifeCycle; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
httpClient = new JettyClientBuilder(environment).build();
for (LifeCycle managedObject : environment.lifecycle().getManagedObjects()) {
managedObject.start();
}
}
示例5: toggleManagedObjects
import org.eclipse.jetty.util.component.LifeCycle; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private void toggleManagedObjects(boolean start) throws Exception {
Field managedObjectsField = environment.lifecycle().getClass().getDeclaredField("managedObjects");
managedObjectsField.setAccessible(true);
List<LifeCycle> managedObjects = (List<LifeCycle>) managedObjectsField.get(environment.lifecycle());
for (LifeCycle managedObject : managedObjects) {
if (start) {
managedObject.start();
} else {
managedObject.stop();
}
}
}
示例6: start
import org.eclipse.jetty.util.component.LifeCycle; //導入方法依賴的package包/類
public void start() throws Exception {
// Start all the managed instances in dropwizard.
Set<LifeCycle> managedObjects = ImmutableSet.copyOf(environment.lifecycle().getManagedObjects());
for (LifeCycle managed : managedObjects) {
managed.start();
}
}