10 line piece of code for me to understand; Please help if you can

We are running into problems where our BEA instance just hangs and do not respond and even not been able to go and Catch(OFM) exceptions. We wanted in our application that if we do get OFM, we wanted to just catch it and dump the document as not processed and then move onto another request in the queue. First-in-first-out is the requirement.

Please help us understand if following code is bad/ok in dealing with above situation.

byte[] pdfStream =null;

try{

// The following generate PDF Stream

pdfStream = generateDocument(cpRequest, params, document);

if (pdfStream !=null)

{

// successfully create our document

document.setDocumentData(pdfStream);

document.setDocumentStatus(JavaGlobals.NEW_DOC);

document.setDocumentStatusText(JavaGlobals.NEW_DOC_TEXT);

document.setDocumentLength(pdfStream.length);

if (logger.isDebugEnabled()){

logger.debug("call generateOurDocument() successfully");

}

}else{

// Fail to create our document

document.setDocumentStatus(JavaGlobals.FAIL_NEW_DOC);

document.setDocumentStatusText(JavaGlobals.FAIL_NEW_DOC_TEXT);

logger.error("Could not generate our Document");

}

}catch (OutOfMemoryError err){

document.setDocumentStatus(JavaGlobals.SIZE_EXCEEDED_DOC);

document.setDocumentStatusText(JavaGlobals.SIZE_EXCEEDED_DOC_TEXT);

logger.error("Could not generate our Document");

}

[2173 byte] By [kevinlnga] at [2007-11-26 17:31:01]
# 1
So what exactly is happening? How far is it getting?And why does OOME (OoutOfMemoryError) become "OFM"?
jverda at 2007-7-8 23:58:59 > top of Java-index,Java Essentials,New To Java...
# 2
It is getting stuck and just hangs. Even the Garbage Collection is not happening. JUST HANGS.We really do not know how far it is getting as even nothing is logged on to the server log. Sometimes, there is a crash.
kevinlnga at 2007-7-8 23:58:59 > top of Java-index,Java Essentials,New To Java...
# 3

> Please help us understand if following code is bad/ok

> in dealing with above situation.

Who knows.

It seems that you're jumping to conclusions about what's happening in your app. You say it "just hangs," which doesn't particularly sound like out-of-memory. Are you seeing OOM exceptions in a log somewhere?

Why don't you start with running a thread dump when it "just hangs," to find out what's really happening?

Captain.Obviousa at 2007-7-8 23:58:59 > top of Java-index,Java Essentials,New To Java...