Examples of SynchChannel


Examples of org.activeio.SynchChannel

        log.info("HTTP response: " + b);
    }

    protected void hitIIOPServer() throws Exception {
        SynchChannel channel = channelFactory.openSynchChannel(server.getConnectURI());
        ((SocketMetadata)channel.narrow(SocketMetadata.class)).setTcpNoDelay(true);
        channel.write(new ByteArrayPacket("GIOPcrapcrap".getBytes("UTF-8")));
        channel.flush();
        channel.dispose();
    }
View Full Code Here

Examples of org.activeio.SynchChannel

        channel.flush();
        channel.dispose();
    }

    public void testUnknownAccept() throws IOException, URISyntaxException, InterruptedException {
        SynchChannel channel = channelFactory.openSynchChannel(server.getConnectURI());
        ((SocketMetadata)channel.narrow(SocketMetadata.class)).setTcpNoDelay(true);
        channel
                .write(new ByteArrayPacket("Licensed under the Apache License, Version 2.0 (the \"License\")"
                        .getBytes("UTF-8")));
        channel.flush();
        String type = (String) resultSlot.poll(1000 * 5);
        assertNull(type);
        channel.dispose();
    }
View Full Code Here

Examples of org.activeio.SynchChannel

        AsynchChannelFactory factory = SynchToAsynchChannelFactoryAdaptor.adapt(channelFactory,executor);

        AsynchChannelServer cs = factory.bindAsynchChannel(new URI("tcp://localhost:0"));
        cs = new FilterAsynchChannelServer(cs) {
            public void onAccept(Channel channel) {
                SynchChannel synchChannel = AsynchToSynchChannelAdapter.adapt(channel);               
                super.onAccept(new FilterSynchChannel(synchChannel) {
                    public org.activeio.Packet read(long timeout) throws IOException {
                        Packet packet = super.read(timeout);
                        if( packet!=null && packet.hasRemaining() )
                            serverPacketCounter.increment();
View Full Code Here

Examples of org.activeio.SynchChannel

    public Socket accept() throws IOException {
        Channel channel = channelServer.accept(timeout);
        if( channel==null )
            throw new InterruptedIOException();
       
        SynchChannel synchChannel = AsynchToSynchChannelAdapter.adapt(channel);           
        synchChannel.start();
        return new SynchChannelToSocketAdapter(synchChannel);
                   
    }
View Full Code Here

Examples of org.activeio.SynchChannel

        this.createWriteBufferedChannels = createWriteBufferedChannels;
    this.useDirectBuffers = useDirectBuffers;
    }
   
    protected Channel createChannel(Socket socket) throws IOException {
        SynchChannel channel = new NIOSynchChannel(socket.getChannel());
        if( createWriteBufferedChannels ) {
            channel = new WriteBufferedSynchChannel(channel, ByteBufferPacket.createDefaultBuffer(useDirectBuffers));
        }
        return channel;
    }
View Full Code Here

Examples of org.activeio.SynchChannel

     * @param channel
     * @return
     * @throws IOException
     */
    protected SynchChannel createSynchChannel(SocketChannel socketChannel) throws IOException {
        SynchChannel channel = new NIOSynchChannel(socketChannel);
        if( createWriteBufferedChannels ) {
            channel = new WriteBufferedSynchChannel(channel, ByteBufferPacket.createDefaultBuffer(useDirectBuffers));
        }
        return channel;
    }
View Full Code Here

Examples of org.activeio.SynchChannel

        }
    }
   
    private static RequestChannel createRequestChannel(URI target) throws IOException, URISyntaxException {
        SocketSynchChannelFactory factory = new SocketSynchChannelFactory();
        SynchChannel channel = factory.openSynchChannel(target);
        SocketMetadata socket = (SocketMetadata) channel.narrow(SocketMetadata.class);
        socket.setTcpNoDelay(true);
        return new AsynchChannelToClientRequestChannel(
                 new PacketAggregatingSynchChannel(
                       channel));       
    }
View Full Code Here

Examples of org.activeio.SynchChannel

        server = createAsynchChannelServer();
        server.setAcceptListener(new AcceptListener() {
            public void onAccept(Channel channel) {
                RequestChannel requestChannel=null;
                try {
                    SynchChannel synchChannel = AsynchToSynchChannelAdapter.adapt(channel);
                    SocketMetadata socket = (SocketMetadata) synchChannel.narrow(SocketMetadata.class);
                    socket.setTcpNoDelay(true);
                   
                    requestChannel = createRequestChannel(synchChannel);    
                   
                    RequestChannelInterceptorInvoker invoker = new RequestChannelInterceptorInvoker(loginServiceInterceptor, loginService.getClass().getClassLoader() );
View Full Code Here

Examples of org.apache.ode.jacob.SynchChannel

        if (_current >= _steps) {
            if (_done != null) {
                _done.ret();
            }
        } else {
            SynchChannel r = newChannel(SynchChannel.class);
            object(new SynchChannelListener(r) {
                private static final long serialVersionUID = -6999108928780639603L;

                public void ret() {
                    ++_current;
View Full Code Here

Examples of org.apache.ode.jacob.SynchChannel

        if (_current >= _steps) {
            if (_done != null) {
                _done.ret();
            }
        } else {
            SynchChannel r = newChannel(SynchChannel.class);
            object(new SynchChannelListener(r) {
                private static final long serialVersionUID = -6999108928780639603L;

                public void ret() {
                    ++_current;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.