[jboss-cvs] JBoss Messaging SVN: r4998 - branches/Branch_1_4/src/main/org/jboss/jms/server/bridge.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Sep 22 06:24:22 EDT 2008


Author: timfox
Date: 2008-09-22 06:24:21 -0400 (Mon, 22 Sep 2008)
New Revision: 4998

Modified:
   branches/Branch_1_4/src/main/org/jboss/jms/server/bridge/Bridge.java
   branches/Branch_1_4/src/main/org/jboss/jms/server/bridge/BridgeService.java
Log:
https://jira.jboss.org/jira/browse/JBMESSAGING-1407


Modified: branches/Branch_1_4/src/main/org/jboss/jms/server/bridge/Bridge.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/jms/server/bridge/Bridge.java	2008-09-22 09:42:01 UTC (rev 4997)
+++ branches/Branch_1_4/src/main/org/jboss/jms/server/bridge/Bridge.java	2008-09-22 10:24:21 UTC (rev 4998)
@@ -133,6 +133,8 @@
       
       trace = log.isTraceEnabled();
    }
+   
+   private String name;
 
    private String sourceUsername;
    
@@ -270,6 +272,8 @@
       this.clientID = clientID;
       
       this.addMessageIDInHeader = addMessageIDInHeader;
+      
+      this.name = "Bridge-" + System.identityHashCode(this);
               
       if (trace)
       {
@@ -284,7 +288,7 @@
    {
       if (started)
       {
-         log.warn("Attempt to start, but is already started");
+         log.warn(name + " Attempt to start, but is already started");
          return;
       }
       
@@ -340,7 +344,7 @@
       }
       else
       {
-         log.warn("Failed to start bridge");
+         log.warn(name + " Failed to start bridge");
          handleFailureOnStartup();
       }
    }
