Package org.apache.mina.common

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


                if (LOG.isDebugEnabled()){
                    LOG.debug("Writing body : "+body);
                }
                latch = new CountDownLatch(1);
                WriteFuture future = session.write(body);
                future.join();
                if (!future.isWritten()){
                    throw new RuntimeException("Timed out waiting for response: "+exchange);
                }
                latch.await(MAX_WAIT_RESPONSE, TimeUnit.MILLISECONDS);
                if (latch.getCount()==1){
View Full Code Here


        int timeout = 0;
        try {
            WriteFuture future = session.write(message);
            if (sent) {
                timeout = getUrl().getPositiveParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT);
                success = future.join(timeout);
            }
        } catch (Throwable e) {
            throw new RemotingException(this, "Failed to send message " + message + " to " + getRemoteAddress() + ", cause: " + e.getMessage(), e);
        }
       
View Full Code Here

    {
        IoSession session = parent.getSession();
        WriteFuture future = stopSSL( session );
        session.removeAttribute( NEXT_FILTER );
        session.removeAttribute( SSL_HANDLER );
        future.join();
    }

    // IoFilter impl.
    public void sessionClosed( NextFilter nextFilter, IoSession session ) throws SSLException
    {
View Full Code Here

            }
        }
       
        if( future != null )
        {
            future.join();
        }
    }
   
    private WriteFuture initiateClosure( NextFilter nextFilter, IoSession session ) throws SSLException
    {
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

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

        // 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 scenarios a write can cause
        // thread hanging forever
        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

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.