当前位置: 首页>>代码示例>>Java>>正文


Java IncompatibleThreadStateException类代码示例

本文整理汇总了Java中com.sun.jdi.IncompatibleThreadStateException的典型用法代码示例。如果您正苦于以下问题:Java IncompatibleThreadStateException类的具体用法?Java IncompatibleThreadStateException怎么用?Java IncompatibleThreadStateException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IncompatibleThreadStateException类属于com.sun.jdi包,在下文中一共展示了IncompatibleThreadStateException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: popFrames

import com.sun.jdi.IncompatibleThreadStateException; //导入依赖的package包/类
public void popFrames (ThreadReference thread, StackFrame frame) {
    PropertyChangeEvent evt = null;
    accessLock.readLock().lock();
    try {
        JPDAThreadImpl threadImpl = getThread(thread);
        setState (STATE_RUNNING);
        try {
            threadImpl.popFrames(frame);
            evt = updateCurrentCallStackFrameNoFire(threadImpl);
        } catch (IncompatibleThreadStateException ex) {
            Exceptions.printStackTrace(ex);
        } finally {
            setState (STATE_STOPPED);
        }
    } finally {
        accessLock.readLock().unlock();
    }
    if (evt != null) {
        firePropertyChange(evt);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:JPDADebuggerImpl.java

示例2: submitCheckForMonitorEntered

import com.sun.jdi.IncompatibleThreadStateException; //导入依赖的package包/类
private void submitCheckForMonitorEntered(ObjectReference waitingMonitor) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper, ObjectCollectedExceptionWrapper, IllegalThreadStateExceptionWrapper {
    try {
        ThreadReferenceWrapper.suspend(threadReference);
        logger.fine("submitCheckForMonitorEntered(): suspending "+threadName);
        ObjectReference monitor = ThreadReferenceWrapper.currentContendedMonitor(threadReference);
        if (monitor == null) return ;
        Location loc = StackFrameWrapper.location(ThreadReferenceWrapper.frame(threadReference, 0));
        loc = MethodWrapper.locationOfCodeIndex(LocationWrapper.method(loc), LocationWrapper.codeIndex(loc) + 1);
        if (loc == null) return;
        BreakpointRequest br = EventRequestManagerWrapper.createBreakpointRequest(
                VirtualMachineWrapper.eventRequestManager(MirrorWrapper.virtualMachine(threadReference)), loc);
        BreakpointRequestWrapper.addThreadFilter(br, threadReference);
        submitMonitorEnteredRequest(br);
    } catch (IncompatibleThreadStateException itex) {
        Exceptions.printStackTrace(itex);
    } catch (InvalidStackFrameExceptionWrapper isex) {
        Exceptions.printStackTrace(isex);
    } finally {
        logger.fine("submitCheckForMonitorEntered(): resuming "+threadName);
        ThreadReferenceWrapper.resume(threadReference);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:JPDAThreadImpl.java

示例3: autoboxArguments

import com.sun.jdi.IncompatibleThreadStateException; //导入依赖的package包/类
/**
 * Auto-boxes or un-boxes arguments of a method.
 */
static void autoboxArguments(List<Type> types, List<Value> argVals,
                             ThreadReference evaluationThread,
                             EvaluationContext evaluationContext) throws InvalidTypeException,
                                                                         ClassNotLoadedException,
                                                                         IncompatibleThreadStateException,
                                                                         InvocationException {
    if (types.size() != argVals.size()) {
        return ;
    }
    int n = types.size();
    for (int i = 0; i < n; i++) {
        Type t = types.get(i);
        Value v = argVals.get(i);
        if (v instanceof ObjectReference && t instanceof PrimitiveType) {
            argVals.set(i, unbox((ObjectReference) v, (PrimitiveType) t, evaluationThread, evaluationContext));
        }
        if (v instanceof PrimitiveValue && t instanceof ReferenceType) {
            argVals.set(i, box((PrimitiveValue) v, (ReferenceType) t, evaluationThread, evaluationContext));
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:EvaluatorVisitor.java

示例4: isAtBreakpoint

import com.sun.jdi.IncompatibleThreadStateException; //导入依赖的package包/类
public boolean isAtBreakpoint() {
    /*
     * TO DO: This fails to take filters into account.
     */
    try {
        StackFrame frame = frame(0);
        Location location = frame.location();
        List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests();
        Iterator<BreakpointRequest> iter = requests.iterator();
        while (iter.hasNext()) {
            BreakpointRequest request = iter.next();
            if (location.equals(request.location())) {
                return true;
            }
        }
        return false;
    } catch (IndexOutOfBoundsException iobe) {
        return false;  // no frames on stack => not at breakpoint
    } catch (IncompatibleThreadStateException itse) {
        // Per the javadoc, not suspended => return false
        return false;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:ThreadReferenceImpl.java

示例5: frameCount

import com.sun.jdi.IncompatibleThreadStateException; //导入依赖的package包/类
public int frameCount() throws IncompatibleThreadStateException  {
    LocalCache snapshot = localCache;
    try {
        if (snapshot.frameCount == -1) {
            snapshot.frameCount = JDWP.ThreadReference.FrameCount
                                      .process(vm, this).frameCount;
        }
    } catch (JDWPException exc) {
        switch (exc.errorCode()) {
        case JDWP.Error.THREAD_NOT_SUSPENDED:
        case JDWP.Error.INVALID_THREAD:   /* zombie */
            throw new IncompatibleThreadStateException();
        default:
            throw exc.toJDIException();
        }
    }
    return snapshot.frameCount;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:ThreadReferenceImpl.java

示例6: ownedMonitors

import com.sun.jdi.IncompatibleThreadStateException; //导入依赖的package包/类
public List<ObjectReference> ownedMonitors()  throws IncompatibleThreadStateException  {
    LocalCache snapshot = localCache;
    try {
        if (snapshot.ownedMonitors == null) {
            snapshot.ownedMonitors = Arrays.asList(
                             (ObjectReference[])JDWP.ThreadReference.OwnedMonitors.
                                     process(vm, this).owned);
            if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
                vm.printTrace(description() +
                              " temporarily caching owned monitors"+
                              " (count = " + snapshot.ownedMonitors.size() + ")");
            }
        }
    } catch (JDWPException exc) {
        switch (exc.errorCode()) {
        case JDWP.Error.THREAD_NOT_SUSPENDED:
        case JDWP.Error.INVALID_THREAD:   /* zombie */
            throw new IncompatibleThreadStateException();
        default:
            throw exc.toJDIException();
        }
    }
    return snapshot.ownedMonitors;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:ThreadReferenceImpl.java

示例7: shouldDoExtraStepInto

import com.sun.jdi.IncompatibleThreadStateException; //导入依赖的package包/类
/**
 * Check if the current top stack is same as the original top stack.
 *
 * @throws IncompatibleThreadStateException
 *                      if the thread is not suspended in the target VM.
 */
private boolean shouldDoExtraStepInto(int originalStackDepth, Location originalLocation, int currentStackDepth, Location currentLocation)
        throws IncompatibleThreadStateException {
    if (originalStackDepth != currentStackDepth) {
        return false;
    }
    if (originalLocation == null) {
        return false;
    }
    Method originalMethod = originalLocation.method();
    Method currentMethod = currentLocation.method();
    if (!originalMethod.equals(currentMethod)) {
        return false;
    }
    if (originalLocation.lineNumber() != currentLocation.lineNumber()) {
        return false;
    }
    return true;
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:25,代码来源:StepRequestHandler.java

示例8: getFilteredFrames

import com.sun.jdi.IncompatibleThreadStateException; //导入依赖的package包/类
private List<StackFrame> getFilteredFrames() throws IncompatibleThreadStateException {
    List<StackFrame> frames = F3Wrapper.wrapFrames(virtualMachine(), underlying().frames());
    List<StackFrame> filteredFrames = new ArrayList<StackFrame>(frames.size());
    try {
        for (StackFrame fr : frames) {
            F3StackFrame f3fr = (F3StackFrame) fr;
            // don't add F3 synthetic frames
            if (f3fr.location().method().isF3InternalMethod()) {
                continue;
            } else {
                filteredFrames.add(f3fr);
            }
        }
    } catch (InvalidStackFrameException exp) {
        throw new IncompatibleThreadStateException(exp.getMessage());
    }
    return filteredFrames;
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:19,代码来源:F3ThreadReference.java

示例9: evaluate

import com.sun.jdi.IncompatibleThreadStateException; //导入依赖的package包/类
/**
 * Evaluate "jdb"-style expressions. The expression syntax is same as what
 * you'd use with jdb's "print" or "set" command. The expression is evaluated
 * in current thread's current frame context. You can access locals from that 
 * frame and also evaluate object fields/static fields etc. from there. For 
 * example, if "seq" is a local variable of type F3 integer sequence, 
 * 
 *     Debugger dbg = ...
 *     dbg.evaluate("seq[0]");
 *
 * and that will return JDI IntegerValue type object in this case.
 */
public Value evaluate(String expr) {
    Value result = null;
    ExpressionParser.GetFrame frameGetter = null;
    try {
        final ThreadInfo threadInfo = env.getCurrentThreadInfo();
        if (threadInfo != null && threadInfo.getCurrentFrame() != null) {
            frameGetter = new ExpressionParser.GetFrame() {
                public StackFrame get() throws IncompatibleThreadStateException {
                    return threadInfo.getCurrentFrame();
                }
            };
        }
        result = ExpressionParser.evaluate(expr, env.vm(), frameGetter);
    } catch (RuntimeException rexp) {
        throw rexp;
    } catch (Exception exp) {
        throw new RuntimeException(exp);
    }
    return result;
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:33,代码来源:Debugger.java

示例10: containsInModelFrames

import com.sun.jdi.IncompatibleThreadStateException; //导入依赖的package包/类
/**
 * Returns whether the given thread contains any in-model frames (i.e., whether there is a frame
 * on the stack with a corresponding contour) between the top frame and the frame matching the
 * supplied location.
 */
private boolean containsInModelFrames(final ThreadReference thread, final Location catchLocation)
    throws IncompatibleThreadStateException
{
  final List<StackFrame> stack = thread.frames();
  for (final StackFrame frame : stack)
  {
    final ReferenceType type = frame.location().declaringType();
    if (eventFilter().acceptsType(type))
    {
      return true;
    }
    if (catchLocation != null && frame.location().method().equals(catchLocation.method()))
    {
      return false;
    }
  }
  return false;
}
 
开发者ID:UBPL,项目名称:jive,代码行数:24,代码来源:JDIEventHandlerDelegate.java

示例11: handleMethodEntry

import com.sun.jdi.IncompatibleThreadStateException; //导入依赖的package包/类
/**
 * Filtered method calls/returns are captured lazily by determineStackFrame(event).
 */
void handleMethodEntry(final MethodEntryEvent event, final boolean generateLocals)
    throws IncompatibleThreadStateException, AbsentInformationException
{
  if (!eventFilter().acceptsMethod(event.method(), event.thread()))
  {
    return;
  }
  // adjust the stack frames if necessary
  final StackFrame frame = determineStackFrame(event);
  // handle a pending returned event if necessary
  handlePendingReturned(event.location(), frame, event.thread());
  // record newly observed types and objects if necessary
  handleNewObject(frame, event.thread());
  // resolve the method
  resolveMethod(frame, event.method());
  // record the method call
  dispatcher().dispatchInModelCallEvent(event, frame);
  // handle locals if necessary
  if (generateLocals)
  {
    handleLocals(null, frame, event.location());
  }
}
 
开发者ID:UBPL,项目名称:jive,代码行数:27,代码来源:JDIEventHandlerDelegate.java

示例12: acceptsStep

import com.sun.jdi.IncompatibleThreadStateException; //导入依赖的package包/类
/**
 * Step events are filtered according to accepted types and methods.
 */
@Override
public boolean acceptsStep(final StepEvent event)
{
  if (!acceptsLocation(event.location()))
  {
    return false;
  }
  ObjectReference oref;
  try
  {
    oref = event.thread().frame(0).thisObject();
  }
  catch (final IncompatibleThreadStateException e)
  {
    oref = null;
  }
  // step's context type
  if (oref != null && !acceptsType(oref.referenceType()))
  {
    return false;
  }
  return true;
}
 
开发者ID:UBPL,项目名称:jive,代码行数:27,代码来源:ModelFilter.java

示例13: processThis

import com.sun.jdi.IncompatibleThreadStateException; //导入依赖的package包/类
private Data processThis(ExceptionEvent event, ReferenceType ref,
		ThreadReference thread) {

	StackFrame stack = null;

	try {
		stack = thread.frame(0);
	} catch (IncompatibleThreadStateException e) {
		e.printStackTrace();
	}

	Data valueThis = utils.getObj("this", stack.thisObject(),
			new ArrayList<Long>());

	return valueThis;
}
 
开发者ID:DiegoArranzGarcia,项目名称:JavaTracer,代码行数:17,代码来源:ExceptionManager.java

示例14: pauseMedia

import com.sun.jdi.IncompatibleThreadStateException; //导入依赖的package包/类
private static void pauseMedia(ThreadReference tr, VirtualMachine vm) throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException, InvocationException {
    final ClassType audioClipClass = getClass(vm, tr, "com.sun.media.jfxmedia.AudioClip");
    final ClassType mediaManagerClass = getClass(vm, tr, "com.sun.media.jfxmedia.MediaManager");
    final InterfaceType mediaPlayerClass = getInterface(vm, tr, "com.sun.media.jfxmedia.MediaPlayer");
    final ClassType playerStateEnum = getClass(vm, tr, "com.sun.media.jfxmedia.events.PlayerStateEvent$PlayerState");
    
    if (audioClipClass != null) {
        Method stopAllClips = audioClipClass.concreteMethodByName("stopAllClips", "()V");
        audioClipClass.invokeMethod(tr, stopAllClips, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
    }
    
    if (mediaManagerClass != null && mediaPlayerClass != null && playerStateEnum != null) {
        Method getAllPlayers = mediaManagerClass.concreteMethodByName("getAllMediaPlayers", "()Ljava/util/List;");

        ObjectReference plList = (ObjectReference)mediaManagerClass.invokeMethod(tr, getAllPlayers, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);

        if (plList != null) {
            ClassType listType = (ClassType)plList.referenceType();
            Method iterator = listType.concreteMethodByName("iterator", "()Ljava/util/Iterator;");
            ObjectReference plIter = (ObjectReference)plList.invokeMethod(tr, iterator, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);

            ClassType iterType = (ClassType)plIter.referenceType();
            Method hasNext = iterType.concreteMethodByName("hasNext", "()Z");
            Method next = iterType.concreteMethodByName("next", "()Ljava/lang/Object;");


            Field playingState = playerStateEnum.fieldByName("PLAYING");

            Method getState = mediaPlayerClass.methodsByName("getState", "()Lcom/sun/media/jfxmedia/events/PlayerStateEvent$PlayerState;").get(0);
            Method pausePlayer = mediaPlayerClass.methodsByName("pause", "()V").get(0);
            boolean hasNextFlag = false;
            do {
                BooleanValue v = (BooleanValue)plIter.invokeMethod(tr, hasNext, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
                hasNextFlag = v.booleanValue();
                if (hasNextFlag) {
                    ObjectReference player = (ObjectReference)plIter.invokeMethod(tr, next, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
                    ObjectReference curState = (ObjectReference)player.invokeMethod(tr, getState, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
                    if (playingState.equals(curState)) {
                        player.invokeMethod(tr, pausePlayer, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
                        pausedPlayers.add(player);
                    }
                }
            } while (hasNextFlag);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:47,代码来源:RemoteFXScreenshot.java

示例15: resumeMedia

import com.sun.jdi.IncompatibleThreadStateException; //导入依赖的package包/类
private static void resumeMedia(ThreadReference tr, VirtualMachine vm) throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException, InvocationException {
    if (!pausedPlayers.isEmpty()) {
        final InterfaceType mediaPlayerClass = getInterface(vm, tr, "com.sun.media.jfxmedia.MediaPlayer");
        List<Method> play = mediaPlayerClass.methodsByName("play", "()V");
        if (play.isEmpty()) {
            return;
        }
        Method p = play.iterator().next();
        for(ObjectReference pR : pausedPlayers) {
            pR.invokeMethod(tr, p, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:RemoteFXScreenshot.java


注:本文中的com.sun.jdi.IncompatibleThreadStateException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。