[
https://issues.apache.org/activemq/browse/SMXCOMP-540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Freeman Fang resolved SMXCOMP-540.
----------------------------------
Resolution: Fixed
commit fix
http://svn.apache.org/viewvc?rev=774643&view=rev for 3.2 branch
http://svn.apache.org/viewvc?rev=774645&view=rev for servicemix-cxf-bc
component project
thanks Alexander
> Registration/deregistration problem for consumer endpoint
> ---------------------------------------------------------
>
> Key: SMXCOMP-540
> URL: https://issues.apache.org/activemq/browse/SMXCOMP-540
> Project: ServiceMix Components
> Issue Type: Bug
> Components: servicemix-cxf-bc
> Environment: SMX 3.3, servicemix-shared-2008.01
> Reporter: Alexander Zobkov
> Assignee: Freeman Fang
> Fix For: 3.2.4, servicemix-cxf-bc-2009.02
>
>
> I think there is registration/deregistration problem for
> consumer endpoint in servicemix-cxf-bc 2009.01 and 2009.02-SNAPSHOT
> component.
> I have SA with SU installed on servicemix-cxf-bc component. SU has only
> one endpoint. Problem with registration/deregistation consumer endpoint
> happens in case of problem with connection initilization to JMS message
> broker.
> There is no possiblity to deregister endpoint correctly in case of no
> possibility to start SU, for example because of wrong connectivy parameters
> in endpoint consumer configuration files: xbean.xml, config file for cxf bus,
> wsdl file or JMS message broker wrong configuration. There is no possibity
> to deregister endpoint even with SA undeploy process, bacause of SU remains
> in "shutdown" state if there was problem at SU startup. If SU in shutdown
> state then SMX does not deregister endpoints for this SU. (please see code
> listing). Such behavior leads to error message: "An endpoint is already
> registered for key: FOO BAR" if user tries to redeploy SA with changed
> endpoint configuration, but with the same endpoint name. There is only one
> way to deregister endpoint - restart SMX, but it is not very good way if user
> needs use SMX in non-stop mode.
> Please find below related source code parts with small comments.
> org.apache.servicemix.jbi.framework.ServiceAssemblyLifeCycle.java
> {code:java}
> public synchronized String shutDown(boolean writeState) throws Exception {
> LOG.info("Shutting down service assembly: " + getName());
> List<Element> componentFailures = new ArrayList<Element>();
> for (int i = 0; i < sus.length; i++) {
> if (sus[i].isStarted()) {
> try {
> sus[i].stop();
> } catch (DeploymentException e) {
> componentFailures.add(getComponentFailure(e, "shutDown",
> sus[i].getComponentName()));
> }
> }
> }
> for (int i = 0; i < sus.length; i++) {
> if (sus[i].isStopped()) { //<- false for SU in shutdown state.
> try {
> sus[i].shutDown();
> } catch (DeploymentException e) {
> componentFailures.add(getComponentFailure(e, "shutDown",
> sus[i].getComponentName()));
> }
> }
> }
> if (componentFailures.size() == 0) {
> currentState = SHUTDOWN;
> if (writeState) {
> writeRunningState();
> }
> fireEvent(ServiceAssemblyEvent.ASSEMBLY_SHUTDOWN);
> return ManagementSupport.createSuccessMessage("shutDown");
> } else {
> throw ManagementSupport.failure("shutDown", componentFailures);
> }
> }
> {code}
> org.apache.servicemix.common.DefaultServiceUnit.java
> {code:java}
> public synchronized void init() throws Exception {
> if (this.status == LifeCycleMBean.SHUTDOWN) {
> // Activate endpoints
> List<Endpoint> activated = new ArrayList<Endpoint>();
> try {
> for (Endpoint endpoint : getEndpoints()) {
> endpoint.activate(); // <- registration inside activate
> method of cxf-bc consumer endpoint
> activated.add(endpoint);
> }
> this.status = LifeCycleMBean.STOPPED;
> } catch (Exception e) {
> // Deactivate activated endpoints
> for (Endpoint endpoint : activated) {
> try {
> endpoint.deactivate(); // <- deregistration does not
> work, if (1) thown exception, because of there is no broken endpoint in list
> "activated"
> } catch (Exception e2) {
> // do nothing
> }
> }
> throw e;
> }
> }
> }
> {code}
> org.apache.servicemix.cxfbc.CxfBcConsumer.java
> {code:java}
> @Override
> public void activate() throws Exception {
> super.activate(); //<- registration inside activate method. There is
> no recovery process for registration, in case of any problems after
> super.activate() call.
> registerListServiceHandler();
> applyFeatures();
> checkJmsTransportTransaction();
> server.start();
> }
> {code}
> I propose the following fix on BC level:
> {code:java}
> @Override
> public void activate() throws Exception {
> super.activate();
> try {
> registerListServiceHandler();
> applyFeatures();
> checkJmsTransportTransaction();
> server.start();
> } catch (Exception ex){
> super.deactivate(); //<- recovery process for registration in
> case of any problems with connection.
> throw ex;
> }
> }
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.