This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final void block(@ObservesAsync final BlockingEvent event) throws InterruptedException { | |
this.latch.await(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
beanManager.getEvent().select(BlockingEvent.class).fireAsync(new BlockingEvent()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final void startHttpServers(@Observes @Initialized(ApplicationScoped.class) @Priority(LIBRARY_AFTER) final Object event, final BeanManager beanManager) throws IOException, InterruptedException { | |
if (beanManager != null) { | |
final Instance<Object> beans = beanManager.createInstance(); | |
assert beans != null; | |
final Instance<HttpServer> httpServers = beans.select(HttpServer.class); | |
assert httpServers != null; | |
if (!httpServers.isUnsatisfied()) { | |
synchronized (this.startedHttpServers) { | |
for (final HttpServer httpServer : httpServers) { | |
if (httpServer != null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final void startHttpServers(@Observes @Initialized(ApplicationScoped.class) @Priority(LIBRARY_AFTER) final Object event, final BeanManager beanManager) throws IOException, InterruptedException { | |
if (beanManager != null) { | |
final Instance<Object> beans = beanManager.createInstance(); | |
assert beans != null; | |
final Instance<HttpServer> httpServers = beans.select(HttpServer.class); | |
assert httpServers != null; | |
if (!httpServers.isUnsatisfied()) { | |
synchronized (this.startedHttpServers) { | |
for (final HttpServer httpServer : httpServers) { | |
if (httpServer != null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final void stopHttpServers(@Observes final BeforeShutdown event) { | |
synchronized (this.startedHttpServers) { | |
for (final HttpServer httpServer : this.startedHttpServers) { | |
if (httpServer != null && httpServer.isStarted()) { | |
httpServer.shutdownNow(); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.util.ArrayList; | |
import java.util.Collection; | |
import java.util.Collections; | |
import java.util.List; | |
import java.util.Map; | |
import org.apache.maven.settings.Mirror; | |
import org.apache.maven.settings.Profile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.List; | |
import hapi.release.ReleaseOuterClass.Release; | |
import hapi.services.tiller.ReleaseServiceGrpc; | |
import hapi.services.tiller.ReleaseServiceGrpc.ReleaseServiceBlockingStub; | |
import hapi.services.tiller.Tiller.GetHistoryRequest; | |
import hapi.services.tiller.Tiller.GetHistoryResponse; | |
import io.fabric8.kubernetes.client.DefaultKubernetesClient; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final <X extends Listable<? extends KubernetesResourceList> & VersionWatchable<? extends Closeable, Watcher<? extends HasMetadata>>> void processProducerMethod(@Observes final ProcessProducerMethod<X, ?> event, final BeanManager beanManager) { | |
if (event != null) { | |
// (We'll define this in a second.) | |
this.processPotentialEventSelectorBean(event.getBean(), beanManager); | |
} | |
} | |
private final <X extends Listable<? extends KubernetesResourceList> & VersionWatchable<? extends Closeable, Watcher<? extends HasMetadata>>> void processProducerField(@Observes final ProcessProducerField<X, ?> event, final BeanManager beanManager) { | |
if (event != null) { | |
this.processPotentialEventSelectorBean(event.getBean(), beanManager); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final Type getOperationType(final Bean<?> bean) { | |
final Type returnValue; | |
if (bean == null) { | |
returnValue = null; | |
} else { | |
final Set<Type> beanTypes = bean.getTypes(); | |
assert beanTypes != null; | |
assert !beanTypes.isEmpty(); | |
Type candidate = null; | |
for (final Type beanType : beanTypes) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final void processPotentialEventSelectorBean(final Bean<?> bean, final BeanManager beanManager) { | |
if (bean != null) { | |
final Type operationType = getOperationType(bean); | |
if (operationType != null) { | |
final Set kubernetesEventSelectors = Annotations.retainAnnotationsQualifiedWith(bean.getQualifiers(), KubernetesEventSelector.class, beanManager); | |
if (kubernetesEventSelectors != null && !kubernetesEventSelectors.isEmpty()) { | |
this.eventSelectorBeans.put(kubernetesEventSelectors, bean); | |
} | |
} | |
} |