コード例 #1
0
 @After
 public void stop() throws Exception {
   channels.stopChannels();
   channels.shutdownRemoting();
   channels = null;
   responseAttachmentSupport.shutdown();
   responseAttachmentSupport = null;
 }
コード例 #2
0
  @Override
  protected ProxyController createProxyController(
      final ModelController proxiedController, final PathAddress proxyNodeAddress) {
    try {
      channels = new RemoteChannelPairSetup();
      channels.setupRemoting(
          new ManagementChannelInitialization() {
            @Override
            public ManagementChannelHandler startReceiving(Channel channel) {
              final ManagementChannelHandler support =
                  new ManagementChannelHandler(channel, channels.getExecutorService());
              support.addHandlerFactory(
                  new TransactionalProtocolOperationHandler(proxiedController, support));
              channel.addCloseHandler(
                  new CloseHandler<Channel>() {
                    @Override
                    public void handleClose(Channel closed, IOException exception) {
                      support.shutdownNow();
                    }
                  });
              channel.receiveMessage(support.getReceiver());
              return support;
            }
          });
      channels.startClientConnetion();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }

    final Channel clientChannel = channels.getClientChannel();
    final ManagementChannelHandler support =
        new ManagementChannelHandler(clientChannel, channels.getExecutorService());
    final RemoteProxyController proxyController =
        RemoteProxyController.create(
            support, proxyNodeAddress, ProxyOperationAddressTranslator.SERVER);
    clientChannel.addCloseHandler(
        new CloseHandler<Channel>() {
          @Override
          public void handleClose(Channel closed, IOException exception) {
            support.shutdownNow();
          }
        });
    clientChannel.receiveMessage(support.getReceiver());
    return proxyController;
  }
コード例 #3
0
 @After
 public void stopChannels() throws Exception {
   channels.stopChannels();
   channels.shutdownRemoting();
   channels = null;
 }