@@ -349,7 +353,7 @@
    {
       if (!started)
       {
-         log.warn("Attempt to stop, but is already stopped");
+         log.warn(name + " Attempt to stop, but is already stopped");
          return;
       }
       
@@ -419,6 +423,16 @@
    
    // Public ---------------------------------------------------------------------------
    
+   public String getName()
+   {
+      return this.name;
+   }
+   
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+   
    public synchronized void pause() throws Exception
    {
       if (trace) { log.trace("Pausing " + this); }
@@ -456,7 +470,7 @@
    {
    	if (started)
    	{
-   		log.warn("Cannot set SourceDestinationFactory while bridge is started");
+   		log.warn(name + " Cannot set SourceDestinationFactory while bridge is started");
    		return;
    	}
    	sourceDestinationFactory = dest;
@@ -471,7 +485,7 @@
    {
    	if (started)
    	{
-   		log.warn("Cannot set TargetDestinationFactory while bridge is started");
+   		log.warn(name + " Cannot set TargetDestinationFactory while bridge is started");
    		return;
    	}
    	targetDestinationFactory = dest;
@@ -486,7 +500,7 @@
    {
       if (started)
       {
-         log.warn("Cannot set SourceUsername while bridge is started");
+         log.warn(name + " Cannot set SourceUsername while bridge is started");
          return;
       }
       sourceUsername = name;
@@ -501,7 +515,7 @@
    {
       if (started)
       {
-         log.warn("Cannot set SourcePassword while bridge is started");
+         log.warn(name + " Cannot set SourcePassword while bridge is started");
          return;
       }
       sourcePassword = pwd;
@@ -516,7 +530,7 @@
    {
       if (started)
       {
-         log.warn("Cannot set DestUserName while bridge is started");
+         log.warn(name + " Cannot set DestUserName while bridge is started");
          return;
       }
       this.targetUsername = name;
@@ -531,7 +545,7 @@
    {
       if (started)
       {
-         log.warn("Cannot set DestPassword while bridge is started");
+         log.warn(name + " Cannot set DestPassword while bridge is started");
          return;
       }
       this.targetPassword = pwd;
@@ -546,7 +560,7 @@
    {
       if (started)
       {
-         log.warn("Cannot set Selector while bridge is started");
+         log.warn(name + " Cannot set Selector while bridge is started");
          return;
       }
       this.selector = selector;
@@ -561,7 +575,7 @@
    {
       if (started)
       {
-         log.warn("Cannot set FailureRetryInterval while bridge is started");
+         log.warn(name + " Cannot set FailureRetryInterval while bridge is started");
          return;
       }
       
@@ -577,7 +591,7 @@
    {
       if (started)
       {
-         log.warn("Cannot set MaxRetries while bridge is started");
+         log.warn(name + " Cannot set MaxRetries while bridge is started");
          return;
       }
       
@@ -593,7 +607,7 @@
    {
       if (started)
       {
-         log.warn("Cannot set QualityOfServiceMode while bridge is started");
+         log.warn(name + " Cannot set QualityOfServiceMode while bridge is started");
          return;
       }
       
@@ -609,7 +623,7 @@
    {
       if (started)
       {
-         log.warn("Cannot set MaxBatchSize while bridge is started");
+         log.warn(name + " Cannot set MaxBatchSize while bridge is started");
          return;
       }
       
@@ -625,7 +639,7 @@
    {
       if (started)
       {
-         log.warn("Cannot set MaxBatchTime while bridge is started");
+         log.warn(name + " Cannot set MaxBatchTime while bridge is started");
          return;
       }
       
@@ -641,7 +655,7 @@
    {
       if (started)
       {
-         log.warn("Cannot set SubName while bridge is started");
+         log.warn(name + " Cannot set SubName while bridge is started");
          return;
       }
       
@@ -657,7 +671,7 @@
    {
       if (started)
       {
-         log.warn("Cannot set ClientID while bridge is started");
+         log.warn(name + " Cannot set ClientID while bridge is started");
          return;
       }
       
@@ -693,7 +707,7 @@
    {
       if (started)
       {
-         log.warn("Cannot set SourceConnectionFactoryFactory while bridge is started");
+         log.warn(name + " Cannot set SourceConnectionFactoryFactory while bridge is started");
          return;
       }
       this.sourceCff = cff;
@@ -703,7 +717,7 @@
    {
       if (started)
       {
-         log.warn("Cannot set DestConnectionFactoryFactory while bridge is started");
+         log.warn(name + " Cannot set DestConnectionFactoryFactory while bridge is started");
          return;
       }
       this.targetCff = cff;
@@ -1069,7 +1083,7 @@
       }
       catch (Exception e)
       {
-         log.warn("Failed to set up connections", e);
+         log.warn(name + " Failed to set up connections", e);
          
          //If this fails we should attempt to cleanup or we might end up in some weird state
          
@@ -1163,7 +1177,7 @@
             break;
          }
          
-         log.warn("Failed to set up connections, will retry after a pause of " + failureRetryInterval + " ms");
+         log.warn(name + " Failed to set up connections, will retry after a pause of " + failureRetryInterval + " ms");
          
          pause(failureRetryInterval);
       }
@@ -1219,7 +1233,7 @@
       }
       catch (Exception e)
       {
-         log.warn("Failed to send + acknowledge batch, closing JMS objects", e);
+         log.warn(name + " Failed to send + acknowledge batch, closing JMS objects", e);
       
          handleFailureOnSend();                                                 
       }	
@@ -1250,7 +1264,7 @@
       }
       catch (Exception e)
       {
-         log.warn("Failed to send + acknowledge batch, closing JMS objects", e);
+         log.warn(name + " Failed to send + acknowledge batch, closing JMS objects", e);
       
          handleFailureOnSend();                                                 
       }
@@ -1273,7 +1287,7 @@
       }
       catch (Exception e)
       {
-         log.warn("Failed to send + acknowledge batch, closing JMS objects", e);
+         log.warn(name + " Failed to send + acknowledge batch, closing JMS objects", e);
       
          handleFailureOnSend();                                                 
       }
@@ -1453,7 +1467,7 @@
 
       protected void succeeded()
       {
-         log.info("Succeeded in reconnecting to servers");
+         log.info(name + " Succeeded in reconnecting to servers");
          
          synchronized (lock)
          {
@@ -1466,7 +1480,7 @@
       protected void failed()
       {
          //We haven't managed to recreate connections or maxRetries = 0
-         log.warn("Unable to set up connections, bridge will be stopped");
+         log.warn(name + " Unable to set up connections, bridge will be stopped");
          
          try
          {                  
@@ -1490,7 +1504,7 @@
          
          if (maxRetries > 0 || maxRetries == -1)
          {
-            log.warn("Will retry after a pause of " + failureRetryInterval + " ms");
+            log.warn(name + " Will retry after a pause of " + failureRetryInterval + " ms");
             
             pause(failureRetryInterval);
             
@@ -1514,13 +1528,13 @@
       protected void failed()
       {
          // Don't call super
-         log.warn("Unable to set up connections, bridge will not be started");
+         log.warn(name + " Unable to set up connections, bridge will not be started");
       }
       
       protected void succeeded()
       {
          // Don't call super - a bit ugly in this case but better than taking the lock twice.
-         log.info("Succeeded in connecting to servers");
+         log.info(name + " Succeeded in connecting to servers");
          
          synchronized (lock)
          {
@@ -1632,7 +1646,7 @@
    {
 		public void onException(JMSException e)
 		{
-			log.warn("Detected failure on connection", e);
+			log.warn(name + " Detected failure on connection", e);
 			
 			synchronized (lock)
 			{

Modified: branches/Branch_1_4/src/main/org/jboss/jms/server/bridge/BridgeService.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/jms/server/bridge/BridgeService.java	2008-09-22 09:42:01 UTC (rev 4997)
+++ branches/Branch_1_4/src/main/org/jboss/jms/server/bridge/BridgeService.java	2008-09-22 10:24:21 UTC (rev 4998)
@@ -351,6 +351,8 @@
       	destCff= new JNDIConnectionFactoryFactory(targetProps, targetCFRef);
       }
       
+      bridge.setName(serviceName.getCanonicalName());
+      
       bridge.setSourceConnectionFactoryFactory(sourceCff);
       
       bridge.setDestConnectionFactoryFactory(destCff);




More information about the jboss-cvs-commits mailing list