• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ClassPrepareEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: resolve

import com.sun.jdi.event.ClassPrepareEvent; //导入依赖的package包/类
/**
 * Resolve all deferred eventRequests waiting for 'refType'.
 * @return true if it completes successfully, false on error.
 */
boolean resolve(ClassPrepareEvent event) {
    boolean failure = false;
    synchronized(eventRequestSpecs) {
        for (EventRequestSpec spec : eventRequestSpecs) {
            if (!spec.isResolved()) {
                try {
                    EventRequest eventRequest = spec.resolve(event);
                    if (eventRequest != null) {
                        MessageOutput.println("Set deferred", spec.toString());
                    }
                } catch (Exception e) {
                    MessageOutput.println("Unable to set deferred",
                                          new Object [] {spec.toString(),
                                                         spec.errorMessageFor(e)});
                    failure = true;
                }
            }
        }
    }
    return !failure;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:EventRequestSpecList.java


示例2: processClassPrepared

import com.sun.jdi.event.ClassPrepareEvent; //导入依赖的package包/类
public void processClassPrepared(final ClassPrepareEvent event) {
  if (!myDebugProcess.isAttached()) {
    return;
  }

  final ReferenceType refType = event.referenceType();

  if (refType instanceof ClassType || refType instanceof InterfaceType) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("signature = " + refType.signature());
    }
    ClassPrepareRequestor requestor = (ClassPrepareRequestor)event.request().getProperty(REQUESTOR);
    if (requestor != null) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("requestor found " + refType.signature());
      }
      requestor.processClassPrepare(myDebugProcess, refType);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:RequestManagerImpl.java


示例3: wrap

