當前位置: 首頁>>代碼示例>>Java>>正文


Java LifeCycle.start方法代碼示例

本文整理匯總了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();
    }
}
 
開發者ID:arteam,項目名稱:dropwizard-jdbi3,代碼行數:22,代碼來源:JdbiTest.java

示例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();
    }
  }
}
 
開發者ID:Hanmourang,項目名稱:Pinot,代碼行數:19,代碼來源:DropWizardApplicationRunner.java

示例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);
}
 
開發者ID:NoYouShutup,項目名稱:CryptMeme,代碼行數:19,代碼來源:JettyStart.java

示例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();
    }
}
 
開發者ID:arteam,項目名稱:dropwizard-http2-client,代碼行數:8,代碼來源:Http2ClientExternalServiceTest.java

示例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();
    }
  }
}
 
開發者ID:brandtg,項目名稱:dropwizard-helix,代碼行數:14,代碼來源:DropWizardApplicationRunner.java

示例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();
  }
}
 
開發者ID:HubSpot,項目名稱:Singularity,代碼行數:8,代碼來源:SingularityTestModule.java


注:本文中的org.eclipse.jetty.util.component.LifeCycle.start方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。