本文整理汇总了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;
}
示例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);
}
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例10: classPrepareEvent
import com.sun.jdi.event.ClassPrepareEvent; //导入依赖的package包/类
public void classPrepareEvent(ClassPrepareEvent evt) {
synchronized (listeners) {
for (EventNotifier en : listeners) {
en.classPrepareEvent(evt);
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例14: F3ClassPrepareEvent
import com.sun.jdi.event.ClassPrepareEvent; //导入依赖的package包/类
public F3ClassPrepareEvent(F3VirtualMachine f3vm, ClassPrepareEvent underlying) {
super(f3vm, underlying);
}
示例15: underlying
import com.sun.jdi.event.ClassPrepareEvent; //导入依赖的package包/类
@Override
protected ClassPrepareEvent underlying() {
return (ClassPrepareEvent) super.underlying();
}