javauis/javalegacyutils/src/eventserver/JniEnvWrapper.cpp
changeset 76 4ad59aaee882
parent 69 773449708c84
child 79 2f468c1958d0
equal deleted inserted replaced
69:773449708c84 76:4ad59aaee882
     1 /*
       
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "eventserverglobals.h"
       
    20 #include "JniEnvWrapper.h"
       
    21 #include <jni.h>
       
    22 #include <e32def.h>
       
    23 
       
    24 EXPORT_C JNIEnv* JniEnvWrapper::GetValidJniRef()
       
    25 {
       
    26     JNIEnv* aJni;
       
    27     getEsStaticData()->mVm->AttachCurrentThreadAsDaemon((void**)&aJni, 0);
       
    28     return aJni;
       
    29 }
       
    30 
       
    31 void JniEnvWrapper::InitJavaVmRef(JNIEnv* aJni)
       
    32 {
       
    33     JavaVM* vm = getEsStaticData()->mVm;
       
    34     if (vm == NULL)
       
    35     {
       
    36         aJni->GetJavaVM(&getEsStaticData()->mVm);
       
    37     }
       
    38 }