Package org.apache.uima.aae.controller

Examples of org.apache.uima.aae.controller.Endpoint


              ((AggregateAnalysisEngineController) aController).retryMetadataRequest(anEndpoint);
              break;

            case AsynchAEMessage.Process:
              if ( anErrorContext.containsKey(AsynchAEMessage.Endpoint)) {
                Endpoint masterEndpoint = (Endpoint)anErrorContext.get(AsynchAEMessage.Endpoint);

                if (aController instanceof AggregateAnalysisEngineController && (masterEndpoint != null && masterEndpoint.getStatus() == Endpoint.FAILED)) {
                  // Fetch an InputChannel that handles messages for a given delegate
                  InputChannel iC = aController.getReplyInputChannel(masterEndpoint.getDelegateKey());
                  // Create a new Listener, new Temp Queue and associate the listener with the Input Channel
                  iC.createListener(masterEndpoint.getDelegateKey(), null);
                  iC.removeDelegateFromFailedList(masterEndpoint.getDelegateKey());
                  anEndpoint.setDestination(masterEndpoint.getDestination());
                }
               
              }
              String casReferenceId = (String) anErrorContext.get(AsynchAEMessage.CasReference);
              System.out.println("Controller:" + aController.getComponentName()
View Full Code Here


            if (getMetaRequestCount > 0 && getMetaRequestCount % MaxGetMetaRetryCount == 0) {
              JmsMessageContext msgContext = new JmsMessageContext(aMessage, primitiveServiceQueue1);
              JmsOutputChannel outputChannel = new JmsOutputChannel();
              outputChannel.setServiceInputEndpoint(primitiveServiceQueue1);
              outputChannel.setServerURI(getBrokerUri());
              Endpoint endpoint = msgContext.getEndpoint();
              outputChannel.sendReply(getPrimitiveMetadata1(PrimitiveDescriptor1), endpoint, true);
            }
            getMetaRequestCount++;
            getMetaCountLatch.countDown(); // Count down to unblock the thread
          }
View Full Code Here

      Set set = destinationMap.entrySet();
      // iterate over endpoints (delegates) to find those that
      // need to reply to a temp queue.
      for (Iterator it = set.iterator(); it.hasNext();) {
        Map.Entry entry = (Map.Entry) it.next();
        Endpoint endpoint = (Endpoint) entry.getValue();

        // Will this endpoint reply to a temp queue
        if (endpoint != null && endpoint.isTempReplyDestination()) {
          // block here until the Resolver creates a temp
          // queue and the endpoint initialization is
          // complete. When the resolver creates a temp quee it will
          // notify a listener container with a reference
          // to the temp queue. The listener container will in
          // turn call setDestination on the endpoint to inject
          // the destination object ( a temp queue) for the
          // delegate to reply to.
          while (!endpoint.replyDestinationFailed() && endpoint.getDestination() == null) {
            synchronized (endpoint) {
              try {
                endpoint.wait(200);
              } catch (InterruptedException e) {
              }
            }
          }
          System.out.println("Remote Delegate " + endpoint.getDelegateKey() + " Reply Queue:"
                  + endpoint.getDestination());

        }
      }
      int concurrentConsumerCountOnReplies = getConcurrentConsumerCount(ctx);
      // Configure and initialize vm transport in the top level aggregate.
View Full Code Here

    try {
      int msgType = aMessage.getIntProperty(AsynchAEMessage.MessageType);
      int command = aMessage.getIntProperty(AsynchAEMessage.Command);

      Endpoint masterEndpoint = null;
      if ( delegateEndpoint != null && delegateEndpoint.getDelegateKey() != null ) {
        masterEndpoint = ((AggregateAnalysisEngineController) controller).lookUpEndpoint(
                delegateEndpoint.getDelegateKey(), false);
        // Endpoint is marked as FAILED by the aggregate when it detects broker connection
        // failure. In such an event the aggregate stops the listener on the delegate
        // reply queue.
        if ( msgType == AsynchAEMessage.Request && command == AsynchAEMessage.Process &&
             masterEndpoint != null && masterEndpoint.getStatus() == Endpoint.FAILED) {
          HashMap<Object, Object> map = new HashMap<Object, Object>();
          Delegate delegate = ((AggregateAnalysisEngineController) controller).lookupDelegate(delegateEndpoint.getDelegateKey());
          //  Cancel Delegate timer before entering Error Handler
          if ( delegate != null ) {
            delegate.cancelDelegateTimer();
          }
          //  Handle the Connection error in the ProcessErrorHandler
          map.put(AsynchAEMessage.Command, AsynchAEMessage.Process);
          map.put(AsynchAEMessage.CasReference, aMessage.getStringProperty(AsynchAEMessage.CasReference));
          map.put(AsynchAEMessage.Endpoint, masterEndpoint);
          Exception e = new DelegateConnectionLostException("Controller:"+controller.getComponentName()+" Lost Connection to Delegate:"+masterEndpoint.getDelegateKey());
          if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
            UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(),
                    "send", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                    "UIMAEE_exception__WARNING", new Object[] { e });
          }
View Full Code Here

          newListener.stop();
          //  we are aborting, the controller has been stopped
          return;
        }
        // Get the endpoint object for a given delegate key from the Aggregate
        Endpoint endpoint = ((AggregateAnalysisEngineController) getController()).lookUpEndpoint(
                aDelegateKey, false);
        // Override the reply destination.
        endpoint.setDestination(newListener.getDestination());
        if ( endpointToUpdate != null) {
          endpointToUpdate.setDestination(newListener.getDestination());
        }
        Object clone = ((Endpoint_impl) endpoint).clone();
        newListener.setTargetEndpoint((Endpoint) clone);
        endpoint.setStatus(Endpoint.OK);
        System.out
        .println(".... Listener Started on New Temp Reply Queue ...");
      }
    }
  }