import com.sun.jdi.event.ClassPrepareEvent; //导入依赖的package包/类
public static F3Event wrap(F3VirtualMachine f3vm, Event evt) {
    if (evt == null) {
        return null;
    }
    if (evt instanceof AccessWatchpointEvent) {
        return new F3AccessWatchpointEvent(f3vm, (AccessWatchpointEvent)evt);
    } else if (evt instanceof BreakpointEvent) {
        return new F3BreakpointEvent(f3vm, (BreakpointEvent)evt);
    } else if (evt instanceof ClassPrepareEvent) {
        return new F3ClassPrepareEvent(f3vm, (ClassPrepareEvent)evt);
    } else if (evt instanceof ClassUnloadEvent) {
        return new F3ClassUnloadEvent(f3vm, (ClassUnloadEvent)evt);
    } else if (evt instanceof ExceptionEvent) {
        return new F3ExceptionEvent(f3vm, (ExceptionEvent)evt);
    } else if (evt instanceof MethodEntryEvent) {
        return new F3MethodEntryEvent(f3vm, (MethodEntryEvent)evt);
    } else if (evt instanceof MethodExitEvent) {
        return new F3MethodExitEvent(f3vm, (MethodExitEvent)evt);
    } else if (evt instanceof ModificationWatchpointEvent) {
        return new F3ModificationWatchpointEvent(f3vm, (ModificationWatchpointEvent)evt);
    } else if (evt instanceof MonitorContendedEnterEvent) {
        return new F3MonitorContendedEnterEvent(f3vm, (MonitorContendedEnterEvent)evt);
    } else if (evt instanceof MonitorContendedEnteredEvent) {
        return new F3MonitorContendedEnteredEvent(f3vm, (MonitorContendedEnteredEvent)evt);
    } else if (evt instanceof MonitorWaitEvent) {
        return new F3MonitorWaitEvent(f3vm, (MonitorWaitEvent)evt);
    } else if (evt instanceof MonitorWaitedEvent) {
        return new F3MonitorWaitedEvent(f3vm, (MonitorWaitedEvent)evt);
    } else if (evt instanceof StepEvent) {
        return new F3StepEvent(f3vm, (StepEvent)evt);
    } else if (evt instanceof ThreadDeathEvent) {
        return new F3ThreadDeathEvent(f3vm, (ThreadDeathEvent)evt);
    } else if (evt instanceof ThreadStartEvent) {
        return new F3ThreadStartEvent(f3vm, (ThreadStartEvent)evt);
    } else if (evt instanceof VMDeathEvent) {
        return new F3VMDeathEvent(f3vm, (VMDeathEvent)evt);
    } else if (evt instanceof VMDisconnectEvent) {
        return new F3VMDisconnectEvent(f3vm, (VMDisconnectEvent)evt);
    } else if (evt instanceof VMStartEvent) {
        return new F3VMStartEvent(f3vm, (VMStartEvent)evt);
    } else if (evt instanceof WatchpointEvent) {
        return new F3WatchpointEvent(f3vm, (WatchpointEvent)evt);
    } else if (evt instanceof LocatableEvent) {
        return new F3LocatableEvent(f3vm, (LocatableEvent)evt);
    } else {
        return new F3Event(f3vm, evt);
    }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:49,代码来源:F3Event.java


示例4: resolve

import com.sun.jdi.event.ClassPrepareEvent; //导入依赖的package包/类
/**
 * Resolve all deferred eventRequests waiting for 'refType'.
 * @return true if it completes successfully, false on error.
 */
boolean resolve(ClassPrepareEvent event) {
    boolean failure = false;
    synchronized(eventRequestSpecs) {
        for (EventRequestSpec spec : eventRequestSpecs) {
            if (!spec.isResolved()) {
                try {
                    EventRequest eventRequest = spec.resolve(event);
                    if (eventRequest != null) {
                        env.messageOutput().println("Set deferred", spec.toString());
                    }
                } catch (Exception e) {
                    env.messageOutput().println("Unable to set deferred",
                                          new Object [] {spec.toString(),
                                                         spec.errorMessageFor(e)});
                    failure = true;
                }
            }
        }
    }
    return !failure;
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:26,代码来源:EventRequestSpecList.java


示例5: jdiClassPrepare

import com.sun.jdi.event.ClassPrepareEvent; //导入依赖的package包/类
@Override
public void jdiClassPrepare(final ClassPrepareEvent event)
{
  if (!override && !owner.isStarted())
  {
    return;
  }
  try
  {
    delegate.handleTypeLoad(event.referenceType(), event.thread());
  }
  catch (final Throwable e)
  {
    JiveDebugPlugin.log(e);
  }
}
 
开发者ID:UBPL,项目名称:jive,代码行数:17,代码来源:JDIEventHandler.java


示例6: handleClassPrepareEvent

import com.sun.jdi.event.ClassPrepareEvent; //导入依赖的package包/类
@Override
public boolean handleClassPrepareEvent(ClassPrepareEvent event, JDIDebugTarget target, boolean suspendVote) {
	//long startTime = System.currentTimeMillis();
	//System.out.println("Prepare " + event.referenceType().name());
	try {
		IType itype = project.findType(event.referenceType().name(), (IProgressMonitor)null);
		List<IField> fields = new ArrayList<IField>();
		if (itype == null) {
			//System.out.println("Bad times on " + event.referenceType().name());
		} else {
			String typeName = itype.getFullyQualifiedName();
			if (isUsefulType(typeName))
				for (IField field: itype.getFields())
					if ((!Flags.isFinal(field.getFlags()) || field.getTypeSignature().contains("[")) && Flags.isStatic(field.getFlags())
							&& isUsefulField(typeName, field.getElementName(), typeName))
						fields.add(field);
			List<MyJavaWatchpoint> newWatchpoints = getFieldWatchpoints(fields, null);
			addedWatchpoints.addAll(newWatchpoints);
		}
		//System.out.println("Prepared " + event.referenceType() + " in " + (System.currentTimeMillis()- startTime) + "ms.");
	} catch (JavaModelException e) {
		throw new RuntimeException(e);
	}
	return super.handleClassPrepareEvent(event, target, suspendVote);
}
 
开发者ID:jgalenson,项目名称:codehint,代码行数:26,代码来源:SideEffectHandler.java


示例7: resolve

import com.sun.jdi.event.ClassPrepareEvent; //导入依赖的package包/类
/**
 * @return If this EventRequestSpec matches the 'refType'
 * return the cooresponding EventRequest.  Otherwise
 * return null.
 */
synchronized EventRequest resolve(ClassPrepareEvent event) throws Exception {
    if ((resolved == null) &&
        (prepareRequest != null) &&
        prepareRequest.equals(event.request())) {

        resolved = resolveEventRequest(event.referenceType());
        prepareRequest.disable();
        Env.vm().eventRequestManager().deleteEventRequest(prepareRequest);
        prepareRequest = null;

        if (refSpec instanceof PatternReferenceTypeSpec) {
            PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec;
            if (! prs.isUnique()){
                /*
                 * Class pattern event requests are never
                 * considered "resolved", since future class loads
                 * might also match.
                 * Create and enable a new ClassPrepareRequest to
                 * keep trying to resolve.
                 */
                resolved = null;
                prepareRequest = refSpec.createPrepareRequest();
                prepareRequest.enable();
            }
        }
    }
    return resolved;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:EventRequestSpec.java


示例8: resolve

import com.sun.jdi.event.ClassPrepareEvent; //导入依赖的package包/类
/**
 * @return If this EventRequestSpec matches the 'refType'
 * return the cooresponding EventRequest.  Otherwise
 * return null.
 */
synchronized EventRequest resolve(ClassPrepareEvent event) throws Exception {
    if ((resolved == null) &&
        (prepareRequest != null) &&
        prepareRequest.equals(event.request())) {

        resolved = resolveEventRequest(event.referenceType());
        prepareRequest.disable();
        env.vm().eventRequestManager().deleteEventRequest(prepareRequest);
        prepareRequest = null;

        if (refSpec instanceof PatternReferenceTypeSpec) {
            PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec;
            if (! prs.isUnique()){
                /*
                 * Class pattern event requests are never
                 * considered "resolved", since future class loads
                 * might also match.
                 * Create and enable a new ClassPrepareRequest to
                 * keep trying to resolve.
                 */
                resolved = null;
                prepareRequest = refSpec.createPrepareRequest();
                prepareRequest.enable();
            }
        }
    }
    return resolved;
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:34,代码来源:EventRequestSpec.java


示例9: resumeToPrepareOf

import com.sun.jdi.event.ClassPrepareEvent; //导入依赖的package包/类
public ClassPrepareEvent resumeToPrepareOf(String className) {
    final ClassPrepareRequest request =
            eventRequestManager().createClassPrepareRequest();
    request.addClassFilter(className);
    request.addCountFilter(1);
    request.enable();
    return (ClassPrepareEvent)resumeToEvent(request);
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:9,代码来源:Debugger.java


示例10: classPrepareEvent

import com.sun.jdi.event.ClassPrepareEvent; //导入依赖的package包/类
public void classPrepareEvent(ClassPrepareEvent evt) {
    synchronized (listeners) {
        for (EventNotifier en : listeners) {
            en.classPrepareEvent(evt);
        }
    }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:8,代码来源:Debugger.java


示例11: handleEvent

import com.sun.jdi.event.ClassPrepareEvent; //导入依赖的package包/类
@Override
public boolean handleEvent(final Event event, final JDIDebugTarget target,
    final boolean suspendVote, final EventSet eventSet)
{
  classes.add(((ClassPrepareEvent) event).referenceType());
  if (!owner.isActive())
  {
    return true;
  }
  createFieldRequests(target, ((ClassPrepareEvent) event).referenceType());
  owner.jdiHandler().jdiClassPrepare((ClassPrepareEvent) event);
  return true;
}
 
开发者ID:UBPL,项目名称:jive,代码行数:14,代码来源:EventHandlerFactory.java


示例12: jdiClassPrepare

import com.sun.jdi.event.ClassPrepareEvent; //导入依赖的package包/类
/**
 * Notification of a class prepare in the target VM. See the JVM specification for a definition of
 * class preparation. Class prepare events are not generated for primitive classes (for example,
 * java.lang.Integer.TYPE).
 * 
 * @param event
 * 
 * @see <a href="">http://docs.oracle.com/javase/7/docs/jdk/api/jpda/jdi/index.html</a>
 */
@Override
public void jdiClassPrepare(final ClassPrepareEvent event)
{
  //
  this.currentEvent = null;
  this.currentThread = event.thread();
  //
  jdiTypeLoad(event.referenceType());
  //
  //
  this.currentEvent = null;
  this.currentThread = null;
}
 
开发者ID:UBPL,项目名称:jive,代码行数:23,代码来源:EventHandlerLite.java


示例13: main

import com.sun.jdi.event.ClassPrepareEvent; //导入依赖的package包/类
public static void main(String[] args)
    throws IOException, InterruptedException {

  //VirtualMachine vm = launchTarget(sb.toString());
  VirtualMachine vm = launchTarget(CLASS_NAME);

  System.out.println("Vm launched");

  // process events
  EventQueue eventQueue = vm.eventQueue();
  // resume the vm

  Process process = vm.process();


  // Copy target's output and error to our output and error.
  Thread outThread = new StreamRedirectThread("out reader", process.getInputStream());
  Thread errThread = new StreamRedirectThread("error reader", process.getErrorStream());

  errThread.start();
  outThread.start();

  boolean connected = true;
  int watched = 0;
  while (connected) {
    EventSet eventSet = eventQueue.remove();
    for (Event event : eventSet) {
      System.out.println("FieldMonitor-main receives: "+event);
      if (event instanceof VMStartEvent) {
        addClassWatch(vm);
      } else if (event instanceof VMDeathEvent
          || event instanceof VMDisconnectEvent) {
        // exit
        connected = false;
      } else if (event instanceof ClassPrepareEvent) {
        // watch field on loaded class
        System.out.println("ClassPrepareEvent");
        ClassPrepareEvent classPrepEvent = (ClassPrepareEvent) event;
        ReferenceType refType = classPrepEvent
            .referenceType();
        addFieldWatch(vm, refType);
      } else if (event instanceof ModificationWatchpointEvent) {
        watched++;
        System.out.println("sleep for 500 ms");
        Thread.sleep(500);

        ModificationWatchpointEvent modEvent = (ModificationWatchpointEvent) event;
        System.out.println("old="
            + modEvent.valueCurrent());
        System.out.println("new=" + modEvent.valueToBe());
      }
    }
    System.out.println("resume...");
    eventSet.resume();
  }
  // Shutdown begins when event thread terminates
  try {
      errThread.join(); // Make sure output is forwarded
      outThread.join();
  } catch (InterruptedException exc) {
      // we don't interrupt
  }

  if (watched != 11) { // init + 10 modifications in TestPostFieldModification class
      throw new Error("Expected to receive 11 times ModificationWatchpointEvent, but got "+watched);
  }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:68,代码来源:FieldMonitor.java


示例14: F3ClassPrepareEvent

import com.sun.jdi.event.ClassPrepareEvent; //导入依赖的package包/类
public F3ClassPrepareEvent(F3VirtualMachine f3vm, ClassPrepareEvent underlying) {
    super(f3vm, underlying);
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:4,代码来源:F3ClassPrepareEvent.java


示例15: underlying

import com.sun.jdi.event.ClassPrepareEvent; //导入依赖的package包/类
@Override
protected ClassPrepareEvent underlying() {
    return (ClassPrepareEvent) super.underlying();
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:5,代码来源:F3ClassPrepareEvent.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OptionsDisplayer类代码示例发布时间:2022-05-21
下一篇:
Java ObjectOpenHashSet类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap