Examples of MessageFilter


Examples of freenet.io.comm.MessageFilter

    final long uid = tag.uid;
    tag.handlingTimeout(next);
    // The node didn't accept the request. So we don't need to send them the data.
    // However, we do need to wait a bit longer to try to postpone the fatalTimeout().
    // Somewhat intricate logic to try to avoid fatalTimeout() if at all possible.
    MessageFilter mf = makeAcceptedRejectedFilter(next, TIMEOUT_AFTER_ACCEPTEDREJECTED_TIMEOUT, tag);
    try {
      node.usm.addAsyncFilter(mf, new SlowAsyncMessageFilterCallback() {

        @Override
        public void onMatched(Message m) {
View Full Code Here

Examples of freenet.io.comm.MessageFilter

         * - FNPRejectTimeout - we took too long to send the DataInsert
         * - FNPDataInsertRejected - the insert was invalid
         */
       
        int searchTimeout = calculateTimeout(htl);
        MessageFilter mfInsertReply = MessageFilter.create().setSource(next).setField(DMT.UID, uid).setTimeout(searchTimeout).setType(DMT.FNPInsertReply);
        MessageFilter mfRejectedOverload = MessageFilter.create().setSource(next).setField(DMT.UID, uid).setTimeout(searchTimeout).setType(DMT.FNPRejectedOverload);
        MessageFilter mfRouteNotFound = MessageFilter.create().setSource(next).setField(DMT.UID, uid).setTimeout(searchTimeout).setType(DMT.FNPRouteNotFound);
        MessageFilter mfDataInsertRejected = MessageFilter.create().setSource(next).setField(DMT.UID, uid).setTimeout(searchTimeout).setType(DMT.FNPDataInsertRejected);
        MessageFilter mfTimeout = MessageFilter.create().setSource(next).setField(DMT.UID, uid).setTimeout(searchTimeout).setType(DMT.FNPRejectedTimeout);
       
        MessageFilter mf = mfInsertReply.or(mfRouteNotFound.or(mfDataInsertRejected.or(mfTimeout.or(mfRejectedOverload))));

        InsertTag thisTag = forkedRequestTag;
        if(forkedRequestTag == null) thisTag = origTag;
       
        if(logMINOR) Logger.minor(this, "Sending DataInsert");
        try {
      next.sendSync(dataInsert, this, realTimeFlag);
    } catch (NotConnectedException e1) {
      if(logMINOR) Logger.minor(this, "Not connected sending DataInsert: "+next+" for "+uid);
      next.noLongerRoutingTo(thisTag, false);
      routeRequests();
      return;
    } catch (SyncSendWaitedTooLongException e) {
      Logger.error(this, "Unable to send "+dataInsert+" to "+next+" in a reasonable time");
      // Other side will fail. No need to do anything.
      next.noLongerRoutingTo(thisTag, false);
      routeRequests();
      return;
    }

    if(logMINOR) Logger.minor(this, "Sending data");
    final BackgroundTransfer transfer =
      startBackgroundTransfer(next, prb, thisTag);
   
    // Once the transfer has started, we only unlock the tag after the transfer completes (successfully or not).
   
        while (true) {

          Message msg;
         
      if(failIfReceiveFailed(thisTag, next)) {
        // The transfer has started, it will be cancelled.
        transfer.onCompleted();
        return;
      }
     
      try {
        msg = node.usm.waitFor(mf, this);
      } catch (DisconnectedException e) {
        Logger.normal(this, "Disconnected from " + next
            + " while waiting for InsertReply on " + this);
        transfer.onDisconnect(next);
        break;
      }
      if(failIfReceiveFailed(thisTag, next)) {
        // The transfer has started, it will be cancelled.
        transfer.onCompleted();
        return;
      }
     
      if (msg == null) {
       
        Logger.warning(this, "Timeout on insert "+this+" to "+next);
       
        // First timeout.
        // Could be caused by the next node, or could be caused downstream.
        next.localRejectedOverload("AfterInsertAcceptedTimeout2", realTimeFlag);
        forwardRejectedOverload();

        synchronized(this) {
          status = TIMED_OUT;
          notifyAll();
        }
       
        // Wait for the second timeout off-thread.
        // FIXME wait asynchronously.
       
        final InsertTag tag = thisTag;
        final PeerNode waitingFor = next;
        final short htl = this.htl;
       
        Runnable r = new Runnable() {

          @Override
          public void run() {
            // We do not need to unlock the tag here.
            // That will happen in the BackgroundTransfer, which has already started.
           
            // FIXME factor out
                int searchTimeout = calculateTimeout(htl);
                    MessageFilter mfInsertReply = MessageFilter.create().setSource(waitingFor).setField(DMT.UID, uid).setTimeout(searchTimeout).setType(DMT.FNPInsertReply);
                    MessageFilter mfRejectedOverload = MessageFilter.create().setSource(waitingFor).setField(DMT.UID, uid).setTimeout(searchTimeout).setType(DMT.FNPRejectedOverload);
                    MessageFilter mfRouteNotFound = MessageFilter.create().setSource(waitingFor).setField(DMT.UID, uid).setTimeout(searchTimeout).setType(DMT.FNPRouteNotFound);
                    MessageFilter mfDataInsertRejected = MessageFilter.create().setSource(waitingFor).setField(DMT.UID, uid).setTimeout(searchTimeout).setType(DMT.FNPDataInsertRejected);
                    MessageFilter mfTimeout = MessageFilter.create().setSource(waitingFor).setField(DMT.UID, uid).setTimeout(searchTimeout).setType(DMT.FNPRejectedTimeout);
                   
                    MessageFilter mf = mfInsertReply.or(mfRouteNotFound.or(mfDataInsertRejected.or(mfTimeout.or(mfRejectedOverload))));

                  while (true) {
                   
                    Message msg;

View Full Code Here

Examples of freenet.io.comm.MessageFilter

    return cb.waitForResult();
  }
 
  public static void waitForOpennetNoderef(final boolean isReply, final PeerNode source, final long uid, final ByteCounter ctr, final NoderefCallback callback, final Node node) {
    // FIXME remove back compat code
    MessageFilter mf =
      MessageFilter.create().setSource(source).setField(DMT.UID, uid).
      setTimeout(RequestSender.OPENNET_TIMEOUT).
      setType(isReply ? DMT.FNPOpennetConnectReplyNew : DMT.FNPOpennetConnectDestinationNew);
    // Also waiting for an ack
    MessageFilter mfAck =
      MessageFilter.create().setSource(source).setField(DMT.UID, uid).
      setTimeout(RequestSender.OPENNET_TIMEOUT).setType(DMT.FNPOpennetCompletedAck);
    // Also waiting for an upstream timed out.
    MessageFilter mfAckTimeout =
      MessageFilter.create().setSource(source).setField(DMT.UID, uid).
      setTimeout(RequestSender.OPENNET_TIMEOUT).setType(DMT.FNPOpennetCompletedTimeout);
   
    mf = mfAck.or(mfAckTimeout.or(mf));
    try {
      node.usm.addAsyncFilter(mf, new SlowAsyncMessageFilterCallback() {
       
        boolean completed;
View Full Code Here

Examples of net.suberic.pooka.MessageFilter

        hasChanged = true;
      } else if (matchingFilters.length != newMatchingFilters.length) {
        hasChanged = true;
      } else {
        for (int i = 0; hasChanged != true && i < newMatchingFilters.length; i++) {
          MessageFilter newValue = newMatchingFilters[i];
          MessageFilter oldValue = matchingFilters[i];
          if (newValue != oldValue) {
            hasChanged = true;
          }
        }
      }
View Full Code Here

Examples of org.apache.camel.component.spring.ws.filter.MessageFilter

     * @param parameters
     * @param configuration
     */
    private void configureMessageFilter(Map<String, Object> parameters, SpringWebserviceConfiguration configuration) {

        final MessageFilter globalMessageFilter = EndpointHelper.resolveReferenceParameter(
                                                      getCamelContext(), "messageFilter", MessageFilter.class, false /*not mandatory*/);
        final MessageFilter messageFilter = resolveAndRemoveReferenceParameter(
                                                      parameters, "messageFilter", MessageFilter.class, globalMessageFilter);

        configuration.setMessageFilter(messageFilter);
    }
View Full Code Here

Examples of org.apache.myfaces.extensions.cdi.message.api.MessageFilter

        assertEquals(0, this.messageContext.config().getMessageHandler().getMessages().size());
    }

    private MessageFilter createBlockingMessageFilter()
    {
        return new MessageFilter()
        {
            public boolean processMessage(MessageContext messageContext, Message message)
            {
                return false;
            }
View Full Code Here

Examples of org.apache.qpid.client.filter.MessageFilter

        }
    }

    public void testSimpleSelectorFilter() throws Exception
    {
        MessageFilter simpleSelectorFilter = new JMSSelectorFilter("select=5");

        assertNotNull("Filter object is null", simpleSelectorFilter);
        assertNotNull("Selector string is null", simpleSelectorFilter.getSelector());
        assertEquals("Unexpected selector", "select=5", simpleSelectorFilter.getSelector());
        assertTrue("Filter object is invalid", simpleSelectorFilter != null);

        final JMSTextMessage message = TestMessageHelper.newJMSTextMessage();

        message.setIntProperty("select", 4);
        assertFalse("Selector did match when not expected", simpleSelectorFilter.matches(message));
        message.setIntProperty("select", 5);
        assertTrue("Selector didnt match when expected", simpleSelectorFilter.matches(message));
        message.setIntProperty("select", 6);
        assertFalse("Selector did match when not expected", simpleSelectorFilter.matches(message));
    }
View Full Code Here

Examples of org.apache.qpid.server.filter.MessageFilter

    static MessageFilter createMessageFilter(final Map<String,Object> args, AMQQueue queue) throws AMQInvalidArgumentException
    {
        if(argumentsContainNoLocal(args))
        {
            MessageFilter filter = new NoLocalFilter(queue);

            if(argumentsContainJMSSelector(args))
            {
                filter = new CompoundFilter(filter, createJMSSelectorFilter(args));
            }
View Full Code Here

Examples of org.apache.qpid.server.filter.MessageFilter

            catch (AMQInvalidArgumentException e)
            {
                _logger.warn("Invalid filter in binding queue '"+_binding.getQueue().getName()
                             +"' to exchange '"+_binding.getExchange().getName()
                             +"' with arguments: " + _binding.getArguments());
                _filter = new MessageFilter()
                    {
                        @Override
                        public boolean matches(Filterable message)
                        {
                            return false;
View Full Code Here

Examples of org.apache.qpid.server.filter.MessageFilter

    private MessageFilter createMessageFilter(final FieldTable args, AMQQueue queue) throws AMQInvalidArgumentException
    {
        if(argumentsContainNoLocal(args))
        {
            MessageFilter filter = new NoLocalFilter(queue);

            if(argumentsContainJMSSelector(args))
            {
                filter = new CompoundFilter(filter, createJMSSelectorFilter(args));
            }
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.