Package org.jacorb.util

Examples of org.jacorb.util.SelectorRequest


            else
            {
                timer = null;
                selectorTimer = new SelectorTimer ();
                long duration = org.jacorb.util.Time.millisTo (replyEndTime);
                timeoutRequest = new SelectorRequest (selectorTimer,
                                                      System.nanoTime() + duration*1000000);
                selectorManager.add (timeoutRequest);
            }
        }
        else
View Full Code Here


    public void testTimer() throws Exception
    {
        try
        {
            requestInitTime_ = System.nanoTime();
            SelectorRequest selectorRequest[] = new SelectorRequest[5];
            for (int i = 0; i < 5; i++)
            {
    selectorRequest[i] =
        new SelectorRequest (new TimerCallback(i),
           requestInitTime_ +
           requestDuration_[i] * 1000000);

                selectorManager_.add (selectorRequest[i]);
            }
View Full Code Here

            throw new org.omg.CORBA.COMM_FAILURE ("read() did not return any data");
        }

        long nanoDeadline = (time_out == 0 ? Long.MAX_VALUE : System.nanoTime() + time_out * 1000000);
        ReadCallback callback = new ReadCallback (data, offset, min_length, max_length);
        SelectorRequest request = new SelectorRequest (SelectorRequest.Type.READ, myChannel,
                callback, nanoDeadline);

        if (!selectorManager.add (request))
        {
            if (request.status == SelectorRequest.Status.EXPIRED)
            {
                throw new TIMEOUT("Message expired before write attempt.");
            }
            else
            {
                throw handleCommFailure(new IOException("Unable to add read request to SelectorManager"));
            }
        }
        request.waitOnCompletion (nanoDeadline);

        if (request.status == SelectorRequest.Status.EXPIRED || !request.isFinalized())
        {
            throw new TIMEOUT("Message expired before write attempt.");
        }
        else if (request.status == SelectorRequest.Status.FAILED)
        {
View Full Code Here

            throw handleCommFailure(new IOException("Channel has been closed"));
        }

        long nanoDeadline = (time_out == 0 ? Long.MAX_VALUE : System.nanoTime() + time_out * 1000000);
        WriteCallback writeCallback = new WriteCallback (data, offset, length);
        SelectorRequest request = new SelectorRequest (SelectorRequest.Type.WRITE, myChannel,
                writeCallback, nanoDeadline);

        if (!selectorManager.add (request))
        {
            if (request.status == SelectorRequest.Status.EXPIRED)
            {
                throw new TIMEOUT("Message expired before write attempt.");
            }
            else
            {
                throw handleCommFailure(new IOException("Unable to add write request to SelectorManager"));
            }
        }
        request.waitOnCompletion (nanoDeadline);

        if (!writeCallback.writeFinished())
        {

            int failCount = 0;
View Full Code Here

                    logger.debug("Trying to connect to " + connection_info);
                }

                myChannel.connect (new InetSocketAddress (ipAddress, port));

                SelectorRequest request =
                    new SelectorRequest (SelectorRequest.Type.CONNECT,
                                         myChannel,
                                         new ConnectCallback (),
                                         nanoDeadline);
                selectorManager.add (request);
                request.waitOnCompletion (nanoDeadline);

                if (request.status == SelectorRequest.Status.IOERROR)
                {
                    throw new TRANSIENT ("unable to connect");
                }
                else if (request.status == SelectorRequest.Status.EXPIRED ||
                    !request.isFinalized())
                {
                    throw new TIMEOUT("connection timeout expired");
                }
                else if (request.status == SelectorRequest.Status.FAILED ||
                         request.status == SelectorRequest.Status.SHUTDOWN ||
View Full Code Here

TOP

Related Classes of org.jacorb.util.SelectorRequest

Copyright © 2018 www.massapicom. 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.