首页 > 代码库 > Java Code Examples for io.netty.util.concurrent.GlobalEventExecutor
Java Code Examples for io.netty.util.concurrent.GlobalEventExecutor
Example 1
Project: lettuce File: FuturesTest.java View source code | 6 votes |
@Test
public void regularUse() throws Exception {
final DefaultPromise<Boolean> target = new DefaultPromise<Boolean>(GlobalEventExecutor.INSTANCE);
Futures.PromiseAggregator<Boolean, Promise<Boolean>> sut = new Futures.PromiseAggregator<Boolean, Promise<Boolean>>(
target);
sut.expectMore(1);
sut.arm();
DefaultPromise<Boolean> part = new DefaultPromise<Boolean>(GlobalEventExecutor.INSTANCE);
sut.add(part);
assertThat(target.isDone()).isFalse();
part.setSuccess(true);
WaitFor.waitOrTimeout(new Condition() {
@Override
public boolean isSatisfied() {
return target.isDone();
}
}, timeout(seconds(5)));
assertThat(target.isDone()).isTrue();
}
Example 2
Project: usc File: UscNetconfClientDispatcherImpl.java View source code | 6 votes |
private Future<Void> createReconnectingSshClient(final NetconfReconnectingClientConfiguration currentConfiguration) {
LOG.debug("Creating reconnecting SSH client with configuration: {}", currentConfiguration);
LOG.warn("UscNetconfClientDispatcherImpl createReconnectingSshClient");
final Bootstrap b = new Bootstrap();
b.group(group);
b.channel(LocalChannel.class);
final ReconnectPromise p = new ReconnectPromise(GlobalEventExecutor.INSTANCE, this,
currentConfiguration.getAddress(), currentConfiguration.getConnectStrategyFactory(), b,
new PipelineInitializer<NetconfClientSession>() {
@Override
public void initializeChannel(final Channel ch, final Promise<NetconfClientSession> promise) {
new NetconfSshClientChannelInitializer(currentConfiguration.getAuthHandler(),
getNegotiatorFactory(currentConfiguration), currentConfiguration.getSessionListener())
.initialize(ch, promise);
}
});
p.connect();
return p;
}
Example 3
Project: netty4.0.27Learn File: EpollSocketChannel.java View source code | 6 votes |
@Override
protected Executor closeExecutor() {
if (config().getSoLinger() > 0) {
return GlobalEventExecutor.INSTANCE;
}
return null;
}
Example 4
Project: JgFramework File: BaseArea.java View source code | 6 votes |
public BaseArea(String name, BasePosition entrancePosition, IBaseMap map) {
this.id = hashCode();
this.name = name;
this.map = map;
this.entrancePosition = entrancePosition;
this.channelGroup = new DefaultChannelGroup(name, GlobalEventExecutor.INSTANCE);
}
Example 5
Project: glowroot File: HttpServerHandler.java View source code | 6 votes |
HttpServerHandler(LayoutService layoutService, Map<Pattern, HttpService> httpServices,
HttpSessionManager httpSessionManager, List<Object> jsonServices) {
this.layoutService = layoutService;
this.httpServices = ImmutableMap.copyOf(httpServices);
this.httpSessionManager = httpSessionManager;
List<JsonServiceMapping> jsonServiceMappings = Lists.newArrayList();
for (Object jsonService : jsonServices) {
for (Method method : jsonService.getClass().getDeclaredMethods()) {
GET annotationGET = method.getAnnotation(GET.class);
if (annotationGET != null) {
jsonServiceMappings.add(ImmutableJsonServiceMapping.builder()
.httpMethod(HttpMethod.GET)
.path(annotationGET.value())
.service(jsonService)
.methodName(method.getName())
.build());
}
POST annotationPOST = method.getAnnotation(POST.class);
if (annotationPOST != null) {
jsonServiceMappings.add(ImmutableJsonServiceMapping.builder()
.httpMethod(HttpMethod.POST)
.path(annotationPOST.value())
.service(jsonService)
.methodName(method.getName())
.build());
}
}
}
this.jsonServiceMappings = ImmutableList.copyOf(jsonServiceMappings);
allChannels = new DefaultChannelGroup(