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


Java Managed.start方法代碼示例

本文整理匯總了Java中io.dropwizard.lifecycle.Managed.start方法的典型用法代碼示例。如果您正苦於以下問題:Java Managed.start方法的具體用法?Java Managed.start怎麽用?Java Managed.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.dropwizard.lifecycle.Managed的用法示例。


在下文中一共展示了Managed.start方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: newInboundReplication

import io.dropwizard.lifecycle.Managed; //導入方法依賴的package包/類
private Managed newInboundReplication(final DataCenter dataCenter) {
    // Create a proxy for the remote data center.
    final ReplicationSource replicationSource = newRemoteReplicationSource(dataCenter);

    // Start asynchronously downloading events from the remote data center.
    final Managed fanout = new GuavaServiceController(_replicationEnabled, new Supplier<Service>() {
        @Override
        public Service get() {
            return _fanoutManager.newInboundReplicationFanout(dataCenter, replicationSource);
        }
    });

    // Note: closing the replication source could also be done via a listener on the Guava service...
    return new Managed() {
        @Override
        public void start() throws Exception {
            fanout.start();
        }

        @Override
        public void stop() throws Exception {
            fanout.stop();
            ServicePoolProxies.close(replicationSource);
        }
    };
}
 
開發者ID:bazaarvoice,項目名稱:emodb,代碼行數:27,代碼來源:DefaultReplicationManager.java

示例2: start

import io.dropwizard.lifecycle.Managed; //導入方法依賴的package包/類
public void start() throws Exception {
  // Start all the managed instances in dropwizard.
  Set<Managed> managedObjects = ImmutableSet.copyOf(dropwizardModule.getManaged());
  for (Managed managed : managedObjects) {
    managed.start();
  }
}
 
開發者ID:PacktPublishing,項目名稱:Mastering-Mesos,代碼行數:8,代碼來源:SingularityTestModule.java

示例3: runOneIteration

import io.dropwizard.lifecycle.Managed; //導入方法依賴的package包/類
@Override
protected void runOneIteration() throws Exception {
    try {
        // Start replication for all new data centers.
        Map<String, Managed> active = Maps.newHashMap(_dataCenterFanout);
        DataCenter self = _dataCenters.getSelf();
        for (DataCenter dataCenter : _dataCenters.getAll()) {
            if (dataCenter.equals(self)) {
                continue;
            }
            Managed fanout = active.remove(dataCenter.getName());
            if (fanout == null) {
                fanout = newInboundReplication(dataCenter);
                try {
                    fanout.start();
                } catch (Exception e) {
                    _log.error("Unexpected exception starting replication service: {}", dataCenter.getName());
                    continue;
                }
                _dataCenterFanout.put(dataCenter.getName(), fanout);
            }
        }

        // If a DataCenter has been removed, stop replicating from it.
        stopAll(active);

    } catch (Throwable t) {
        _log.error("Unexpected exception polling data center changes.", t);
    }
}
 
開發者ID:bazaarvoice,項目名稱:emodb,代碼行數:31,代碼來源:DefaultReplicationManager.java

示例4: stopShouldCloseTheClient

import io.dropwizard.lifecycle.Managed; //導入方法依賴的package包/類
@Test
public void stopShouldCloseTheClient() throws Exception {
    Client client = mock(Client.class);
    Managed managed = new ManagedEsClient(client);

    managed.start();
    managed.stop();

    verify(client).close();
}
 
開發者ID:dropwizard,項目名稱:dropwizard-elasticsearch,代碼行數:11,代碼來源:ManagedEsClientTest.java

示例5: lifecycleMethodsShouldStartAndCloseTheNode

import io.dropwizard.lifecycle.Managed; //導入方法依賴的package包/類
@Test
public void lifecycleMethodsShouldStartAndCloseTheNode() throws Exception {
    Node node = mock(Node.class);
    when(node.isClosed()).thenReturn(false);
    Managed managed = new ManagedEsClient(node);

    managed.start();
    verify(node).start();

    managed.stop();
    verify(node).close();
}
 
開發者ID:dropwizard,項目名稱:dropwizard-elasticsearch,代碼行數:13,代碼來源:ManagedEsClientTest.java

示例6: start

import io.dropwizard.lifecycle.Managed; //導入方法依賴的package包/類
@Override
public void start() throws Exception {
    for (Managed managed : _managed) {
        managed.start();
    }
}
 
開發者ID:bazaarvoice,項目名稱:emodb,代碼行數:7,代碼來源:SimpleLifeCycleRegistry.java


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