Java Code Examples for io.netty.util.concurrent.GlobalEventExecutor

Example 1
Project: lettuce   File: FuturesTest.java View source code 6 votes vote down vote up
@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 vote down vote up
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 vote down vote up
@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 vote down vote up
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 vote down vote up
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 

转载于:https://www.cnblogs.com/DaTouDaddy/p/6811345.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值