Exemple #1
0
  void recoverReliableEndpoint(Endpoint endpoint, Conduit conduit) {
    if (null == store || null == retransmissionQueue) {
      return;
    }

    String id = RMUtils.getEndpointIdentifier(endpoint, getBus());

    Collection<SourceSequence> sss = store.getSourceSequences(id);
    Collection<DestinationSequence> dss = store.getDestinationSequences(id);
    if ((null == sss || 0 == sss.size()) && (null == dss || 0 == dss.size())) {
      return;
    }
    LOG.log(Level.FINE, "Number of source sequences: {0}", sss.size());
    LOG.log(Level.FINE, "Number of destination sequences: {0}", dss.size());

    LOG.log(
        Level.FINE,
        "Recovering {0} endpoint with id: {1}",
        new Object[] {null == conduit ? "client" : "server", id});
    RMEndpoint rme = createReliableEndpoint(endpoint);
    rme.initialise(getConfiguration(), conduit, null, null, null);
    synchronized (reliableEndpoints) {
      reliableEndpoints.put(endpoint, rme);
    }
    for (SourceSequence ss : sss) {
      recoverSourceSequence(endpoint, conduit, rme.getSource(), ss);
    }

    for (DestinationSequence ds : dss) {
      reconverDestinationSequence(endpoint, conduit, rme.getDestination(), ds);
    }
    retransmissionQueue.start();
  }
Exemple #2
0
 public Source getSource(Message message) throws RMException {
   RMEndpoint rme = getReliableEndpoint(message);
   if (null != rme) {
     return rme.getSource();
   }
   return null;
 }
Exemple #3
0
 public Destination getDestination(Message message) throws RMException {
   RMEndpoint rme = getReliableEndpoint(message);
   if (null != rme) {
     return rme.getDestination();
   }
   return null;
 }
Exemple #4
0
  void shutdownReliableEndpoint(Endpoint e) {
    RMEndpoint rme = reliableEndpoints.get(e);
    if (rme == null) {
      // not found
      return;
    }
    rme.shutdown();

    // remove references to timer tasks cancelled above to make them
    // eligible for garbage collection
    Timer t = getTimer(false);
    if (t != null) {
      t.purge();
    }

    reliableEndpoints.remove(e);
  }
Exemple #5
0
  @PreDestroy
  public void shutdown() {
    // shutdown remaining endpoints
    if (reliableEndpoints.size() > 0) {
      LOG.log(
          Level.FINE,
          "Shutting down RMManager with {0} remaining endpoints.",
          new Object[] {Integer.valueOf(reliableEndpoints.size())});
      for (RMEndpoint rme : reliableEndpoints.values()) {
        rme.shutdown();
      }
    }

    // remove references to timer tasks cancelled above to make them
    // eligible for garbage collection
    Timer t = getTimer(false);
    if (t != null) {
      t.purge();
      t.cancel();
    }

    // unregistring of this managed bean from the server is done by the bus itself
  }
Exemple #6
0
  public RMEndpoint getReliableEndpoint(Message message) throws RMException {
    Endpoint endpoint = message.getExchange().getEndpoint();
    QName name = endpoint.getEndpointInfo().getName();
    if (LOG.isLoggable(Level.FINE)) {
      LOG.fine("Getting RMEndpoint for endpoint with info: " + name);
    }
    if (name.equals(RM10Constants.PORT_NAME) || name.equals(RM11Constants.PORT_NAME)) {
      WrappedEndpoint wrappedEndpoint = (WrappedEndpoint) endpoint;
      endpoint = wrappedEndpoint.getWrappedEndpoint();
    }
    String rmUri = (String) message.getContextualProperty(WSRM_VERSION_PROPERTY);
    if (rmUri == null) {
      RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false);
      if (rmps != null) {
        rmUri = rmps.getNamespaceURI();
      }
    }
    String addrUri = (String) message.getContextualProperty(WSRM_WSA_VERSION_PROPERTY);
    if (addrUri == null) {
      AddressingProperties maps = ContextUtils.retrieveMAPs(message, false, false, false);
      if (maps != null) {
        addrUri = maps.getNamespaceURI();
      }
    }

    RMConfiguration config = getConfiguration();
    if (rmUri != null) {
      config.setRMNamespace(rmUri);
      ProtocolVariation protocol = ProtocolVariation.findVariant(rmUri, addrUri);
      if (protocol == null) {
        org.apache.cxf.common.i18n.Message msg =
            new org.apache.cxf.common.i18n.Message("UNSUPPORTED_NAMESPACE", LOG, addrUri, rmUri);
        LOG.log(Level.INFO, msg.toString());
        throw new RMException(msg);
      }
    }
    if (addrUri != null) {
      config.setRM10AddressingNamespace(addrUri);
    }
    Long timeout = (Long) message.getContextualProperty(WSRM_INACTIVITY_TIMEOUT_PROPERTY);
    if (timeout != null) {
      config.setInactivityTimeout(timeout);
    }
    Long interval = (Long) message.getContextualProperty(WSRM_RETRANSMISSION_INTERVAL_PROPERTY);
    if (interval != null) {
      config.setBaseRetransmissionInterval(interval);
    }
    Boolean exponential =
        (Boolean) message.getContextualProperty(WSRM_EXPONENTIAL_BACKOFF_PROPERTY);
    if (exponential != null) {
      config.setExponentialBackoff(exponential);
    }
    interval = (Long) message.getContextualProperty(WSRM_ACKNOWLEDGEMENT_INTERVAL_PROPERTY);
    if (interval != null) {
      config.setAcknowledgementInterval(interval);
    }
    RMEndpoint rme = reliableEndpoints.get(endpoint);
    if (null == rme) {
      synchronized (endpoint) {
        rme = reliableEndpoints.get(endpoint);
        if (rme != null) {
          return rme;
        }
        rme = createReliableEndpoint(endpoint);
        org.apache.cxf.transport.Destination destination = message.getExchange().getDestination();
        EndpointReferenceType replyTo = null;
        if (null != destination) {
          AddressingProperties maps = RMContextUtils.retrieveMAPs(message, false, false);
          replyTo = maps.getReplyTo();
        }
        Endpoint ei = message.getExchange().getEndpoint();
        org.apache.cxf.transport.Destination dest =
            ei == null
                ? null
                : ei.getEndpointInfo()
                    .getProperty(
                        MAPAggregator.DECOUPLED_DESTINATION,
                        org.apache.cxf.transport.Destination.class);
        config = RMPolicyUtilities.getRMConfiguration(config, message);
        rme.initialise(config, message.getExchange().getConduit(message), replyTo, dest, message);
        reliableEndpoints.put(endpoint, rme);
        LOG.fine("Created new RMEndpoint.");
      }
    }
    return rme;
  }