jakarta-jcs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asm...@apache.org
Subject cvs commit: jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/behavior ILateralCacheAttributes.java
Date Fri, 14 May 2004 05:00:17 GMT
asmuts      2004/05/13 22:00:17

  Modified:    src/java/org/apache/jcs/auxiliary/lateral/javagroups
                        LateralJGService.java LateralJGSender.java
                        LateralJGReceiverConnection.java
                        LateralJGReceiver.java LateralCacheJGListener.java
                        JGConnectionHolder.java
               src/java/org/apache/jcs/auxiliary/lateral
                        LateralCacheAttributes.java
               src/java/org/apache/jcs/auxiliary/lateral/javagroups/utils
                        JGSocketOpener.java JGRpcOpener.java
               src/java/org/apache/jcs/auxiliary/lateral/behavior
                        ILateralCacheAttributes.java
  Log:
  Getting the old version clean for testing.
  
  Revision  Changes    Path
  1.5       +2 -2      jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralJGService.java
  
  Index: LateralJGService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralJGService.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LateralJGService.java	11 May 2004 01:04:35 -0000	1.4
  +++ LateralJGService.java	14 May 2004 05:00:13 -0000	1.5
  @@ -66,7 +66,7 @@
       public LateralJGService( ILateralCacheAttributes lca )
           throws IOException
       {
  -        this.ilca = lca;
  +        this.ilca = (ILateralCacheAttributes)lca;
           try
           {
               log.debug( "creating sender" );
  @@ -78,7 +78,7 @@
           catch ( IOException e )
           {
   
  -            log.error( "Could not create sender to [" + lca.getUdpMulticastAddr() + "]
-- " + e.getMessage() );
  +            log.error( "Could not create sender to [" + lca.getJGChannelProperties() +
"] -- " + e.getMessage() );
   
               throw e;
           }
  
  
  
  1.5       +21 -116   jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralJGSender.java
  
  Index: LateralJGSender.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralJGSender.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LateralJGSender.java	11 May 2004 01:04:36 -0000	1.4
  +++ LateralJGSender.java	14 May 2004 05:00:13 -0000	1.5
  @@ -42,12 +42,12 @@
   import org.apache.jcs.auxiliary.lateral.javagroups.utils.JGRpcOpener;
   import org.apache.jcs.auxiliary.lateral.javagroups.behavior.IJGConstants;
   
  -import org.javagroups.JChannel;
  -import org.javagroups.Channel;
  -import org.javagroups.Message;
  -import org.javagroups.blocks.RpcDispatcher;
  -import org.javagroups.util.RspList;
  -import org.javagroups.blocks.GroupRequest;
  +import org.jgroups.JChannel;
  +import org.jgroups.Channel;
  +import org.jgroups.Message;
  +import org.jgroups.blocks.RpcDispatcher;
  +import org.jgroups.util.RspList;
  +import org.jgroups.blocks.GroupRequest;
   
   import org.apache.jcs.engine.CacheElement;
   
  @@ -78,6 +78,8 @@
       private Channel javagroups;
       private RpcDispatcher disp;
   
  +    private JGConnectionHolder holder;
  +
       //private ObjectOutputStream oos;
       //private Socket socket;
       int counter = 0;
  @@ -98,32 +100,25 @@
           throws IOException
       {
           this.ilca = lca;
  -        init( lca.getUdpMulticastAddr(), lca.getUdpMulticastPort() );
  +        init();
       }
   
   
       /**
  -     * Description of the Method
  +     * Create holder.
        *
  -     * @param host
  -     * @param port
        * @exception IOException
        */
  -    protected void init( String host, int port )
  +    protected void init()
           throws IOException
       {
  -        this.port = port;
  -        this.address = getAddressByName( host );
  -        this.remoteHost = host;
   
           try
           {
  -            log.debug( "Attempting connection to " + address.getHostName() );
  -            //socket = new Socket( address, port );
  +            log.debug( "Attempting ccreate channel."  );
   
  -            JGConnectionHolder holder = JGConnectionHolder.getInstance(ilca);
  +            holder = JGConnectionHolder.getInstance(ilca);
               javagroups = holder.getChannel();
  -            disp = holder.getDispatcher();
   
               if ( javagroups == null )
               {
  @@ -133,12 +128,12 @@
           }
           catch ( java.net.ConnectException e )
           {
  -            log.debug( "Remote host " + address.getHostName() + " refused connection."
);
  +            log.debug( "Remote host refused connection." );
               throw e;
           }
           catch ( Exception e )
           {
  -            log.debug( "Could not connect to " + address.getHostName() +
  +            log.debug( "Could not connect to channel" +
                   ". Exception is " + e );
               throw new IOException(e.getMessage());
           }
  @@ -146,25 +141,6 @@
       }
       // end constructor
   
  -    /**
  -     * Gets the addressByName attribute of the LateralJGSender object
  -     *
  -     * @return The addressByName value
  -     * @param host
  -     */
  -    private InetAddress getAddressByName( String host )
  -    {
  -        try
  -        {
  -            return InetAddress.getByName( host );
  -        }
  -        catch ( Exception e )
  -        {
  -            log.error( "Could not find address of [" + host + "]", e );
  -            return null;
  -        }
  -    }
  -
   
       /**
        * Sends commands to the lateral cache listener.
  @@ -182,14 +158,6 @@
               return;
           }
   
  -        if ( address == null )
  -        {
  -            throw new IOException( "No remote host is set for LateralJGSender." );
  -            //return;
  -        }
  -
  -//        if ( oos != null )
  -//        {
           try
           {
   
  @@ -197,37 +165,18 @@
   
               javagroups.send( send_msg );
   
  -//                oos.writeObject( led );
  -//                oos.flush();
  -//                if ( ++counter >= RESET_FREQUENCY )
  -//                {
  -//                    counter = 0;
  -//                    // Failing to reset the object output stream every now and
  -//                    // then creates a serious memory leak.
  -//                    log.info( "Doing oos.reset()" );
  -//                    oos.reset();
  -//                }
  -//            }
  -//            catch ( IOException e )
  -//            {
  -//                //oos = null;
  -//                log.error( "Detected problem with connection: " + e );
  -//                throw e;
           }
           catch ( Exception e )
           {
               log.error( "Detected problem with connection: " + e );
               throw new IOException( e.getMessage() );
           }
  -//        }
  +
       }
   
   
       /**
  -     * Sends commands to the lateral cache listener and gets a response. I'm
  -     * afraid that we could get into a pretty bad blocking situation here. This
  -     * needs work. I just wanted to get some form of get working. Will need some
  -     * sort of timeout.
  +     * Sends commands to the lateral cache listener and gets a response.
        *
        * @return
        * @param led
  @@ -245,20 +194,14 @@
               return null;
           }
   
  -        if ( address == null )
  -        {
  -            throw new IOException( "No remote host is set for LateralJGSender." );
  -            //return;
  -        }
  -
  -//        if ( oos != null )
  -//        {
           try
           {
   
               try
               {
   
  +                disp = holder.getDispatcher();
  +
                   RspList rsp_list = disp.callRemoteMethods( null, "handleGet", (String)led.ce.getCacheName(),
(Serializable)led.ce.getKey(),
                       GroupRequest.GET_ALL, 1000 );
   
  @@ -367,9 +310,7 @@
       public void dispose( String cache )
           throws IOException
       {
  -        // WILL CLOSE CONNECTION USED BY ALL
  -        //oos.close();
  -        //javagroups.
  +
       }
   
   
  @@ -401,42 +342,6 @@
           led.requesterId = requesterId;
           led.command = led.REMOVEALL;
           send( led );
  -    }
  -
  -
  -    /**
  -     * Description of the Method
  -     *
  -     * @param args
  -     */
  -    public static void main( String args[] )
  -    {
  -        try
  -        {
  -            LateralJGSender lur = null;
  -            LateralCacheAttributes lca = new LateralCacheAttributes();
  -            lca.setHttpServer( "localhost:8181" );
  -            lur = new LateralJGSender( lca );
  -
  -            // process user input till done
  -            boolean notDone = true;
  -            String message = null;
  -            // wait to dispose
  -            BufferedReader br = new BufferedReader( new InputStreamReader( System.in )
);
  -
  -            while ( notDone )
  -            {
  -                System.out.println( "enter mesage:" );
  -                message = br.readLine();
  -                CacheElement ce = new CacheElement( "test", "test", message );
  -                LateralElementDescriptor led = new LateralElementDescriptor( ce );
  -                lur.send( led );
  -            }
  -        }
  -        catch ( Exception e )
  -        {
  -            System.out.println( e.toString() );
  -        }
       }
   
   }
  
  
  
  1.4       +8 -65     jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralJGReceiverConnection.java
  
  Index: LateralJGReceiverConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralJGReceiverConnection.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LateralJGReceiverConnection.java	11 May 2004 01:04:36 -0000	1.3
  +++ LateralJGReceiverConnection.java	14 May 2004 05:00:13 -0000	1.4
  @@ -33,9 +33,9 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  -import org.javagroups.Channel;
  -import org.javagroups.JChannel;
  -import org.javagroups.Message;
  +import org.jgroups.Channel;
  +import org.jgroups.JChannel;
  +import org.jgroups.Message;
   
   /**
    * Separate thread run when a command comes into the LateralJGReceiver.
  @@ -55,14 +55,7 @@
   
       private ILateralCacheJGListener ilcl;
   
  -    private int puts = 0;
   
  -//    /**
  -//     * Constructor for the LateralJGReceiverConnection object
  -//     *
  -//     * @param socket
  -//     * @param ilcl
  -//     */
       /**
        * Constructor for the LateralJGReceiverConnection object
        *
  @@ -72,22 +65,8 @@
       {
           this.ilcl = ilcl;
           this.mes = mes;
  -//        this.javagroups = javagroups;
  +     }
   
  -    }
  -
  -    //        this.socket = socket;
  -//        this.led = led;
  -//
  -//        try
  -//        {
  -//            ois = new ObjectInputStream( socket.getInputStream() );
  -//        }
  -//        catch ( Exception e )
  -//        {
  -//            log.error( "Could not open ObjectInputStream to " + socket, e );
  -//        }
  -//    }
   
   
       /**
  @@ -99,14 +78,10 @@
       public void run( )
       {
           Serializable obj = null;
  -//        Object obj;
   
           try
           {
  -//            while ( true )
  -//            {
  -//                obj = ois.readObject();
  -//                LateralElementDescriptor led = ( LateralElementDescriptor ) obj;
  +
                   LateralElementDescriptor led = ( LateralElementDescriptor ) mes.getObject();
                   if ( led == null )
                   {
  @@ -129,14 +104,6 @@
                       }
                       if ( led.command == led.UPDATE )
                       {
  -                        puts++;
  -                        if ( log.isDebugEnabled() )
  -                        {
  -                            if ( puts % 100 == 0 )
  -                            {
  -                                log.debug( "puts = " + puts );
  -                            }
  -                        }
                           ilcl.handlePut( led.ce );
                       }
                       else
  @@ -148,10 +115,10 @@
                           if ( led.command == led.GET )
                       {
                           obj = getAndRespond( led.ce.getCacheName(), led.ce.getKey() );
  -                        //ilcl.handleGet( led.ce.getCacheName(), led.ce.getKey() );
  +
                       }
                   }
  -//            }
  +
           }
           catch ( java.io.EOFException e )
           {
  @@ -166,15 +133,7 @@
               log.error( "Unexpected exception. Closing conneciton", e );
           }
   
  -//        try
  -//        {
  -//            ois.close();
  -//        }
  -//        catch ( Exception e )
  -//        {
  -//            log.error( "Could not close connection", e );
  -//        }
  -        //return obj;
  +
       }
   
   
  @@ -196,22 +155,6 @@
               log.debug( "obj = " + obj );
           }
   
  -//        ObjectOutputStream oos = new ObjectOutputStream( socket.getOutputStream() );
  -//
  -//        if ( oos != null )
  -//        {
  -//            try
  -//            {
  -//                oos.writeObject( obj );
  -//                oos.flush();
  -//            }
  -//            catch ( IOException e )
  -//            {
  -//                oos = null;
  -//                log.error( "Detected problem with connection", e );
  -//                throw e;
  -//            }
  -//        }
           return obj;
       }
   }
  
  
  
  1.4       +32 -25    jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralJGReceiver.java
  
  Index: LateralJGReceiver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralJGReceiver.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LateralJGReceiver.java	11 May 2004 01:04:36 -0000	1.3
  +++ LateralJGReceiver.java	14 May 2004 05:00:13 -0000	1.4
  @@ -31,11 +31,11 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  -import org.javagroups.JChannel;
  -import org.javagroups.Channel;
  -import org.javagroups.Message;
  -import org.javagroups.blocks.RpcDispatcher;
  -import org.javagroups.ChannelNotConnectedException;
  +import org.jgroups.JChannel;
  +import org.jgroups.Channel;
  +import org.jgroups.Message;
  +import org.jgroups.blocks.RpcDispatcher;
  +import org.jgroups.ChannelNotConnectedException;
   
   /**
    * Processes commands from the server socket.
  @@ -47,14 +47,8 @@
       private final static Log log =
           LogFactory.getLog( LateralJGReceiver.class );
   
  -    private int port;
  -
       private ILateralCacheJGListener ilcl;
       private ILateralCacheAttributes ilca;
  -    /**
  -     * How long the server will block on an accept(). 0 is infinte.
  -     */
  -    private final static int sTimeOut = 5000;
   
   
       /**
  @@ -66,7 +60,7 @@
           {
               if ( log.isDebugEnabled() )
               {
  -                log.debug( "Listening on port " + port );
  +                log.debug( "Listening" );
               }
   
               JGConnectionHolder holder = JGConnectionHolder.getInstance(ilca);
  @@ -79,7 +73,7 @@
                   throw new IOException( "javagroups is null" );
               }
   
  -
  +            int conProbCnt = 0;
               while ( true )
               {
                   if ( log.isDebugEnabled() )
  @@ -91,10 +85,13 @@
                   try
                   {
                       Object obj = javagroups.receive( 0 );
  -                    if ( obj != null && obj instanceof org.javagroups.Message )
  +                    if ( obj != null && obj instanceof org.jgroups.Message )
                       {
                           mes = ( Message ) obj;
  -                        log.info( "Starting new socket node." );
  +                        if ( log.isDebugEnabled() )
  +                        {
  +                          log.debug( "Starting new socket node." );
  +                        }
                           new Thread( new LateralJGReceiverConnection( mes, ilcl ) ).start();
                       }
                       else
  @@ -107,27 +104,37 @@
                   }
                   catch ( ChannelNotConnectedException cnce )
                   {
  -                    log.warn(cnce);
  +                    if ( conProbCnt % 5 == 0 )
  +                    {
  +                      log.warn(cnce);
  +                    }
  +                    conProbCnt++;
  +
  +                    if ( conProbCnt >= 2000 )
  +                    {
  +                      log.error( "Couldn't get connected to group after " + conProbCnt
+ " tries" );
  +                      break;
  +                    }
  +                    // slow the connection try process down
  +                    synchronized (this)
  +                    {
  +                      this.wait(10);
  +                    }
                       // this will cycle unitl connected and eat up the processor
                       // need to throw out and recover
                       // seems to periodically require about 50 tries.
                   }
                   catch ( Exception e )
                   {
  +                    // should zombie
                       log.error( "problem receiving", e );
                   }
   
  -                //InetAddress inetAddress = javagroups..getInetAddress();
  -                //if ( log.isDebugEnabled() )
  -                //{
  -                //    log.debug( "Connected to client at " + inetAddress );
  -                //}
  -                //log.info( "Connected to client at " + inetAddress );
               }
           }
           catch ( Exception e )
           {
  -            log.error( "Major intialization problem", e );
  +            log.error( "Major connection problem", e );
           }
       }
   
  @@ -140,7 +147,7 @@
        */
       public LateralJGReceiver( ILateralCacheAttributes ilca, ILateralCacheJGListener ilcl
)
       {
  -        this.port = ilca.getTcpListenerPort();
  +
           this.ilcl = ilcl;
           this.ilca = ilca;
           if ( log.isDebugEnabled() )
  
  
  
  1.7       +15 -12    jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralCacheJGListener.java
  
  Index: LateralCacheJGListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralCacheJGListener.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- LateralCacheJGListener.java	11 May 2004 01:04:36 -0000	1.6
  +++ LateralCacheJGListener.java	14 May 2004 05:00:13 -0000	1.7
  @@ -25,6 +25,7 @@
   import org.apache.jcs.auxiliary.lateral.LateralCacheInfo;
   
   import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
  +import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
   import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheListener;
   import org.apache.jcs.auxiliary.lateral.javagroups.behavior.ILateralCacheJGListener;
   
  @@ -143,8 +144,9 @@
        */
       public static ILateralCacheListener getInstance( ILateralCacheAttributes ilca )
       {
  +
           //throws IOException, NotBoundException
  -        ILateralCacheListener ins = ( ILateralCacheListener ) instances.get( String.valueOf(
ilca.getUdpMulticastAddr() ) );
  +        ILateralCacheListener ins = ( ILateralCacheListener ) instances.get( ilca.getJGChannelProperties()
);
           if ( ins == null )
           {
               synchronized ( LateralCacheJGListener.class )
  @@ -154,11 +156,11 @@
                       ins = new LateralCacheJGListener( ilca );
                       ins.init();
                   }
  -                if ( log.isDebugEnabled() )
  +                if ( log.isInfoEnabled() )
                   {
  -                    log.debug( "created new listener " + ilca.getUdpMulticastAddr() );
  +                    log.info( "created new listener " + ilca.getJGChannelProperties() );
                   }
  -                instances.put( String.valueOf( ilca.getUdpMulticastAddr() ), ins );
  +                instances.put( ilca.getJGChannelProperties(), ins );
               }
           }
           return ins;
  @@ -173,21 +175,22 @@
       public void handlePut( ICacheElement element )
           throws IOException
       {
  -        if ( log.isInfoEnabled() )
  +        if ( log.isDebugEnabled() )
           {
  -            log.info( "PUTTING ELEMENT FROM LATERAL" );
  +            log.debug( "PUTTING ELEMENT FROM LATERAL" );
           }
   
  -        getCache( element.getCacheName() ).localUpdate( element );
  -
           puts++;
  -        if ( puts % 100 == 0 )
  +        if ( log.isInfoEnabled() )
           {
  -            log.info( "puts = " + puts );
  +            if ( puts % 100 == 0 )
  +            {
  +                log.info( "puts = " + puts );
  +            }
           }
   
  -        // implement remove on put
  -        //handleRemove(cb.getCacheName(), cb.getKey());
  +        getCache( element.getCacheName() ).localUpdate( element );
  +
       }
   
   
  
  
  
  1.4       +9 -9      jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/javagroups/JGConnectionHolder.java
  
  Index: JGConnectionHolder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/javagroups/JGConnectionHolder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JGConnectionHolder.java	11 May 2004 01:04:36 -0000	1.3
  +++ JGConnectionHolder.java	14 May 2004 05:00:13 -0000	1.4
  @@ -21,12 +21,12 @@
   import java.util.HashMap;
   import java.io.IOException;
   
  -import org.javagroups.JChannel;
  -import org.javagroups.Channel;
  -import org.javagroups.Message;
  -import org.javagroups.blocks.RpcDispatcher;
  -import org.javagroups.util.RspList;
  -import org.javagroups.blocks.GroupRequest;
  +import org.jgroups.JChannel;
  +import org.jgroups.Channel;
  +import org.jgroups.Message;
  +import org.jgroups.blocks.RpcDispatcher;
  +import org.jgroups.util.RspList;
  +import org.jgroups.blocks.GroupRequest;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -66,7 +66,7 @@
       public static JGConnectionHolder getInstance( ILateralCacheAttributes ilca )
       {
           //throws IOException, NotBoundException
  -        JGConnectionHolder ins = ( JGConnectionHolder ) instances.get( String.valueOf(
ilca.getUdpMulticastAddr() ) );
  +        JGConnectionHolder ins = ( JGConnectionHolder ) instances.get( ilca.getJGChannelProperties()
);
           try
           {
               if ( ins == null )
  @@ -79,9 +79,9 @@
                       }
                       if ( log.isDebugEnabled() )
                       {
  -                        log.debug( "created new listener " + ilca.getUdpMulticastAddr()
);
  +                        log.debug( "created new listener " + ilca.getJGChannelProperties()
);
                       }
  -                    instances.put( String.valueOf( ilca.getUdpMulticastAddr() ), ins );
  +                    instances.put( ilca.getJGChannelProperties(), ins );
                   }
               }
           }
  
  
  
  1.6       +16 -0     jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java
  
  Index: LateralCacheAttributes.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LateralCacheAttributes.java	15 Apr 2004 19:22:48 -0000	1.5
  +++ LateralCacheAttributes.java	14 May 2004 05:00:16 -0000	1.6
  @@ -49,9 +49,14 @@
       int tcpListenerPort = 1111;
       int httpListenerPort = 8080;
   
  +    // javagroups
  +    private String jgChannelProperties = null;
  +
  +    // general
       private String cacheName;
       private String name;
   
  +    // disables gets from laterals
       boolean putOnlyMode = true;
   
       /**
  @@ -394,6 +399,17 @@
       public boolean getPutOnlyMode()
       {
           return putOnlyMode;
  +    }
  +
  +
  +    public String getJGChannelProperties()
  +    {
  +      return jgChannelProperties;
  +    }
  +
  +    public void setJGChannelProperties( String channelProperties )
  +    {
  +      this.jgChannelProperties = channelProperties;
       }
   
   
  
  
  
  1.4       +7 -11     jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/javagroups/utils/JGSocketOpener.java
  
  Index: JGSocketOpener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/javagroups/utils/JGSocketOpener.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JGSocketOpener.java	11 May 2004 01:04:36 -0000	1.3
  +++ JGSocketOpener.java	14 May 2004 05:00:17 -0000	1.4
  @@ -20,8 +20,8 @@
   import java.io.IOException;
   import java.io.InterruptedIOException;
   
  -import org.javagroups.JChannel;
  -import org.javagroups.Channel;
  +import org.jgroups.JChannel;
  +import org.jgroups.Channel;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -31,7 +31,7 @@
   
   /**
    * Socket openere that will timeout on the initial connect rather than block
  - * forever. Technique from core java II.
  + * forever.
    *
    * @version $Id$
    */
  @@ -62,7 +62,7 @@
           }
           catch ( InterruptedException ire )
           {
  -            log.error(ire);
  +            log.error( "Failed of connect in within timout of " + timeOut,  ire);
           }
           return opener.getSocket();
       }
  @@ -90,14 +90,10 @@
       {
           try
           {
  -            // make configurable
  -            String props="UDP(mcast_addr=" + lca.getUdpMulticastAddr() + ";mcast_port="
+ lca.getUdpMulticastPort()+ "):PING:MERGE2(min_interval=5000;max_interval=10000):FD:STABLE:NAKACK:UNICAST:"
+
  -             "FRAG:FLUSH:GMS:VIEW_ENFORCER:STATE_TRANSFER:QUEUE";
   
  -            javagroups = new JChannel(props);
  +            javagroups = new JChannel( lca.getJGChannelProperties() );
  +            // don't send local
               javagroups.setOpt(javagroups.LOCAL, Boolean.FALSE);
  -            // could have a channel per region
  -            //javagroups.connect(IJGConstants.DEFAULT_JG_GROUP_NAME);
               javagroups.connect(groupName);
   
           }
  
  
  
  1.4       +7 -7      jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/javagroups/utils/JGRpcOpener.java
  
  Index: JGRpcOpener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/javagroups/utils/JGRpcOpener.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JGRpcOpener.java	11 May 2004 01:04:36 -0000	1.3
  +++ JGRpcOpener.java	14 May 2004 05:00:17 -0000	1.4
  @@ -20,10 +20,10 @@
   import java.io.IOException;
   import java.io.InterruptedIOException;
   
  -import org.javagroups.JChannel;
  -import org.javagroups.Channel;
  -import org.javagroups.blocks.RpcDispatcher;
  -import org.javagroups.blocks.GroupRequest;
  +import org.jgroups.JChannel;
  +import org.jgroups.Channel;
  +import org.jgroups.blocks.RpcDispatcher;
  +import org.jgroups.blocks.GroupRequest;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -94,8 +94,8 @@
           try
           {
   
  -            String props="UDP(mcast_addr=" + ilca.getUdpMulticastAddr() + ";mcast_port="
+ ilca.getUdpMulticastPort()+ "):PING:MERGE2(min_interval=5000;max_interval=10000):FD:STABLE:NAKACK:UNICAST:FLUSH:GMS:VIEW_ENFORCER:QUEUE";
  -            rpcCh = new JChannel(props);
  +            //String props="UDP(mcast_addr=" + ilca.getUdpMulticastAddr() + ";mcast_port="
+ ilca.getUdpMulticastPort()+ "):PING:MERGE2(min_interval=5000;max_interval=10000):FD:STABLE:NAKACK:UNICAST:FLUSH:GMS:VIEW_ENFORCER:QUEUE";
  +            rpcCh = new JChannel(ilca.getJGChannelProperties());
               rpcCh.setOpt(rpcCh.LOCAL, Boolean.FALSE);
               disp = new RpcDispatcher( rpcCh, null, null, ilcl );
               rpcCh.connect(groupName);
  
  
  
  1.5       +14 -0     jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java
  
  Index: ILateralCacheAttributes.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ILateralCacheAttributes.java	15 Apr 2004 19:22:58 -0000	1.4
  +++ ILateralCacheAttributes.java	14 May 2004 05:00:17 -0000	1.5
  @@ -213,4 +213,18 @@
        */
       public boolean getPutOnlyMode();
   
  +    /**
  +     *
  +     * @return String The Javagroups channel propeties.
  +     */
  +    public String getJGChannelProperties();
  +
  +    /**
  +     *
  +     *   Sets the Javagroups channel propeties.
  +     *
  +     * @param channelProperties String
  +     */
  +    public void setJGChannelProperties( String channelProperties );
  +
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-jcs-dev-help@jakarta.apache.org


Mime
View raw message