Package org.apache.mina.common

Examples of org.apache.mina.common.WriteFuture.join()


                    "localhost", port), new IoHandlerAdapter());
            future.join();

            WriteFuture writeFuture = future.getSession().write(
                    ByteBuffer.allocate(16).putInt(0).flip());
            writeFuture.join();
            Assert.assertTrue(writeFuture.isWritten());

            future.getSession().close();

            for (int i = 0; i < 30; i++) {
View Full Code Here


     *                                (eg remote connection is closed etc.)
     */
    public static void writeBody(IoSession session, Object body, Exchange exchange) throws CamelExchangeException {
        // the write operation is asynchronous. Use WriteFuture to wait until the session has been written
        WriteFuture future = session.write(body);
        future.join();
        if (!future.isWritten()) {
            throw new CamelExchangeException("Could not write body", exchange);
        }
    }

View Full Code Here

        {
            ConnectFuture future = connector.connect( new InetSocketAddress( "localhost", port ), new IoHandlerAdapter() );
            future.join();
           
            WriteFuture writeFuture = future.getSession().write( ByteBuffer.allocate( 16 ).putInt( 0 ).flip() );
            writeFuture.join();
            Assert.assertTrue( writeFuture.isWritten() );
           
            future.getSession().close();
   
            for( int i = 0; i < 30; i ++ )
View Full Code Here

        // must use a timeout (we use 10s) as in some very high performance scenarios a write can cause
        // thread hanging forever
        if (LOG.isTraceEnabled()) {
            LOG.trace("Waiting for write to complete");
        }
        future.join(10 * 1000L);
        if (!future.isWritten()) {
            LOG.warn("Cannot write body: " + body + " using session: " + session);
            throw new CamelExchangeException("Cannot write body", exchange);
        }
    }
View Full Code Here

                // This will align message arrival order in connectionless transport types
                waitForResponse( handler, ( i + 1 ) * DATA_SIZE );
            }
        }
       
        writeFuture.join();

        waitForResponse( handler, DATA_SIZE * COUNT );

        // Assert data
        //// Please note that BufferOverflowException can be thrown
View Full Code Here

        // must use a timeout (we use 10s) as in some very high performance scenarios a write can cause
        // thread hanging forever
        if (LOG.isTraceEnabled()) {
            LOG.trace("Waiting for write to complete");
        }
        future.join(10 * 1000L);
        if (!future.isWritten()) {
            LOG.warn("Cannot write body: " + body + " using session: " + session);
            throw new CamelExchangeException("Cannot write body", exchange);
        }
    }
View Full Code Here

     */
    public static void writeBody(IoSession session, Object body, Exchange exchange) throws CamelExchangeException {
        // the write operation is asynchronous. Use WriteFuture to wait until the session has been written
        WriteFuture future = session.write(body);
        // must use a timeout (we use 10s) as in some very high performance scenarious a write can cause thred hanging forever
        future.join(10 * 1000L);
        if (!future.isWritten()) {
            LOG.warn("Cannot write body: " + body + " using session: " + session);
            throw new CamelExchangeException("Cannot write body", exchange);
        }
    }
View Full Code Here

    {
        WriteFuture f = _minaProtocolSession.write(frame);
        if (wait)
        {
            // fixme -- time out?
            f.join();
        }
        else
        {
            _lastWriteFuture = f;
        }
View Full Code Here

            {
                future = new DefaultWriteFuture( sessions[ j ] );
                filter.messageReceived( nextFilter, sessions[ j ], future );
            }
           
            future.join();
           
            filter.onPostRemove( FILTER_PARENT, "", null );
            filter.onPostAdd( FILTER_PARENT, "", null );
        }
    }
View Full Code Here

   
    private void write( ByteBuffer buf ) throws IOException
    {
        checkClosed();
        WriteFuture future = session.write( buf );
        future.join();
        if( ! future.isWritten() )
        {
            throw new IOException( "The bytes could not be written to the session" );
        }
    }
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.