tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject svn commit: r382473 - /tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/
Date Thu, 02 Mar 2006 19:11:27 GMT
Author: fhanik
Date: Thu Mar  2 11:11:24 2006
New Revision: 382473

URL: http://svn.apache.org/viewcvs?rev=382473&view=rev
Log:
More refactoring for parallelism

Added:
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/DataSenderFactory.java
      - copied, changed from r382472, tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/IDataSenderFactory.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/SinglePointDataSender.java
      - copied, changed from r382472, tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/DataSender.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/SinglePointSender.java
      - copied, changed from r382472, tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/IDataSender.java
Removed:
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/DataSender.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/IDataSender.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/IDataSenderFactory.java
Modified:
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/FastAsyncSocketSender.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/PooledSocketSender.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReplicationTransmitter.java

Copied: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/DataSenderFactory.java
(from r382472, tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/IDataSenderFactory.java)
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/DataSenderFactory.java?p2=tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/DataSenderFactory.java&p1=tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/IDataSenderFactory.java&r1=382472&r2=382473&rev=382473&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/IDataSenderFactory.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/DataSenderFactory.java
Thu Mar  2 11:11:24 2006
@@ -31,13 +31,14 @@
  * <code>org/apache/catalina/tribes/tcp/DataSenders.properties</code> resource.
  * 
  * @author Peter Rossbach
+ * @author Filip Hanik
  * @version $Revision: 304032 $ $Date: 2005-07-27 10:11:55 -0500 (Wed, 27 Jul 2005) $
  * @since 5.5.7
  */
