User: patriot1burke
  Date: 01/09/20 00:57:52

  Modified:    src/main/org/jboss/ha/jndi HANamingService.java
  Log:
  work in progress
  
  Revision  Changes    Path
  1.4       +59 -6     jbossmx/src/main/org/jboss/ha/jndi/HANamingService.java
  
  Index: HANamingService.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbossmx/src/main/org/jboss/ha/jndi/HANamingService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HANamingService.java      2001/09/19 23:57:59     1.3
  +++ HANamingService.java      2001/09/20 07:57:52     1.4
  @@ -49,6 +49,9 @@
   
   import org.jboss.ha.DistributedReplicantManager;
   import org.jboss.ha.HARMITarget;
  +import org.jboss.ha.HARMIServer;
  +import org.jboss.ha.HARMIServerImpl;
  +import org.jboss.ha.HARMIClient;
   import org.jboss.ha.HAPartition;
   import org.jboss.ha.RoundRobin;
   import org.jboss.ha.LoadBalancePolicy;
  @@ -58,7 +61,7 @@
    
    @author oberg
    @author [EMAIL PROTECTED]
  - @version $Revision: 1.3 $
  + @version $Revision: 1.4 $
    */
   public class HANamingService extends ServiceMBeanSupport implements Runnable, 
HANamingServiceMBean, DistributedReplicantManager.ReplicantListener
   {
  @@ -92,6 +95,8 @@
      protected Logger log;
   
      protected HARMITarget hatarget;
  +   protected HARMIServerImpl rmiserver;
  +   protected HARMIClient haclient;
      protected Naming hastub;
      protected RemoteStub stub;
      protected HAPartition partition;
  @@ -192,7 +197,8 @@
         Class clazz = loader.loadClass(serverSocketFactoryName);
         serverSocketFactory = (RMIServerSocketFactory) clazz.newInstance();
      }
  -   
  +
  +   /*   
      public void replicantsChanged(String key, ArrayList newReplicants)
      {
         log.info("replicantsChanged");
  @@ -259,9 +265,6 @@
            if( port == 0 )
               port = serverSocket.getLocalPort();
            String msg = "Started hajndiPort=" + port;
  -            /* +", rmiPort=" + rmiPort
  -               + ", backlog="+backlog+", bindAddress="+bindAddress
  -               + ", Client SocketFactory="+clientSocketFactory+", Server 
SocketFactory="+serverSocketFactory;*/
            log.info(msg);
            listen();
         } catch (IOException e)
  @@ -269,7 +272,57 @@
            log.error("Could not start on port " + port, e);
         }
      }
  +   */
      
  +   public void replicantsChanged(String key, ArrayList newReplicants)
  +   {
  +      haclient.setTargets(newReplicants.toArray());
  +   }
  +
  +   public void initService() throws Exception
  +   {
  +      log.info("Initializing HAJNDI server");
  +      partition = (HAPartition)new InitialContext().lookup("/HAPartition/" + 
partitionName);
  +      replicantManager = partition.getDistributedReplicantManager();
  +      log.info("Create remote object");
  +      theServer = new HAJNDI(partition);
  +      log.info("initialize HAJNDI");
  +      theServer.init();
  +   }
  +   
  +   public void startService()
  +      throws Exception
  +   {
  +      log.info("Starting HAJNDI server");
  +
  +      log.info("Register with replicantManager as listener for HAJNDI replicants");
  +      replicantManager.registerListener("HAJNDI", this);
  +      log.info("create proxy");
  +      this.haclient = new HARMIClient(new Object[0], new RoundRobin());
  +      this.hastub = (Naming)Proxy.newProxyInstance(
  +         Naming.class.getClassLoader(),
  +         new Class[] { Naming.class },
  +         this.haclient);
  +
  +      this.rmiserver = new HARMIServerImpl(partition, "HAJNDI", theServer);
  +      
  +      log.info("Start listener");
  +      try
  +      {
  +         serverSocket = null;
  +         serverSocket = new ServerSocket(port, backlog, bindAddress);
  +         // If an anonymous port was specified get the actual port used
  +         if( port == 0 )
  +            port = serverSocket.getLocalPort();
  +         String msg = "Started hajndiPort=" + port;
  +         log.info(msg);
  +         listen();
  +      } catch (IOException e)
  +      {
  +         log.error("Could not start on port " + port, e);
  +      }
  +   }
  +
      public void stopService()
      {
         try
  @@ -321,7 +374,7 @@
         try
         {
            ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream());
  -         synchronized(hatarget)
  +         synchronized(haclient)
            {
               out.writeObject(new MarshalledObject(hastub));
            }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to