Patches item #758131, was opened at 2003-06-20 19:41
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376687&aid=758131&group_id=22866
Category: JBossMQ
Group: v2.4 (stable)
Status: Open
Resolution: None
Priority: 5
Submitted By: Dennis M. Kremer (kremerd)
Assigned to: Nobody/Anonymous (nobody)
Summary: FilePM - MessageLog Fault Tolerance
Initial Comment:
On occassion in production environments I've run into
situations where machines run out of disk space or files
inadvertantly get placed into the QUEUE directories for
the File Based persistence manager.
When this happens and jboss restarts, I wind up with
Corrupted Messages in the QUEUE folders but the
MessageLog class will stop processing or re-constituting
the rest of the messages in the QUEUE folder after it
hits the first corrupt message resulting in message loss
for the application.
I've added a bit of fault tolerance to the File PM
MessageLog to log corrupt messages and then mark the
file for deletion; then go onto the next message.
This way corrupt messages are cleaned up and good
messages are found on restart and delivered.
Here's the old code:
protected void restoreMessageFromFile(
java.util.TreeMap store, File file )
throws Exception
{
ObjectInputStream in = new ObjectInputStream(
new FileInputStream( file ) );
long msgId = in.readLong();
SpyMessage message = SpyMessage.readMessage(
in );
in.close();
message.messageId = msgId;
message.persistData = file;
store.put( new Long( msgId ), message );
}
Here's my patch:
protected void restoreMessageFromFile(
java.util.TreeMap store, File file )
throws Exception
{
try{
ObjectInputStream in = new ObjectInputStream(
new FileInputStream( file ) );
long msgId = in.readLong();
SpyMessage message = SpyMessage.readMessage(
in );
in.close();
message.messageId = msgId;
message.persistData = file;
store.put( new Long( msgId ), message );
}catch(Throwable t){
log.warn("JBOSSMQ File:" + file.getAbsoluteFile()
+ " could not be recovered.");
log.warn(t);
try{
file.deleteOnExit();
}catch(Throwable tt){
log.info(tt);
}
}
}
-Dennis Kremer
[EMAIL PROTECTED]
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376687&aid=758131&group_id=22866
-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development