Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » JDT Debug IncompatibleThreadStateException when invoking invokeMethod
JDT Debug IncompatibleThreadStateException when invoking invokeMethod [message #1314275] Fri, 25 April 2014 09:11
Tamas Szabo is currently offline Tamas SzaboFriend
Messages: 12
Registered: June 2013
Junior Member
Maybe this is not the best place to ask this question, but then you can point me to the appropriate one.

Context: I am implementing my own Variables View in Eclipse, which will be populated with my custom debug variables.
Problem: I am trying to invoke the invokeMethod on an com.sun.jdi.ObjectReference and sometimes this invocation throws an IncompatibleThreadStateException. Actually, I don't even understand why this is thrown here, because I invoke this method when the program execution is suspended. What is even more interesting is the following logic usually works at the second try.

public static Value invokeMethod(ThreadReference threadReference, ObjectReference ref, String methodName) {
Value result = null;
int t = 0;

Method method = null;
List<Method> methods = ref.referenceType().methodsByName(methodName);
for (Method m : methods) {
try {
if (m.arguments().isEmpty()) {
method = m;
} catch (AbsentInformationException e) {
// ignore

if (method != null) {
while (result == null && t < 5) {
try {
result = ref.invokeMethod(threadReference, method, (List<? extends Value>) Collections.emptyList(), 0);
} catch (Exception e) {
result = null;

return result;

I have set this threshold to 5, so that I don't end up in an infinite loop if all goes wrong, but this method returns a non-null value 99.9% of the time.

Question: why is this happening and if once an IncompatibleThreadStateException is thrown, why does a consecutive try solve it?
Previous Topic:debug java search (call hierarchy) bug
Next Topic:How to run eclipse Code CleanUp from commandline
Goto Forum:

Current Time: Fri Jun 14 10:23:46 GMT 2024

Powered by FUDForum. Page generated in 0.03946 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top