Package org.jboss.remoting

Examples of org.jboss.remoting.CannotConnectException


            }
         }
      }
     
      String msg = "Can not connect http client invoker after " + numberOfCallAttempts + " attempt(s)";
      throw new CannotConnectException(msg, savedException);
   }
View Full Code Here


         }
         catch (IOException e1)
         {
            log.debug("Unable to retrieve response message", e1);
         }
         throw new CannotConnectException(message, e);
      }

      // now check for error response and throw exception unless configured to not do so
      if(responseCode >= 400)
      {
View Full Code Here

//               return null;
            semaphore.release();
            if (trace) log.trace(this + " released semaphore: " + semaphore.permits());
            if (e instanceof InterruptedException && isWrapInterruptedException())
               throw new RuntimeException(e);
            throw new CannotConnectException(
               "Can not get connection to server. Problem establishing " +
               "socket connection for " + locator, e);
         }

         if (tempTimeout >= 0)
View Full Code Here

         Object result = resultHolder.value;
         if (result == null)
         {
            if (log.isDebugEnabled()) log.debug("invocation timed out");
            Exception cause = new SocketTimeoutException("timed out");
            throw new CannotConnectException("Can not connect http client invoker.", cause);
         }
         else if (result instanceof IOException)
         {
            throw (IOException) result;
         }
View Full Code Here

         }
         catch (IOException e1)
         {
            log.debug("Unable to retrieve response message", e1);
         }
         throw new CannotConnectException(message, e);
      }

      // now check for error response and throw exception unless configured to not do so
      if(responseCode >= 400
            || (getLocator().getProtocol().indexOf("servlet") >= 0
View Full Code Here

         {
//            if (bailOut)
//               return null;
            semaphore.release();
            if (trace) log.trace(this + " released semaphore: " + semaphore.permits(), e);
            sockEx =  new CannotConnectException(
                  "Can not get connection to server. Problem establishing " +
                  "socket connection for " + locator, e);
            continue;
         }

         if (tempTimeout >= 0)
         {
            timeLeft = (int) (tempTimeout - (System.currentTimeMillis() - start));
            if (timeLeft <= 0)
               break;
            savedTimeout = socketWrapper.getTimeout();           
            socketWrapper.setTimeout(timeLeft);
         }

         try
         {
            int version = getVersion();
            boolean performVersioning = Version.performVersioning(version);

            OutputStream outputStream = socketWrapper.getOutputStream();

            if (performVersioning)
            {
               writeVersion(outputStream, version);
            }

            //TODO: -TME so this is messed up as now ties remoting versioning to using a marshaller type
            versionedWrite(outputStream, marshaller, invocation, version);

            if (serverSideOneway)
            {
               if(trace) { log.trace(this + " sent oneway invocation, so not waiting for response, returning null"); }
            }
            else if (oneway)
            {
               if (performVersioning && useOnewayConnectionTimeout)
               {
                  int onewaySavedTimeout = socketWrapper.getTimeout();
                  socketWrapper.setTimeout(onewayConnectionTimeout);
                  InputStream inputStream = socketWrapper.getInputStream();
                  version = readVersion(inputStream);
                  if (version == -1)
                  {
                     throw new EOFException("end of file");
                  }
                  if (version == SocketWrapper.CLOSING)
                  {
                     log.trace(this + " received version 254: treating as end of file");
                     throw new EOFException("end of file");
                  }

                  // Note that if an exception is thrown, the socket is thrown away,
                  // so there's no need to reset the timeout value.
                  socketWrapper.setTimeout(onewaySavedTimeout);
               }
            }
            else
            {
               InputStream inputStream = socketWrapper.getInputStream();
               if (performVersioning)
               {
                  version = readVersion(inputStream);
                  if (version == -1)
                  {
                     throw new EOFException("end of file");
                  }
                  if (version == SocketWrapper.CLOSING)
                  {
                     log.trace(this + " received version 254: treating as end of file");
                     throw new EOFException("end of file");
                  }
               }

               response = versionedRead(inputStream, unmarshaller, version);
            }

            // Note that resetting the timeout value after closing the socket results
            // in an exception, so the reset is not done in a finally clause.  However,
            // if a catch clause is ever added that does not close the socket, care
            // must be taken to reset the timeout in that case.
            if (tempTimeout >= 0)
            {
               socketWrapper.setTimeout(savedTimeout);
            }
         }
         catch (SocketException sex)
         {
            handleRetriableException(socketWrapper, sex, retryCount);
            sockEx = sex;
            continue;
         }
         catch (EOFException ex)
         {
            handleRetriableException(socketWrapper, ex, retryCount);
            sockEx = ex;
            continue;
         }
         catch (Exception ex)
         {
            log.debug(this + " got exception: " + socketWrapper, ex);

            try
            {
               semaphore.release();
               if (trace) log.trace(this + " released semaphore: " + semaphore.permits());
               socketWrapper.close();
            }
            catch (Exception ignored)
            {
            }
           
            if (oneway)
               return null;
            else
               return handleException(ex, socketWrapper);
         }

         // call worked, so no need to retry
         break;
      }

      // need to check if ran out of retries
      if (retryCount >= numberOfCallRetries)
      {
         handleException(sockEx, socketWrapper);
      }
     
      if (response == null && tempTimeout > 0 && timeLeft <= 0)
      {
         if (sockEx == null)
         {
            sockEx =  new CannotConnectException(
                         "Can not get connection to server. Timed out establishing " +
                         "socket connection for " + locator);
         }
         handleException(sockEx, socketWrapper);
      }
View Full Code Here

         Object result = resultHolder.value;
         if (result == null)
         {
            if (log.isDebugEnabled()) log.debug("invocation timed out");
            Exception cause = new SocketTimeoutException("timed out");
            throw new CannotConnectException("Can not connect http client invoker.", cause);
         }
         else if (result instanceof IOException)
         {
            throw (IOException) result;
         }
View Full Code Here

            }
         }
      }
     
      String msg = "Can not connect http client invoker after " + numberOfCallAttempts + " attempt(s)";
      throw new CannotConnectException(msg, savedException);
   }
View Full Code Here

         }
      }
      catch (Exception e)
      {
         log.debug("Error invoking http client invoker.", e);
         throw new CannotConnectException("Can not connect http client invoker.", e);
      }

      // now check for error response and throw exception unless configured to not do so
      if(responseCode >= 400)
      {
View Full Code Here

      if (server == null)
      {
         String message = this + " unable to connect RMI invoker client";
         log.debug(message);
         throw new CannotConnectException(message, savedException);
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.remoting.CannotConnectException

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.