Package net.jini.jeri

Examples of net.jini.jeri.OutboundRequestIterator


      Constraints.Distilled distilled =
    Constraints.distill(constraints, false);
      return connectionManager.newRequest(new Handle(distilled));

  } catch (final UnsupportedConstraintException e) {
      return new OutboundRequestIterator() {
    private boolean nextCalled = false;
    public boolean hasNext() { return !nextCalled; }
    public OutboundRequest next() throws IOException {
        if (!hasNext()) { throw new NoSuchElementException(); }
        nextCalled = true;
View Full Code Here


  newRequest(final InvocationConstraints constraints)
    {
  if (constraints == null) {
      throw new NullPointerException();
  }
  return new OutboundRequestIterator() {
      private boolean nextCalled = false;
      private OutboundRequest currentRequest;
      public OutboundRequest next() throws IOException {
    if (!hasNext()) {
        throw new NoSuchElementException();
View Full Code Here

  /**
   * Implements Endpoint.newRequest when the constraints are supported.
   */
  OutboundRequestIterator newRequest(final CallContext callContext) {
      return new OutboundRequestIterator() {
    private boolean done;
    public synchronized boolean hasNext() {
        return !done;
    }
    public synchronized OutboundRequest next() throws IOException {
View Full Code Here

      /* test endpoint.newRequest(...) */
      final PrivilegedExceptionAction pact =
    new PrivilegedExceptionAction() {
      public Object run() throws IOException {
          OutboundRequestIterator riter =
        clientEndpoint.newRequest(clientConstraints);
          if (!riter.hasNext()) {
        return "no request in the requestIter: " +
            riter;
          }

          OutboundRequest req = riter.next();
          if (riter.hasNext()) {
        return "more than one request in " +
            "requestIter: " + riter;
          }

          return req;
View Full Code Here

  newRequest(final InvocationConstraints constraints)
    {
  if (constraints == null) {
      throw new NullPointerException();
  }
  return new OutboundRequestIterator() {
      private boolean nextCalled = false;
      private OutboundRequest currentRequest;
      public OutboundRequest next() throws IOException {
    if (!hasNext()) {
        throw new NoSuchElementException();
View Full Code Here

      getEndpoint(new PrearrangedSocketFactory(socket), constraints);
  ConnManagerFactoryImpl factory = new ConnManagerFactoryImpl();
  endpointInternals.setConnManagerFactory(ep, factory);
  endpointInternals.disableSocketConnect(ep);

  OutboundRequestIterator iter = ep.newRequest(constraints);
  ConnectionInfo ci = factory.getConnectionInfo();
  if (ci != null) {
      return ci;
  }

  /*
   * Connection manager was never consulted, so constraints must not be
   * supported.  The resulting endpoint-fabricated outbound request
   * iterator should throw UnsupportedConstraintException from its next
   * method.
   */
  if (iter.hasNext()) {
      try {
    iter.next();
      } catch (UnsupportedConstraintException e) {
    throw e;
      } catch (IOException e) {
      }
  }
View Full Code Here

        if (handle == null) {
      throw new NullPointerException();
        }
        connInfo = new ConnectionInfo(endpoint, handle);

        return new OutboundRequestIterator() {
      public boolean hasNext() {
          return false;
      }
      public OutboundRequest next() throws IOException {
          throw new NoSuchElementException();
View Full Code Here

  System.err.println("\nTesting " + method + ":");
  for (Iterator i = testCases.entrySet().iterator(); i.hasNext();) {
      Map.Entry entry = (Map.Entry) i.next();
      InvocationConstraints c = (InvocationConstraints) entry.getKey();
      System.err.println("  trying: " + c);
      OutboundRequestIterator iter = endpoint.newRequest(c);
      OutboundRequest request = iter.next();
      InvocationConstraints u = request.getUnfulfilledConstraints();
      System.err.println("returned: " + u);
      if (!entry.getValue().equals(u)) {
    throw new RuntimeException(
        "TEST FAILED: incorrect constraints returned by " +
View Full Code Here

      Constraints.Distilled distilled =
    Constraints.distill(constraints, false);
      return connectionManager.newRequest(new Handle(distilled));

  } catch (final UnsupportedConstraintException e) {
      return new OutboundRequestIterator() {
    private boolean nextCalled = false;
    public boolean hasNext() { return !nextCalled; }
    public OutboundRequest next() throws IOException {
        if (!hasNext()) { throw new NoSuchElementException(); }
        nextCalled = true;
View Full Code Here

        GetDeliveryDispatcher dispatcher = new GetDeliveryDispatcher();
        GetDeliveryContext lc = new GetDeliveryContext(dispatcher);
        Endpoint e =
            se.enumerateListenEndpoints(lc);
        dispatcher.accept();
        OutboundRequestIterator ori =
            e.newRequest(InvocationConstraints.EMPTY);
        OutboundRequest or = null;
        while (ori.hasNext()) {
            or = ori.next();
            ObjectOutputStream oos = new ObjectOutputStream(
                or.getRequestOutputStream());
            oos.writeInt(1);
            oos.close();
        }
        if (dispatcher.dispatchCalled()!=1){
            throw new TestException("Dispatcher did not receive"
                + " the value sent");
        }
        if (!or.getDeliveryStatus()) {
            throw new TestException("Call on OutboundRequest"
                + ".getDeliveryStatus() returned false for an accepted"
                + " request");
        }
        ArrayList endpoints = lc.getEndpoints();
        Iterator it = endpoints.iterator();
        while (it.hasNext()){
            ((EndpointHolder)it.next()).getListenHandle().close();
        }
        dispatcher.reject();
        try {
            ori = e.newRequest(InvocationConstraints.EMPTY);
            while (ori.hasNext()) {
                or = ori.next();
                ObjectOutputStream oos = new ObjectOutputStream(
                    or.getRequestOutputStream());
                oos.writeInt(2);
                oos.close();
            }
View Full Code Here

TOP

Related Classes of net.jini.jeri.OutboundRequestIterator

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.