Package java.rmi

Examples of java.rmi.RemoteException


        // Home interface
        Class<?> homeInterfaceClass = null;
        try {
            homeInterfaceClass = classLoader.loadClass(getInterfaceClassName());
        } catch (ClassNotFoundException e) {
            throw new RemoteException("Cannot load the class '" + getInterfaceClassName() + "'.", e);
        }

        // Remote interface
        Class<?> remoteInterfaceClass = null;
        if (this.remoteInterface != null) {
            try {
                remoteInterfaceClass = classLoader.loadClass(this.remoteInterface);
            } catch (ClassNotFoundException e) {
                throw new RemoteException("Cannot load the class '" + this.remoteInterface + "'.", e);
            }
        }

        // stateless ? (using id = stateful)
        boolean isStateless = !isUsingID();
View Full Code Here


     */
    public EJBResponse getEJBResponse(final EJBRemoteRequest request) throws RemoteException {

        String id = request.getContainerId();
        if (id == null) {
            throw new RemoteException("No valid container id");
        }
        // Get the container
        EZBContainer container = this.ejb3server.getContainer(id);
        if (container == null) {
            throw new RemoteException("Cannot find the container with id '" + id + "'.");
        }

        // Once the container is found, get the factory
        String factoryName = request.getFactory();


        // while container is not available, stop the current request
        while (!container.isAvailable()) {
            //TODO: change it to a semaphore ?
            try {
                Thread.sleep(WAIT_TIME);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

        // Get the container
        Factory factory = container.getFactory(factoryName);
        if (factory == null) {
            throw new RemoteException("Cannot find the factory with name '" + factoryName + "'.");
        }

        // Now, need to invoke the bean
        return factory.rpcInvoke(request);
    }
View Full Code Here

  synchronized (ActivationGroup.class) {
      if (monitor != null) {
    return monitor;
      }
  }
  throw new RemoteException("monitor not received");
    }
View Full Code Here

        catch ( ParseException pe )
        {
            log.log( Level.WARNING, "Unparseable connection header detected!", pe );
            if ( !this._senderInfo.isHttp() )
            {
                this._senderInfo.setAttachment( new RemoteException( "Unparseable connection header!", pe ) );
            }
            else
            {
                this._senderInfo.setAttachment( new RemoteException( "Unparseable connection header!", pe ),
                                                HttpResponse.HTTP_BAD_REQUEST );
            }

            this._registrar.register( this._senderInfo, SelectionKey.OP_WRITE );
        }
View Full Code Here

                        result = dataChannel.decode( tmp );
                    }
                }
                catch ( Throwable t )
                {
                    throw new RemoteException( "Error while preprocessing request!", t );
                }
                finally
                {
                    this._senderInfo.releaseWaitingBuffer();
                }
View Full Code Here

            result = handler.handle( obj );
        }
        catch ( Throwable e )
        {
            log.log( Level.WARNING, "Exception in ServerHandler " + this._receiverInfo.getHandler() + " occured.", e );
            throw new RemoteException( "Server failed to proceed your request!", e );
        }

        return result;
    }
View Full Code Here

                                        if ( result != null && (result instanceof Throwable) )
                                        {
                                            if ( !(result instanceof RemoteException) )
                                            {
                                                throw new RemoteException(
                                                                           "The server did return an Exception while handling your request!",
                                                                           (Throwable) result );
                                            }
                                            else
                                            {
                                                throw (RemoteException) result;
                                            }
                                        }

                                        return result;
                                    }
                                }
                                else if ( selKey.isReadable() )
                                {
                                    result = receive( clientInfo );
                                    selKey.cancel();

                                    if ( result != null && (result instanceof Throwable) )
                                    {
                                        if ( !(result instanceof RemoteException) )
                                        {
                                            throw new RemoteException(
                                                                       "The server did return an Exception while handling your request!",
                                                                       (Throwable) result );
                                        }
                                        else
                                        {
                                            throw (RemoteException) result;
                                        }
                                    }

                                    return result;
                                }
                            }
                            catch ( IncompleteIOException ioe )
                            {
                                // selKey.cancel();
                                if ( ioe.getIOBuffer() != null )
                                {
                                    clientInfo.setWaitingBuffer( ioe.getIOBuffer() );
                                    _channel.register( this._selector, ioe.getSelectionInterest() );
                                }
                                else
                                {
                                    // rethrow origin exception to inform the caller
                                    // without the hassle of nested exceptions
                                    throw ioe;
                                }
                            }
                            catch ( ParseException e )
                            {
                                error = true;
                                throw new IOException(
                                                       "Connection closed due to unparseable connection header! Exact message was: "
                                                               + e.getMessage() );
                            }
                            catch ( IOException e )
                            {
                                if ( !(e instanceof RemoteException) )
                                {
                                    error = true;
                                }
                                // rethrow origin exception to inform the caller
                                // without the hassle of nested exceptions
                                throw e;
                            }
                        }
                    }
                }
                finally
                {
                    selKey.cancel();
                    // beeing a little bit paranoid is sometimes better
                    clientInfo.releaseAttachment();
                    clientInfo.releaseWaitingBuffer();
                    if ( _serverInfo != null )
                    {
                        _serverInfo.releaseAttachment();
                        _serverInfo.releaseWaitingBuffer();
                    }

                    if ( error )
                    {
                        close();
                    }
                    else if ( !clientInfo.isPersistent() || _serverInfo == null || !_serverInfo.isPersistent() )
                    {
                        close();
                    }
                    else
                    {
                        // clean out cancelled keys
                        this._selector.selectNow();
                        if ( _channel.isBlocking() ) _channel.configureBlocking( false );
                    }
                }
            }

            if ( result != null && result instanceof Throwable )
            {
                throw new RemoteException( "The server did return an Exception while handling your request!",
                                           (Throwable) result );
            }

            return result;
        }
View Full Code Here

        {
            IOUtil.adapterSerialize( this._adapter, out, obj, compressed, clientInfo.getCompressionLevel() );
        }
        catch ( Exception e )
        {
            throw new RemoteException( "The client encountered an error while serializing your request data!", e );
        }
    }
View Full Code Here

        {
            return IOUtil.adapterDeserialize( this._adapter, in, compressed );
        }
        catch ( Exception e )
        {
            throw new RemoteException( "The client encountered an error while deserializing the server response!", e );
        }
    }
View Full Code Here

        {
            throw ioe;
        }
        catch ( Throwable t )
        {
            throw new RemoteException( "The server encounteres an error while serializing the server response!", t );
        }
    }
View Full Code Here

TOP

Related Classes of java.rmi.RemoteException

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.