javamanager/javaregistry/legacy/server/src/javaregserverscheduler.cpp
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  javaregserverscheduler implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 #include "javaregserverscheduler.h"
       
    21 #include "javaregserver.h"
       
    22 
       
    23 using namespace Java::Manager::Registry;
       
    24 
       
    25 // LOCAL CONSTANTS
       
    26 _LIT(KNameJavaRegServerThread, "JavaRegServerThread");
       
    27 
       
    28 
       
    29 // ---------------------------------------------------------------------------
       
    30 // ThreadStart
       
    31 // ---------------------------------------------------------------------------
       
    32 TInt CJavaRegServerScheduler::ThreadStart()
       
    33 {
       
    34     TInt err = KErrNoMemory;
       
    35 
       
    36     // get cleanup stack
       
    37     CTrapCleanup* cleanup = CTrapCleanup::New();
       
    38 
       
    39     // initialize all up to and including starting scheduler
       
    40     if (cleanup)
       
    41     {
       
    42         TRAP(err, CreateAndRunServerL());
       
    43         delete cleanup;
       
    44     }
       
    45 
       
    46     return err;
       
    47 }
       
    48 
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 // CreateAndRunServerL
       
    52 // ---------------------------------------------------------------------------
       
    53 void CJavaRegServerScheduler::CreateAndRunServerL()
       
    54 {
       
    55     // Rename thread
       
    56     TInt err = User::RenameThread(KNameJavaRegServerThread);
       
    57     __ASSERT_DEBUG(err == KErrNone, User::Invariant());
       
    58 
       
    59     // construct active scheduler
       
    60     CJavaRegServerScheduler*  self = new(ELeave) CJavaRegServerScheduler;
       
    61     CleanupStack::PushL(self);
       
    62     CActiveScheduler::Install(self);
       
    63 
       
    64     // construct server
       
    65     self->iServer = CJavaRegServer::NewL();
       
    66 
       
    67     // Initialisation complete, now signal the client
       
    68     RProcess::Rendezvous(KErrNone);
       
    69 
       
    70     CActiveScheduler::Start();
       
    71 
       
    72     // Destroy the scheduler
       
    73     CleanupStack::PopAndDestroy(self);
       
    74 }
       
    75 
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // Destructor
       
    79 // ---------------------------------------------------------------------------
       
    80 CJavaRegServerScheduler::~CJavaRegServerScheduler()
       
    81 {
       
    82     delete iServer;
       
    83 }
       
    84 
       
    85 // End of File
       
    86