VMThread.java

本文详细解析了VMThread类的结构和关键方法,包括堆栈大小配置、线程启动、中断处理等核心功能,并讨论了不支持的线程方法的替代方案。
下载 VMThread.java
001 /**
002  * Copyright (C) 2007 The Android Open Source Project
003  *
004  * Licensed under the Apache License, Version 2.0 (the "License");
005  * you may not use this file except in compliance with the License.
006  * You may obtain a copy of the License at
007  *
008  *      http://www.apache.org/licenses/LICENSE-2.0
009  *
010  * Unless required by applicable law or agreed to in writing, software
011  * distributed under the License is distributed on an "AS IS" BASIS,
012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013  * See the License for the specific language governing permissions and
014  * limitations under the License.
015  */
016  
017 package java.lang;
018  
019 import java.util.logging.Logger;
020 import java.util.logging.Level;
021  
022 class VMThread
023 {
024     Thread thread;
025     int vmData;
026  
027     VMThread(Thread t) {
028         thread = t;
029     }
030  
031     native static void create(Thread t, long stacksize);
032  
033     static native Thread currentThread();
034     static native boolean interrupted();
035     static native void sleep (long msec, int nsec) throws InterruptedException;
036     static native void yield();
037  
038     native void interrupt();
039  
040     native boolean isInterrupted();
041  
042     /***
043      *  Starts the VMThread (and thus the Java Thread) with the given
044      *  stacksize.
045      *
046      * @param stacksize
047      *                 The desired stacksize.
048      */
049     void start(long stacksize) {
050         VMThread.create(thread, stacksize);
051     }
052  
053     private static final String UNSUPPORTED_THREAD_METHOD
054             "Deprecated Thread methods are not supported.";
055  
056     /***
057      * Suspends the Thread.
058      */
059     @SuppressWarnings("ThrowableInstanceNeverThrown")
060     void suspend() {
061         Logger.global.log(Level.SEVERE, UNSUPPORTED_THREAD_METHOD,
062                 new UnsupportedOperationException());
063     }
064  
065     /***
066      * Resumes the Thread, assuming it is suspended.
067      */
068     @SuppressWarnings("ThrowableInstanceNeverThrown")
069     void resume() {
070         Logger.global.log(Level.SEVERE, UNSUPPORTED_THREAD_METHOD,
071                 new UnsupportedOperationException());
072     }
073  
074     /***
075      * Queries whether this Thread holds a monitor lock on the
076      * given object.
077      */
078     native boolean holdsLock(Object object);
079  
080     /***
081      * Stops the Thread, passing it a Throwable (which might be ThreadDeath).
082      */
083     @SuppressWarnings("ThrowableInstanceNeverThrown")
084     void stop(Throwable throwable) {
085         Logger.global.log(Level.SEVERE, UNSUPPORTED_THREAD_METHOD,
086                 new UnsupportedOperationException());
087     }
088  
089     native void setPriority(int newPriority);
090     native int getStatus();
091  
092     /***
093      * Holds a mapping from native Thread statii to Java one. Required for
094      * translating back the result of getStatus().
095      */
096     static final Thread.State[] STATE_MAP = new Thread.State[] {
097         Thread.State.TERMINATED,     // ZOMBIE
098         Thread.State.RUNNABLE,       // RUNNING
099         Thread.State.TIMED_WAITING,  // TIMED_WAIT
100         Thread.State.BLOCKED,        // MONITOR
101         Thread.State.WAITING,        // WAIT
102         Thread.State.NEW,            // INITIALIZING
103         Thread.State.NEW,            // STARTING
104         Thread.State.RUNNABLE,       // NATIVE
105         Thread.State.WAITING         // VMWAIT
106     };
107  
108     /***
109      * Tell the VM that the thread's name has changed.  This is useful for
110      * DDMS, which would otherwise be oblivious to Thread.setName calls.
111      */
112     native void nameChanged(String newName);
113 }
`function: doPartContextMenu -- file: ISVehicleMechanics. lua line # 226 | Vanilla function: onListRightMouseUp -- file: ISVehicleMechanics. lua line # 204 | Vanilla java.lang.RuntimeException: attempted index: isEmpty of non-table: null at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1462) at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:458) at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:166) at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1754) at se.krka.kahlua.vm.KahluaThread.pcallBoolean(KahluaThread.java:1690) at se.krka.kahlua.integration.LuaCaller.protectedCallBoolean(LuaCaller.java:96) at zombie.ui.UIElement.onRightMouseUp(UIElement.java:1695) at zombie.ui.UIElement.onRightMouseUp(UIElement.java:1660) at zombie.ui.UIElement.onConsumeMouseButtonUp(UIElement.java:1518) at zombie.ui.UIManager.updateMouseButtons(UIManager.java:742) at zombie.ui.UIManager.update(UIManager.java:615) at zombie.GameWindow.logic(GameWindow.java:298) at zombie.GameWindow.frameStep(GameWindow.java:790) at zombie.GameWindow.mainThreadStep(GameWindow.java:552) at zombie.MainThread.mainLoop(MainThread.java:68) at java.base/java.lang.Thread.run(Unknown Source) ``attempted index: isEmpty of non-table: null java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method. invoke(Unknown Source) at se.krka.kahlua.integration.expose.caller.MethodCaller.call(MethodCaller.java:60) at se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:206) at se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:196) at se.krka.kahlua.vm.KahluaThread.callJava(KahluaThread.java:182) at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:803) at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:166) at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1754) at se.krka.kahlua.vm.KahluaThread.pcallBoolean(KahluaThread.java:1690) at se.krka.kahlua.integration.LuaCaller.protectedCallBoolean(LuaCaller.java:96) at zombie.ui.UIElement.onRightMouseUp(UIElement.java:1695) at zombie.ui.UIElement.onRightMouseUp(UIElement.java:1660) at zombie.ui.UIElement.onConsumeMouseButtonUp(UIElement.java:1518) at zombie.ui.UIManager.updateMouseButtons(UIManager.java:742) at zombie.ui.UIManager.update(UIManager.java:615) at zombie.GameWindow.logic(GameWindow.java:298) at zombie.GameWindow.frameStep(GameWindow.java:790) at zombie.GameWindow.mainThreadStep(GameWindow.java:552) at zombie.MainThread.mainLoop(MainThread.java:68) at java.base/java.lang.Thread.run(Unknown Source) Caused by: java.lang.NullPointerException: Cannot invoke "java.util.ArrayList. contains(Object)" because the return value of "zombie.scripting.objects.Fixing. getRequiredItem()" is null at zombie.inventory.FixingManager.getFixes(FixingManager.java:30) ... 23 more ``Callframe at: getFixes function: doPartContextMenu -- file: ISVehicleMechanics. lua line # 225 | Vanilla function: onListRightMouseUp -- file: ISVehicleMechanics. lua line # 204 | Vanilla `这些是僵尸毁灭工程的一些报错,能看出来是哪些模组造成的吗
11-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值