View Full Code Here

          }
        };
        stopThread.start();

        if (getController() != null) {
          Endpoint endpoint = ((AggregateAnalysisEngineController) getController()).lookUpEndpoint(
                  aDelegateKey, false);
          endpoint.setStatus(Endpoint.FAILED);
          if (mListener.getConnectionFactory() != null) {
            if (getController() instanceof AggregateAnalysisEngineController) {
              if (!failedListenerMap.containsKey(aDelegateKey)) {
                failedListenerMap.put(aDelegateKey, mListener);
                listenerContainerList.remove(mListener);
View Full Code Here

   * @param anEndpoint
   * @throws AsynchAEException
   */
  public void sendRequest( String aCasReferenceId, Endpoint[] endpoints) throws AsynchAEException
  {
    Endpoint currentEndpoint = null;
    try
    {
      boolean cacheSerializedCas = endpointRetryEnabled(endpoints);
     
      //  Serialize CAS using serializer defined in the first endpoint. All endpoints in the parallel Flow
View Full Code Here

      Set set = destinationMap.entrySet();
      // iterate over endpoints (delegates) to find those that
      // need to reply to a temp queue.
      for (Iterator it = set.iterator(); it.hasNext();) {
        Map.Entry entry = (Map.Entry) it.next();
        Endpoint endpoint = (Endpoint) entry.getValue();

        // Will this endpoint reply to a temp queue
        if (endpoint != null && endpoint.isTempReplyDestination()) {
          // block here until the Resolver creates a temp
          // queue and the endpoint initialization is
          // complete. When the resolver creates a temp quee it will
          // notify a listener container with a reference
          // to the temp queue. The listener container will in
          // turn call setDestination on the endpoint to inject
          // the destination object ( a temp queue) for the
          // delegate to reply to.
          while (!endpoint.replyDestinationFailed() && endpoint.getDestination() == null) {
            synchronized (endpoint) {
              try {
                endpoint.wait(200);
              } catch (InterruptedException e) {
              }
            }
          }
          System.out.println("Endpoint:" + endpoint.getEndpoint() + " Configured to Reply To temp queue:" + endpoint.getDestination());

        } else {
          if (endpoint != null) {
            System.out.println("Endpoint:" + endpoint.getEndpoint() + " Configured to Reply To fixed queue");
          }

        }
      }
View Full Code Here

  {
    System.out.println("Handling JMS Connect Exception Due To::"+exception.getLocalizedMessage());
    System.out.println("Exception Cause::"+exception.getClass().getName()+":::Message::"+exception.getLocalizedMessage());
   
    String casReferenceId = (String)anErrorContext.get(AsynchAEMessage.CasReference);
    Endpoint endpoint = (Endpoint)anErrorContext.get(AsynchAEMessage.Endpoint);
   
    //  If this is a PrimitiveController and not collocated with its aggregate
    //  drop the CAS
    if ( !( aController instanceof AggregateAnalysisEngineController ) )
    {
      CacheEntry entry = null;
     
      try
      {
        entry = aController.getInProcessCache().getCacheEntryForCAS(casReferenceId);
        if ( endpoint.isRemote() && entry != null )
        {
          aController.dropCAS(casReferenceId, true );
        }
      }
      catch( AsynchAEException e)
View Full Code Here

        //  This CAS came in from the CAS Multiplier. Treat it differently than the
        //  input CAS. First, in case the Aggregate needs to send this CAS to the
        //  client, retrieve the client destination by looking up the client endpoint
        //  using input CAS reference id. CASes generated by the CAS multiplier will have
        //  the same Cas Reference id.
        Endpoint replyToEndpoint = inputCasCacheEntry.getMessageOrigin();
        if ( getController() instanceof AggregateAnalysisEngineController )
        {
          newCASProducedBy = inputCasCacheEntry.getCasMultiplierKey();
          //  increment number of subordinate CASes that are currently being processed
          //  The input CAS (parent) will be held by the aggregate until all of its
          //  subordinate CASes are fully processed. Only then, the aggregate can return
          //  it back to the client
          synchronized( inputCasCacheEntry )
          {
            inputCasCacheEntry.incrementSubordinateCasInPlayCount();
          }
          if ( ((AggregateAnalysisEngineController)getController()).sendRequestToReleaseCas() )
          {
            try
            {
              //  Change the name of the queue where the request to free a CAS will be sent.
              aMessageContext.getEndpoint().setEndpoint(aMessageContext.getEndpoint().getEndpoint()+"CasSync");

              getController().getOutputChannel().sendRequest(AsynchAEMessage.ReleaseCAS, casReferenceId, aMessageContext.getEndpoint());
              requestToFreeCasSent = true;
            }
            catch( Exception e){}
          }
        }
        //  MessageContext contains endpoint set by the CAS Multiplier service. Overwrite
        //  this with the endpoint of the client who sent the input CAS. In case this
        //  aggregate is configured to send new CASes to the client we know where to send them.
        aMessageContext.getEndpoint().setEndpoint(replyToEndpoint.getEndpoint());
        aMessageContext.getEndpoint().setServerURI(replyToEndpoint.getServerURI());
        //  Set this to null so that the new CAS gets its own Cas Reference Id below
        casReferenceId = null;
      }
      else if ( getController().isTopLevelComponent())
      {
        Endpoint replyToEndpoint = aMessageContext.getEndpoint();

        if ( getController() instanceof AggregateAnalysisEngineController )
        {
          ((AggregateAnalysisEngineController)getController()).addMessageOrigin(casReferenceId, replyToEndpoint);
        }
View Full Code Here

TOP

Related Classes of org.apache.uima.aae.controller.Endpoint

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.