nsAutoMonitor mon(gJavaXPCOMMonitor);
GetNewOrUsedJavaObject(JNIEnv* env, nsISupports* aXPCOMObject,                       const nsIID& aIID, jobject* aResult, PRBool* aIsNewProxy){  NS_PRECONDITION(aResult != nsnull, "null ptr");  if (!aResult)    return NS_ERROR_NULL_POINTER;  if (aIsNewProxy) {    *aIsNewProxy = PR_FALSE;  }  nsresult rv;  nsJavaXPTCStub* stub = nsnull;  aXPCOMObject->QueryInterface(NS_GET_IID(nsJavaXPTCStub), (void**) &stub);  if (stub) {    // Get Java object directly from nsJavaXPTCStub    *aResult = stub->GetJavaObject();    NS_ASSERTION(*aResult != nsnull, "nsJavaXPTCStub w/o matching Java object");    NS_RELEASE(stub);    return NS_OK;  }  // Get associated Java object from hash table  rv = gNativeToJavaProxyMap->Find(env, aXPCOMObject, aIID, aResult);  if (NS_FAILED(rv))    return rv;  if (*aResult)    return NS_OK;  // No Java object is associated with the given XPCOM object, so we  // create a Java proxy.  if (aIsNewProxy) {    *aIsNewProxy = PR_TRUE;  }  return CreateJavaProxy(env, aXPCOMObject, aIID, aResult);}