Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2013, Red Hat, Inc., and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 package org.jboss.legacy.jnp.connector.clustered;
 
 import  org.jboss.as.clustering.impl.CoreGroupCommunicationService;
 import  org.jboss.as.naming.ServiceBasedNamingStore;
 import  org.jboss.as.network.SocketBinding;
 import  org.jboss.ha.jndi.HANamingService;
 import  org.jboss.msc.service.StartContext;
 import  org.jboss.msc.service.StartException;
 import  org.jboss.msc.service.StopContext;
 import  org.jboss.msc.value.InjectedValue;

Author(s):
baranowb
Emmanuel Hugonnet (c) 2013 Red Hat, inc.
 
 public class HAConnectorService implements JNPServerNamingConnectorService<HANamingService> {
 
     private final InjectedValue<InfinispanDistributedTreeManagerdistributedTreeManager = new InjectedValue<InfinispanDistributedTreeManager>();
     private final InjectedValue<CoreGroupCommunicationService> coreGroupCommunicationService = new InjectedValue<CoreGroupCommunicationService>();
     private final InjectedValue<SocketBinding> binding = new InjectedValue<SocketBinding>();
     private final InjectedValue<SocketBinding> rmiBinding = new InjectedValue<SocketBinding>();
     private final InjectedValue<ServiceBasedNamingStore> namingStoreValue = new InjectedValue<ServiceBasedNamingStore>();
 
     private HANamingService haNamingService;
 
     public HAConnectorService() {
         super();
     }
 
     public InjectedValue<InfinispanDistributedTreeManagergetDistributedTreeManager() {
         return ;
     }
 
     public InjectedValue<CoreGroupCommunicationService> getCoreGroupCommunicationService() {
         return ;
     }
 
     @Override
     public InjectedValue<SocketBinding> getBinding() {
         return ;
     }
 
     @Override
     public InjectedValue<SocketBinding> getRmiBinding() {
         return ;
     }
 
     public InjectedValue<ServiceBasedNamingStore> getNamingStoreValue() {
         return ;
     }
 
     @Override
     public HANamingService getValue() throws IllegalStateExceptionIllegalArgumentException {
         return this.;
     }
 
     @Override
     public void start(StartContext startContextthrows StartException {
         try {
             this. = new HANamingService();
             this. = new NamingStoreWrapper(.getValue());
             InfinispanHAPartition partition = new InfinispanHAPartition(.getValue());
             this..setHAPartition(partition);
             this..setDistributedTreeManager(.getValue());
             this..setLocalNamingInstance();
 
             if (this.getRmiBinding().getOptionalValue() != null) {
                 .setRmiBindAddress(this.getRmiBinding().getValue().getAddress().getHostName());
                 .setRmiPort(this.getRmiBinding().getValue().getAbsolutePort());
             }
             .setBindAddress(this.getBinding().getValue().getAddress().getHostName());
             .setPort(this.getBinding().getValue().getAbsolutePort());
             partition.start();
            .create();
            .start();
        } catch (Exception e) {
            throw new StartException(e);
        }
    }
    @Override
    public void stop(StopContext stopContext) {
        this..stop();
        this. = null;
    }
New to GrepCode? Check out our FAQ X