-public class IDataSenderFactory {
+public class DataSenderFactory {
 
     private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory
-            .getLog(IDataSenderFactory.class);
+            .getLog(DataSenderFactory.class);
     
     private static final String DATASENDERS_PROPERTIES = "org/apache/catalina/tribes/tcp/DataSenders.properties";
     public static final String SYNC_MODE = "synchronous";
@@ -58,15 +59,15 @@
      */
     private static final String info = "IDataSenderFactory/2.0";
 
-    private IDataSenderFactory() {
+    private DataSenderFactory() {
     }
 
     private Properties senderModes;
 
-    private static IDataSenderFactory factory ;
+    private static DataSenderFactory factory ;
 
     static {
-        factory = new IDataSenderFactory();
+        factory = new DataSenderFactory();
         factory.loadSenderModes();
     }
 
@@ -90,10 +91,10 @@
      * @return new sender object
      * @throws java.io.IOException
      */
-    public synchronized static IDataSender getIDataSender(String mode,
+    public synchronized static SinglePointSender getIDataSender(String mode,
             Member mbr) throws java.io.IOException {
        // Identify the class name of the DataSender we should configure
-       IDataSender sender = factory.getSender(mode,mbr);
+       SinglePointSender sender = factory.getSender(mode,mbr);
        if(sender == null)
            throw new java.io.IOException("Invalid replication mode=" + mode);          
        return sender ;    
@@ -125,8 +126,8 @@
         return senderModes != null && senderModes.containsKey(mode) ;           
     }
 
-    private IDataSender getSender(String mode,Member mbr) {
-        IDataSender sender = null;
+    private SinglePointSender getSender(String mode,Member mbr) {
+        SinglePointSender sender = null;
         String senderName = null;
         senderName = senderModes.getProperty(mode);
         if (senderName != null) {
@@ -144,7 +145,7 @@
                     paramValues[0] = mbr.getDomain();
                     paramValues[1] = InetAddress.getByAddress(mbr.getHost());
                     paramValues[2] = new Integer(mbr.getPort());
-                    sender = (IDataSender) constructor.newInstance(paramValues);
+                    sender = (SinglePointSender) constructor.newInstance(paramValues);
                 } else {
                     log.error(sm.getString("IDataSender.senderModes.Instantiate",
                             senderName));
@@ -163,7 +164,7 @@
         // Load our mapping properties if necessary
         if (senderModes == null) {
             try {
-                InputStream is = IDataSender.class
+                InputStream is = SinglePointSender.class
                         .getClassLoader()
                         .getResourceAsStream(
                                 DATASENDERS_PROPERTIES);

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/FastAsyncSocketSender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/FastAsyncSocketSender.java?rev=382473&r1=382472&r2=382473&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/FastAsyncSocketSender.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/FastAsyncSocketSender.java
Thu Mar  2 11:11:24 2006
@@ -46,7 +46,7 @@
  * @version $Revision: 366253 $ $Date: 2006-01-05 13:30:42 -0600 (Thu, 05 Jan 2006) $
  * @since 5.5.9
  */
-public class FastAsyncSocketSender extends DataSender {
+public class FastAsyncSocketSender extends SinglePointDataSender {
 
     private static int threadCounter = 1;
 

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/PooledSocketSender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/PooledSocketSender.java?rev=382473&r1=382472&r2=382473&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/PooledSocketSender.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/PooledSocketSender.java
Thu Mar  2 11:11:24 2006
@@ -31,7 +31,7 @@
  * @version 1.2
  */
 
-public class PooledSocketSender extends DataSender {
+public class PooledSocketSender extends SinglePointDataSender {
 
     private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory
             .getLog(org.apache.catalina.tribes.tcp.PooledSocketSender.class);
@@ -119,7 +119,7 @@
                     connect();
             }
         }
-        DataSender sender = senderQueue.getSender(0);
+        SinglePointDataSender sender = senderQueue.getSender(0);
         if (sender == null) {
             log.warn(sm.getString("PoolSocketSender.noMoreSender", this.getAddress(), new
Integer(this.getPort())));
             return;
@@ -186,8 +186,8 @@
             return queue.size();
         }
 
-        public DataSender getSender(long timeout) {
-            DataSender sender = null;
+        public SinglePointDataSender getSender(long timeout) {
+            SinglePointDataSender sender = null;
             long start = System.currentTimeMillis();
             long delta = 0;
             do {
@@ -196,7 +196,7 @@
                         throw new IllegalStateException(
                                 "Socket pool is closed.");
                     if (queue.size() > 0) {
-                        sender = (DataSender) queue.removeFirst();
+                        sender = (SinglePointDataSender) queue.removeFirst();
                     } else if (inuse.size() < limit) {
                         sender = getNewDataSender();
                     } else {
@@ -217,7 +217,7 @@
             return sender;
         }
 
-        public void returnSender(DataSender sender) {
+        public void returnSender(SinglePointDataSender sender) {
             //to do
             synchronized (mutex) {
                 queue.add(sender);
@@ -226,9 +226,9 @@
             }
         }
 
-        private DataSender getNewDataSender() {
+        private SinglePointDataSender getNewDataSender() {
             //new DataSender(
-            DataSender sender = new DataSender(getDomain(),
+            SinglePointDataSender sender = new SinglePointDataSender(getDomain(),
                                                parent.getAddress(),
                                                parent.getPort(),
                                                parent.getSenderState() );
@@ -246,11 +246,11 @@
         public void close() {
             synchronized (mutex) {
                 for (int i = 0; i < queue.size(); i++) {
-                    DataSender sender = (DataSender) queue.get(i);
+                    SinglePointDataSender sender = (SinglePointDataSender) queue.get(i);
                     sender.disconnect();
                 }//for
                 for (int i = 0; i < inuse.size(); i++) {
-                    DataSender sender = (DataSender) inuse.get(i);
+                    SinglePointDataSender sender = (SinglePointDataSender) inuse.get(i);
                     sender.disconnect();
                 }//for
                 queue.clear();

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReplicationTransmitter.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReplicationTransmitter.java?rev=382473&r1=382472&r2=382473&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReplicationTransmitter.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReplicationTransmitter.java
Thu Mar  2 11:11:24 2006
@@ -190,7 +190,7 @@
      * @param mode
      */
     public void setReplicationMode(String mode) {
-        String msg = IDataSenderFactory.validateMode(mode);
+        String msg = DataSenderFactory.validateMode(mode);
         if (msg == null) {
             if (log.isDebugEnabled())
                 log.debug("Setting replication mode to " + mode);
@@ -343,8 +343,8 @@
      * @deprecated since version 5.5.7
      */
     public boolean getIsSenderSynchronized() {
-        return IDataSenderFactory.SYNC_MODE.equals(replicationMode)
-                || IDataSenderFactory.POOLED_SYNC_MODE.equals(replicationMode);
+        return DataSenderFactory.SYNC_MODE.equals(replicationMode)
+                || DataSenderFactory.POOLED_SYNC_MODE.equals(replicationMode);
     }
 
     // ------------------------------------------------------------- dynamic
@@ -421,7 +421,7 @@
         }
         try {
             Object key = getKey(destination);
-            IDataSender sender = (IDataSender) map.get(key);
+            SinglePointSender sender = (SinglePointSender) map.get(key);
             sendMessageData(message, sender);
         } finally {
             if (doTransmitterProcessingStats) {
@@ -473,7 +473,7 @@
     public synchronized void stop() {
         Iterator i = map.entrySet().iterator();
         while (i.hasNext()) {
-            IDataSender sender = (IDataSender) ((java.util.Map.Entry) i.next())
+            SinglePointSender sender = (SinglePointSender) ((java.util.Map.Entry) i.next())
                     .getValue();
             try {
                 sender.disconnect();
@@ -503,7 +503,7 @@
         if (map.size() > 0) {
             java.util.Iterator iter = map.entrySet().iterator();
             while (iter.hasNext()) {
-                IDataSender sender = (IDataSender) ((java.util.Map.Entry) iter
+                SinglePointSender sender = (SinglePointSender) ((java.util.Map.Entry) iter
                         .next()).getValue();
                 if (sender != null)
                     sender.checkKeepAlive();
@@ -516,12 +516,12 @@
      * 
      * @return The senders
      */
-    public IDataSender[] getSenders() {
+    public SinglePointSender[] getSenders() {
         java.util.Iterator iter = map.entrySet().iterator();
-        IDataSender[] array = new IDataSender[map.size()];
+        SinglePointSender[] array = new SinglePointSender[map.size()];
         int i = 0;
         while (iter.hasNext()) {
-            IDataSender sender = (IDataSender) ((java.util.Map.Entry) iter
+            SinglePointSender sender = (SinglePointSender) ((java.util.Map.Entry) iter
                     .next()).getValue();
             if (sender != null)
                 array[i] = sender;
@@ -552,7 +552,7 @@
         try {
             Object key = getKey(member);
             if (!map.containsKey(key)) {
-                IDataSender sender = IDataSenderFactory.getIDataSender(replicationMode, member);
+                SinglePointSender sender = DataSenderFactory.getIDataSender(replicationMode,
member);
                 if ( sender!= null ) {
                     transferSenderProperty(sender);
                     sender.setRxBufSize(getRxBufSize());
@@ -572,7 +572,7 @@
      */
     public synchronized void remove(Member member) {
         Object key = getKey(member);
-        IDataSender toberemoved = (IDataSender) map.get(key);
+        SinglePointSender toberemoved = (SinglePointSender) map.get(key);
         if (toberemoved == null)
             return;
         toberemoved.disconnect();
@@ -603,7 +603,7 @@
      * 
      * @param sender
      */
-    protected void transferSenderProperty(IDataSender sender) {
+    protected void transferSenderProperty(SinglePointSender sender) {
         for (Iterator iter = getPropertyNames(); iter.hasNext();) {
             String pkey = (String) iter.next();
             Object value = getProperty(pkey);
@@ -636,7 +636,7 @@
      * @throws java.io.IOException If an error occurs
      */
     protected void sendMessageData(ChannelMessage data,
-                                   IDataSender sender) throws IOException {
+                                   SinglePointSender sender) throws IOException {
         if (sender == null)
             throw new RuntimeException("Sender not available. Make sure sender information
is available to the ReplicationTransmitter.");
         try {

Copied: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/SinglePointDataSender.java
(from r382472, tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/DataSender.java)
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/SinglePointDataSender.java?p2=tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/SinglePointDataSender.java&p1=tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/DataSender.java&r1=382472&r2=382473&rev=382473&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/DataSender.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/SinglePointDataSender.java
Thu Mar  2 11:11:24 2006
@@ -37,9 +37,9 @@
  * @version $Revision: 377484 $ $Date: 2006-02-13 15:00:05 -0600 (Mon, 13 Feb 2006) $
  * @since 5.5.16
  */
-public class DataSender implements IDataSender {
+public class SinglePointDataSender implements SinglePointSender {
 
-    private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(DataSender.class);
+    private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(SinglePointDataSender.class);
 
     /**
      * The string manager for this package.
@@ -228,7 +228,7 @@
 
     // ------------------------------------------------------------- Constructor
     
-    public DataSender(String domain,InetAddress host, int port) {
+    public SinglePointDataSender(String domain,InetAddress host, int port) {
         this.address = host;
         this.port = port;
         this.domain = domain;
@@ -236,11 +236,11 @@
             log.debug(sm.getString("IDataSender.create",address, new Integer(port)));
     }
 
-    public DataSender(String domain,InetAddress host, int port, SenderState state) {
+    public SinglePointDataSender(String domain,InetAddress host, int port, SenderState state)
{
         this(domain,host,port);
         if ( state != null ) this.senderState = state;
     }
-    public DataSender(String domain,InetAddress host, int port, SenderState state, int rxBufSize,
int txBufSize) {
+    public SinglePointDataSender(String domain,InetAddress host, int port, SenderState state,
int rxBufSize, int txBufSize) {
         this(domain,host,port,state);
         this.rxBufSize = rxBufSize;
         this.txBufSize = txBufSize;

Copied: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/SinglePointSender.java
(from r382472, tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/IDataSender.java)
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/SinglePointSender.java?p2=tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/SinglePointSender.java&p1=tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/IDataSender.java&r1=382472&r2=382473&rev=382473&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/IDataSender.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/SinglePointSender.java
Thu Mar  2 11:11:24 2006
@@ -25,7 +25,7 @@
  * @since 5.5.7
  */
 
-public interface IDataSender
+public interface SinglePointSender
 {
     public void setAddress(java.net.InetAddress address);
     public java.net.InetAddress getAddress();



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


Mime
View raw message