activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r835412 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
Date Thu, 12 Nov 2009 15:13:37 GMT
Author: dejanb
Date: Thu Nov 12 15:13:36 2009
New Revision: 835412

URL: http://svn.apache.org/viewvc?rev=835412&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQ-2042 - fix for amq persistence store

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java?rev=835412&r1=835411&r2=835412&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
Thu Nov 12 15:13:36 2009
@@ -695,7 +695,13 @@
     }
     
     public Location writeCommand(DataStructure command, boolean syncHint,boolean forceSync)
throws IOException {
-        return asyncDataManager.write(wireFormat.marshal(command), (forceSync||(syncHint
&& syncOnWrite)));
+    	try {
+    		return asyncDataManager.write(wireFormat.marshal(command), (forceSync||(syncHint &&
syncOnWrite)));
+    	} catch (IOException ioe) {
+    		LOG.error("Failed to write command: " + command + ". Reason: " + ioe, ioe);
+        	stopBroker();
+        	throw ioe;
+        }
     }
 
     private Location writeTraceMessage(String message, boolean sync) throws IOException {
@@ -1085,4 +1091,16 @@
 	           + ".DisableLocking",
 	           "false"));
 	}
+	
+    protected void stopBroker() {
+        new Thread() {
+           public void run() {
+        	   try {
+    	            brokerService.stop();
+    	        } catch (Exception e) {
+    	            LOG.warn("Failure occured while stopping broker", e);
+    	        }    			
+    		}
+    	}.start();
+    }
 }



Mime
View raw message