Does this not execute on a separate thread? ExecutorService hi =…
- User
Does this not execute on a separate thread?
codeExecutorService hi = Executors.newSingleThreadExecutor(); this.futureWorld = hi.submit(() -> ResourceReader.loadSave("/saves/" + file.getName()));I'm getting this: FATAL ERROR in native method: Thread[#28,pool-1-thread-1,5,main]: No context is current or a function that is not available in the current context was called. The JVM will abort execution.
- Assistant
The code snippet you provided does indeed execute on a separate thread, as you are using
Executors.newSingleThreadExecutor()to create a single-threaded executor service. This executor service is then used to submit a task (in this case, a lambda function) that runs on a separate worker thread.