javacommons/utils/javasrc/com/nokia/mj/impl/rt/j9/JvmPortCldc.java
changeset 21 2a9601315dfc
child 80 d6dafc5d983f
equal deleted inserted replaced
18:e8e63152f320 21:2a9601315dfc
       
     1 /*
       
     2 * Copyright (c) 2008 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 package com.nokia.mj.impl.rt.j9;
       
    19 
       
    20 import com.ibm.oti.vm.VM;
       
    21 /**
       
    22  *
       
    23  * @author Nokia Corporation
       
    24  * @version 1.0
       
    25  */
       
    26 
       
    27 public final class JvmPortCldc extends JvmPortCommon
       
    28 {
       
    29     /**
       
    30      * @see com.nokia.mj.impl.runtimesupport.JvmPort#loadSystemLibrary.
       
    31      */
       
    32     public final void loadSystemLibrary(String libName)
       
    33     {
       
    34         try
       
    35         {
       
    36             VM.loadLibrary(libName);
       
    37         }
       
    38         catch (Exception e)
       
    39         {
       
    40             e.printStackTrace();
       
    41             throw new RuntimeException("Not able to load library "+libName+". Reason is: "+e);
       
    42         }
       
    43     }
       
    44 
       
    45     /**
       
    46      * @see com.nokia.mj.impl.runtimesupport.JvmPort#loadApplicationClass.
       
    47      */
       
    48     public final Class loadApplicationClass(String name) throws ClassNotFoundException
       
    49     {
       
    50         return Class.forName(name);
       
    51     }
       
    52 
       
    53     /**
       
    54      * @see com.nokia.mj.impl.runtimesupport.JvmPort#setThreadAsDaemon.
       
    55      */
       
    56     public final void setThreadAsDaemon(Thread thread, boolean daemon)
       
    57     throws IllegalThreadStateException, SecurityException
       
    58     {
       
    59         if (daemon)
       
    60         {
       
    61             VM.setDaemonThread(thread);
       
    62         }
       
    63         else
       
    64         {
       
    65             throw new RuntimeException("Setting thread as non-daemon not supported");
       
    66         }
       
    67     }
       
    68 
       
    69     /**
       
    70      * @see com.nokia.mj.impl.runtimesupport.JvmPort#runFinalization.
       
    71      */
       
    72     public final void runFinalization()
       
    73     {
       
    74         VM.runFinalization();
       
    75     }
       
    76 
       
    77     /**
       
    78      * Enables finalization for given class.
       
    79      * @param clazz The class to be finalized.
       
    80      */
       
    81     public final void enableFinalization(Class clazz)
       
    82     {
       
    83         VM.enableFinalization(clazz);
       
    84     }
       
    85 
       
    86 }