Examples of ClientRequest


Examples of com.hazelcast.client.ClientRequest

        }
    }

    private void addInvalidateListener() {
        try {
            ClientRequest request;
            EventHandler handler;
            if (cacheType == ClientNearCacheType.Map) {
                request = new MapAddEntryListenerRequest(mapName, false);
                handler = new EventHandler<PortableEntryEvent>() {
                    public void handle(PortableEntryEvent event) {
View Full Code Here

Examples of com.hazelcast.client.impl.client.ClientRequest

        return listen(request, null, handler);
    }

    @Override
    public String addEntryListener(EntryListener<K, V> listener, Predicate<K, V> predicate, K key) {
        ClientRequest request = new ClientReplicatedMapAddEntryListenerRequest(getName(), predicate, key);
        EventHandler<ReplicatedMapPortableEntryEvent> handler = createHandler(listener);
        return listen(request, null, handler);
    }
View Full Code Here

Examples of com.rop.client.ClientRequest

                .get(LogonResponse.class, "user.getSession", "1.0");
        String sessionId = ((LogonResponse) response.getSuccessResponse()).getSessionId();
        ropClient.setSessionId(sessionId);


        ClientRequest cr2 = ropClient.buildClientRequest();
        cr2.addParam("userName", "katty");
        cr2.addParam("salary", 2500L);
        Telephone telephone = new Telephone();
        telephone.setZoneCode("010");
        telephone.setTelephoneCode("12345678");
        cr2.addParam("telephone", telephone);

        response = cr2.post(CreateUserResponse.class, "user.add", "1.0");
        assertNotNull(response);
        assertTrue(response.isSuccessful());
        assertTrue(response.getSuccessResponse() instanceof CreateUserResponse);
    }
View Full Code Here

Examples of com.sun.jersey.api.client.ClientRequest

    headers.add(HmacUtils.X_HMAC_DATE, "Sat, 01 Jan 2000 12:34:57 GMT");
    headers.add(HmacUtils.X_HMAC_NONCE, "Thohn2Mohd2zugo");

    URI uri = new URI(baseUri + resourcePath + queryParameters);

    ClientRequest clientRequest = new ClientRequestImpl(uri, "get", null, headers);

    String representation = HmacUtils.createCanonicalRepresentation(clientRequest, providers);

    FixtureAsserts.assertStringMatchesStringFixture("GET canonical representation", representation, "/fixtures/hmac/expected-canonical-get.txt");
View Full Code Here

Examples of de.bwaldvogel.mongo.wire.message.ClientRequest

        if (opCode == null) {
            throw new IOException("opCode " + opCodeId + " not supported");
        }

        final Channel channel = ctx.channel();
        final ClientRequest ret;

        switch (opCode) {
        case OP_QUERY:
            ret = handleQuery(channel, header, in);
            break;
View Full Code Here

Examples of freenet.clients.fcp.ClientRequest

        boolean changed = writeAnyway;
        synchronized(completedRequestIdentifiers) {
          identifiers = completedRequestIdentifiers.toArray(new String[completedRequestIdentifiers.size()]);
        }
        for(String identifier: identifiers) {
          ClientRequest req = fcp.getGlobalRequest(identifier);
          if(req == null || req instanceof ClientGet == uploads) {
            synchronized(completedRequestIdentifiers) {
              completedRequestIdentifiers.remove(identifier);
            }
            changed = true;
View Full Code Here

Examples of io.undertow.client.ClientRequest

     */
    private int processWrite(int state, final ByteBuffer userData) throws IOException {
        if (state == STATE_START) {
            pooledBuffer = pool.allocate();
        }
        ClientRequest request = this.request;
        ByteBuffer buffer = pooledBuffer.getResource();
        Iterator<HttpString> nameIterator = this.nameIterator;
        Iterator<String> valueIterator = this.valueIterator;
        int charIndex = this.charIndex;
        int length;
        String string = this.string;
        HttpString headerName = this.headerName;
        int res;
        // BUFFER IS FLIPPED COMING IN
        if (state != STATE_START && buffer.hasRemaining()) {
            log.trace("Flushing remaining buffer");
            do {
                res = next.write(buffer);
                if (res == 0) {
                    return state;
                }
            } while (buffer.hasRemaining());
        }
        buffer.clear();
        // BUFFER IS NOW EMPTY FOR FILLING
        for (;;) {
            switch (state) {
                case STATE_BODY: {
                    // shouldn't be possible, but might as well do the right thing anyway
                    return state;
                }
                case STATE_START: {
                    log.trace("Starting request");
                    // we assume that our buffer has enough space for the initial request line plus one more CR+LF
                    assert buffer.remaining() >= 0x100;
                    request.getMethod().appendTo(buffer);
                    buffer.put((byte) ' ');
                    string = request.getPath();
                    length = string.length();
                    for (charIndex = 0; charIndex < length; charIndex ++) {
                        buffer.put((byte) string.charAt(charIndex));
                    }
                    buffer.put((byte) ' ');
                    request.getProtocol().appendTo(buffer);
                    buffer.put((byte) '\r').put((byte) '\n');
                    HeaderMap headers = request.getRequestHeaders();
                    nameIterator = headers.getHeaderNames().iterator();
                    if (! nameIterator.hasNext()) {
                        log.trace("No request headers");
                        buffer.put((byte) '\r').put((byte) '\n');
                        buffer.flip();
                        while (buffer.hasRemaining()) {
                            res = next.write(buffer);
                            if (res == 0) {
                                log.trace("Continuation");
                                return STATE_BUF_FLUSH;
                            }
                        }
                        pooledBuffer.free();
                        pooledBuffer = null;
                        log.trace("Body");
                        return STATE_BODY;
                    }
                    headerName = nameIterator.next();
                    charIndex = 0;
                    // fall thru
                }
                case STATE_HDR_NAME: {
                    log.tracef("Processing header '%s'", headerName);
                    length = headerName.length();
                    while (charIndex < length) {
                        if (buffer.hasRemaining()) {
                            buffer.put(headerName.byteAt(charIndex++));
                        } else {
                            log.trace("Buffer flush");
                            buffer.flip();
                            do {
                                res = next.write(buffer);
                                if (res == 0) {
                                    this.string = string;
                                    this.headerName = headerName;
                                    this.charIndex = charIndex;
                                    this.valueIterator = valueIterator;
                                    this.nameIterator = nameIterator;
                                    log.trace("Continuation");
                                    return STATE_HDR_NAME;
                                }
                            } while (buffer.hasRemaining());
                            buffer.clear();
                        }
                    }
                    // fall thru
                }
                case STATE_HDR_D: {
                    if (! buffer.hasRemaining()) {
                        buffer.flip();
                        do {
                            res = next.write(buffer);
                            if (res == 0) {
                                log.trace("Continuation");
                                this.string = string;
                                this.headerName = headerName;
                                this.charIndex = charIndex;
                                this.valueIterator = valueIterator;
                                this.nameIterator = nameIterator;
                                return STATE_HDR_D;
                            }
                        } while (buffer.hasRemaining());
                        buffer.clear();
                    }
                    buffer.put((byte) ':');
                    // fall thru
                }
                case STATE_HDR_DS: {
                    if (! buffer.hasRemaining()) {
                        buffer.flip();
                        do {
                            res = next.write(buffer);
                            if (res == 0) {
                                log.trace("Continuation");
                                this.string = string;
                                this.headerName = headerName;
                                this.charIndex = charIndex;
                                this.valueIterator = valueIterator;
                                this.nameIterator = nameIterator;
                                return STATE_HDR_DS;
                            }
                        } while (buffer.hasRemaining());
                        buffer.clear();
                    }
                    buffer.put((byte) ' ');
                    if(valueIterator == null) {
                        valueIterator = request.getRequestHeaders().get(headerName).iterator();
                    }
                    assert valueIterator.hasNext();
                    string = valueIterator.next();
                    charIndex = 0;
                    // fall thru
View Full Code Here

Examples of org.apache.hadoop.oncrpc.RpcCallCache.ClientRequest

     
      // Ensure the cache entries are correct
      int startEntry = Math.max(clientId - 10 + 1, 0);
      Iterator<Entry<ClientRequest, CacheEntry>> iterator = cache.iterator();
      for (int i = 0; i < size; i++) {
        ClientRequest key = iterator.next().getKey();
        System.out.println("Entry " + key.getClientId());
        assertEquals(InetAddress.getByName("1.1.1." + (startEntry + i)),
            key.getClientId());
      }
     
      // Ensure cache entries are returned as in progress.
      for (int i = 0; i < size; i++) {
        CacheEntry e = cache.checkOrAddToCache(
View Full Code Here

Examples of org.apache.kafka.clients.ClientRequest

            produceRecordsByPartition.put(tp, recordsBuffer);
            recordsByPartition.put(tp, batch);
        }
        ProduceRequest request = new ProduceRequest(acks, timeout, produceRecordsByPartition);
        RequestSend send = new RequestSend(destination, this.client.nextRequestHeader(ApiKeys.PRODUCE), request.toStruct());
        return new ClientRequest(now, acks != 0, send, recordsByPartition);
    }
View Full Code Here

Examples of org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl.ClientRequest

  }

  public void handleError(Exception e, ErrorContext errorContext) {
    String casReferenceId = null;
    CAS cas = null;
    ClientRequest cachedRequest = null;
   
    synchronized(errorMux) {
      if (!clientUimaAsEngine.running) {
        cancelDelegateTimer();
        return;
      }
     
      int command = ((Integer) errorContext.get(AsynchAEMessage.Command)).intValue();
      try {
        if (e instanceof MessageTimeoutException) {
          switch (command) {
            case AsynchAEMessage.Process:
              casReferenceId = (String) errorContext.get(AsynchAEMessage.CasReference);
              if (casReferenceId != null) {
                cachedRequest = (ClientRequest) clientUimaAsEngine.clientCache.get(casReferenceId);
                if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)
                        && getEndpoint() != null) {
                  UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, getClass().getName(),
                          "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                          "UIMAJMS_process_timeout_INFO",
                          new Object[] { getEndpoint().getEndpoint() });
                }
                if (cachedRequest != null && cachedRequest.isRemote()) {
                  cas = cachedRequest.getCAS();
                }
                boolean isPingTimeout = false;
                if (errorContext.containsKey(AsynchAEMessage.ErrorCause)) {
                  isPingTimeout = AsynchAEMessage.PingTimeout == (Integer) errorContext
                          .get(AsynchAEMessage.ErrorCause);
                }
                if (isPingTimeout && isAwaitingPingReply()) {
                  System.out.println(">>>>> Client Ping Timedout");
                  //  reset only if the connection is valid
                  if ( clientUimaAsEngine.state != ClientState.RECONNECTING) {
                    resetAwaitingPingReply();
                  }
                  pingTimeout = true;
                  UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
                          "handleError", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
                          "UIMAJMS_client_ping_timed_out__WARNING", new Object[] { getKey() });
                  clientUimaAsEngine.notifyOnTimout(cas, clientUimaAsEngine.getEndPointName(),
                          BaseUIMAAsynchronousEngineCommon_impl.ProcessTimeout, casReferenceId);
                } else {
                  if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
                    UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
                            "handleError", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
                            "UIMAJMS_client_process_timeout__INFO", new Object[] { super.getCasProcessTimeout() });
                  }
                  System.out.println(">>>>> Client Process Timed out. Cas Id:"+casReferenceId+" Notifying Listeners");
                  clientUimaAsEngine.notifyOnTimout(cas, clientUimaAsEngine.getEndPointName(),
                          BaseUIMAAsynchronousEngineCommon_impl.ProcessTimeout, casReferenceId);
                }
              }
              clientUimaAsEngine.clientSideJmxStats.incrementProcessTimeoutErrorCount();
              break;

            case AsynchAEMessage.GetMeta:
              if (isAwaitingPingReply()) {
                System.out.println(">>>>> Client Ping Timedout");
                clientUimaAsEngine.notifyOnTimout(cas, clientUimaAsEngine.getEndPointName(),
                        BaseUIMAAsynchronousEngineCommon_impl.PingTimeout, casReferenceId);
              } else {
                // Notifies Listeners and removes ClientRequest instance from the client cache
                clientUimaAsEngine.notifyOnTimout(cas, clientUimaAsEngine.getEndPointName(),
                        BaseUIMAAsynchronousEngineCommon_impl.MetadataTimeout, casReferenceId);
                clientUimaAsEngine.clientSideJmxStats.incrementMetaTimeoutErrorCount();
              }
              if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
                UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
                        "handleError", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
                        "UIMAJMS_meta_timeout_INFO", new Object[] { getKey() });
              }
              System.out.println("Stopping Uima AS Client API. Service Not Responding To a Ping.");
              clientUimaAsEngine.stop();
              break;

            case AsynchAEMessage.CollectionProcessComplete:

              break;
          }
        }
      } catch (Exception ex) {
        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(),
                  "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                  "UIMAEE_exception__WARNING", new Object[] { ex });
        }
      }
      // Dont release the CAS if synchronous API was used
      if (cas != null && !cachedRequest.isSynchronousInvocation()) {
        cas.release();
      }

    }
  }
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.