Package org.apache.mina.core.future

Examples of org.apache.mina.core.future.WriteFuture.awaitUninterruptibly()


        long localTimeout = timeout;

        while ( localTimeout > 0 )
        {
            // Wait only 100 ms
            boolean done = writeFuture.awaitUninterruptibly( 100 );

            if ( done )
            {
                return;
            }
View Full Code Here


                public void actionPerformed( java.awt.event.ActionEvent e )
                {
                    WriteFuture future = selected.getIoSession().write( NoticeOfDisconnect.STRONGAUTHREQUIRED );
                    try
                    {
                        future.awaitUninterruptibly( 1000L );
                        CloseFuture cfuture = selected.getIoSession().close( true );
                        cfuture.awaitUninterruptibly( 1000L );
                    }
                    catch ( Exception e1 )
                    {
View Full Code Here

     */
    public static void sendShutdownResponse( IoSession requestor, int messageId )
    {
        GracefulShutdownResponse msg = new GracefulShutdownResponseImpl( messageId, ResultCodeEnum.SUCCESS );
        WriteFuture future = requestor.write( msg );
        future.awaitUninterruptibly();
        if ( future.isWritten() )
        {
            if ( LOG.isInfoEnabled() )
            {
                LOG.info( "Sent GracefulShutdownResponse to client: " + requestor.getRemoteAddress() );
View Full Code Here

                    new InetSocketAddress("127.0.0.1", port));
            future.awaitUninterruptibly();

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

            future.getSession().close();

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

              performance_listener.messageSent( session_info.getVMID(),
                close_message );

              // Wait (a bit) for the message to be sent
              future.awaitUninterruptibly( 2000 );

              ThreadKit.sleep( 500 )// for good measure
            }
          }
          catch( Exception ex ) {
View Full Code Here

     */
    public static void sendShutdownResponse( IoSession requestor, int messageId )
    {
        GracefulShutdownResponse msg = new GracefulShutdownResponseImpl( messageId, ResultCodeEnum.SUCCESS );
        WriteFuture future = requestor.write( msg );
        future.awaitUninterruptibly();
        if ( future.isWritten() )
        {
            if ( LOG.isInfoEnabled() )
            {
                LOG.info( "Sent GracefulShutdownResponse to client: " + requestor.getRemoteAddress() );
View Full Code Here

        long localTimeout = timeout;

        while ( localTimeout > 0 )
        {
            // Wait only 100 ms
            boolean done = writeFuture.awaitUninterruptibly( 100 );

            if ( done )
            {
                return;
            }
View Full Code Here

        long localTimeout = timeout;

        while ( localTimeout > 0 )
        {
            // Wait only 100 ms
            boolean done = writeFuture.awaitUninterruptibly( 100 );

            if ( done )
            {
                return;
            }
View Full Code Here

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

        writeFuture.awaitUninterruptibly();

        waitForResponse(handler, DATA_SIZE * COUNT);

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

            connector.setHandler(new IoHandlerAdapter());
            ConnectFuture future = connector.connect(new InetSocketAddress("127.0.0.1", port));
            future.awaitUninterruptibly();

            WriteFuture writeFuture = future.getSession().write(IoBuffer.allocate(16).putInt(0).flip());
            writeFuture.awaitUninterruptibly();
            assertTrue(writeFuture.isWritten());

            future.getSession().close(true);

            for (int i = 0; i < 30; i++) {
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.