Examples of ClientService


Examples of org.apache.hadoop.mapreduce.v2.app.client.ClientService

      when(context.getClock()).thenReturn(clock);
      return context;
    }

    private static ClientService createMockClientService() {
      ClientService service = mock(ClientService.class);
      when(service.getBindAddress()).thenReturn(
          NetUtils.createSocketAddr("localhost:4567"));
      when(service.getHttpPort()).thenReturn(890);
      return service;
    }
View Full Code Here

Examples of org.teiid.transport.ClientServiceRegistryImpl.ClientService

            message.setContents(this.socketClientInstance.getCryptor().unsealObject(message.getContents()));
      if (!(message.getContents() instanceof ServiceInvocationStruct)) {
        throw new AssertionError("unknown message contents"); //$NON-NLS-1$
      }
      final ServiceInvocationStruct serviceStruct = (ServiceInvocationStruct)message.getContents();
      final ClientService clientService = this.csr.getClientService(serviceStruct.targetClass.getName());     
      loggingContext = clientService.getLoggingContext();
      Method m = clientService.getReflectionHelper().findBestMethodOnTarget(serviceStruct.methodName, serviceStruct.args);
      Object methodResult;
      try {
        methodResult = m.invoke(clientService.getInstance(), serviceStruct.args);
      } catch (InvocationTargetException e) {
        throw e.getCause();
      }
      if (ResultsFuture.class.isAssignableFrom(m.getReturnType()) && methodResult != null) {
        ResultsFuture<Object> future = (ResultsFuture<Object>) methodResult;
        future.addCompletionListener(new ResultsFuture.CompletionListener<Object>() {

              public void onCompletion(
                  ResultsFuture<Object> completedFuture) {
                Message asynchResult = new Message();
                try {
                  asynchResult.setContents(completedFuture.get());
                } catch (InterruptedException e) {
                  asynchResult.setContents(processException(e, clientService.getLoggingContext()));
                } catch (ExecutionException e) {
                  asynchResult.setContents(processException(e.getCause(), clientService.getLoggingContext()));
                }
                sendResult(asynchResult, encrypt);
              }

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