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


Java VMDisconnectEvent类代码示例

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


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

示例1: getDebugSession

import com.sun.jdi.event.VMDisconnectEvent; //导入依赖的package包/类
public static IDebugSession getDebugSession(String projectName, String mainClass) throws Exception {
    setupProject(projectName);
    return debugSessionMap.computeIfAbsent(projectName, (name) -> {
        String projectRoot = new File(rootPath, name).getAbsolutePath();
        try {
            final IDebugSession debugSession = DebugUtility.launch(Bootstrap.virtualMachineManager(), mainClass, "", "",
                    null, new File(projectRoot, "bin").getAbsolutePath(), null, null);
            debugSession.getEventHub().events().subscribe(debugEvent -> {
                if (debugEvent.event instanceof VMDisconnectEvent) {
                    try {
                        debugSession.getEventHub().close();
                    } catch (Exception e) {
                        // do nothing.
                    }
                }
            });
            return debugSession;
        } catch (Exception ex) {
            return null;
        }
    });
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:23,代码来源:DebugSessionFactory.java

示例2: wrap

import com.sun.jdi.event.VMDisconnectEvent; //导入依赖的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

示例3: eventLoop

import com.sun.jdi.event.VMDisconnectEvent; //导入依赖的package包/类
private void eventLoop() throws InterruptedException {
	System.out.println("eventLoop started");
	EventQueue eventQueue = vm.eventQueue();
	boolean isRunning = true;
	while (isRunning) {
		EventSet eventSet = eventQueue.remove();
		boolean mayResume = true;
		for (Event event : eventSet) {
			System.out.println(event);
			if (event instanceof VMDeathEvent
					|| event instanceof VMDisconnectEvent) {
				isRunning = false;
			} else if (event instanceof ExceptionEvent) {
				mayResume = false;
			}
		}
		if (mayResume) eventSet.resume();
	}
}
 
开发者ID:gravel-st,项目名称:gravel,代码行数:20,代码来源:VMRemoteTarget.java

示例4: handleEvent

import com.sun.jdi.event.VMDisconnectEvent; //导入依赖的package包/类
/**
* Dispatch incoming events
*/
   
   private void handleEvent(Event event) {
       if (event instanceof ExceptionEvent) {
       	if (!enableProfiling)
       		exceptionManager.exceptionEvent((ExceptionEvent)event);
       } else if (event instanceof MethodEntryEvent) {
       	methodEntryEvent((MethodEntryEvent)event);
       } else if (event instanceof MethodExitEvent) {
       	methodExitEvent((MethodExitEvent)event);
       } else if (event instanceof ThreadDeathEvent) {
           threadeath.threadDeathEvent((ThreadDeathEvent)event);
       } else if (event instanceof VMDeathEvent) {
       	vmDeathEvent((VMDeathEvent)event);
       } else if (event instanceof VMDisconnectEvent) {
           connected = disconnect.vmDisconnectEvent((VMDisconnectEvent)event);
       } 
   }
 
开发者ID:DiegoArranzGarcia,项目名称:JavaTracer,代码行数:21,代码来源:EventThread.java

示例5: handleDisconnectedException

import com.sun.jdi.event.VMDisconnectEvent; //导入依赖的package包/类
/***
* A VMDisconnectedException has happened while dealing with
* another event. We need to flush the event queue, dealing only
* with exit events (VMDeath, VMDisconnect) so that we terminate
* correctly.
*/
   synchronized void handleDisconnectedException() {
       EventQueue queue = vm.eventQueue();
       while (connected) {
           try {
               EventSet eventSet = queue.remove();
               EventIterator iter = eventSet.eventIterator();
               while (iter.hasNext()) {
                   Event event = iter.nextEvent();
                   if (event instanceof VMDeathEvent) {
                       vmDeathManager.vmDeathEvent((VMDeathEvent)event,enableProfiling);
                   } else if (event instanceof VMDisconnectEvent) {
                       connected=disconnect.vmDisconnectEvent((VMDisconnectEvent)event);
                   }
               }
               eventSet.resume(); // Resume the VM
               
           } catch (InterruptedException exc) {
               exc.printStackTrace();
           }
       }
   }
 
开发者ID:DiegoArranzGarcia,项目名称:JavaTracer,代码行数:28,代码来源:EventThread.java

示例6: vmEvents

import com.sun.jdi.event.VMDisconnectEvent; //导入依赖的package包/类
/**
 * Gets the observable object for vm events.
 * @return      the observable object for vm events
 */
@Override
public Observable<DebugEvent> vmEvents() {
    return this.events().filter(debugEvent -> debugEvent.event instanceof VMStartEvent
            || debugEvent.event instanceof VMDisconnectEvent
            || debugEvent.event instanceof VMDeathEvent);
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:11,代码来源:EventHub.java

示例7: vmDisconnectEvent

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

示例8: handleDisconnectedException

import com.sun.jdi.event.VMDisconnectEvent; //导入依赖的package包/类
/**
 * A {@link VMDisconnectedException} has happened while dealing with another
 * event. We need to flush the event queue, dealing only with exit events (
 * {@link VMDeatEvent} and {@link VMDisconnectEvent}) so that we terminate
 * correctly.
 */
private void handleDisconnectedException() {
    EventQueue queue = vm.eventQueue();

    while (connected) {
        try {
            EventSet eventSet = queue.remove();

            EventIterator eventIterator = eventSet.eventIterator();
            while (eventIterator.hasNext()) {
                Event event = eventIterator.nextEvent();

                if (event instanceof VMDeathEvent) {
                    handleEvent(event);
                } else if (event instanceof VMDisconnectEvent) {
                    handleEvent(event);
                    connected = false;
                }
            }
            eventSet.resume();
        } catch (InterruptedException ie) {
            vm.dispose();
            break;
        } catch (VMDisconnectedException vmde) {
            break;
        }
    }
}
 
开发者ID:adrianherrera,项目名称:jdivisitor,代码行数:34,代码来源:EventThread.java

示例9: jdiVMDisconnect

import com.sun.jdi.event.VMDisconnectEvent; //导入依赖的package包/类
@Override
public synchronized void jdiVMDisconnect(final VMDisconnectEvent event)
{
  if (!override && !owner.isStarted())
  {
    return;
  }
  systemExit();
}
 
开发者ID:UBPL,项目名称:jive,代码行数:10,代码来源:JDIEventHandler.java

示例10: jdiVMDisconnect

import com.sun.jdi.event.VMDisconnectEvent; //导入依赖的package包/类
@Override
public void jdiVMDisconnect(final VMDisconnectEvent event)
{
  //
  this.currentEvent = null;
  this.currentThread = null;
  //
  this.currentEvent = null;
  this.currentThread = null;
}
 
开发者ID:UBPL,项目名称:jive,代码行数:11,代码来源:EventHandlerLite.java

示例11: handleVMDisconnect

import com.sun.jdi.event.VMDisconnectEvent; //导入依赖的package包/类
@Override
public void handleVMDisconnect(final VMDisconnectEvent event)
{
  if (isActive())
  {
    // this waits for all pending thread deaths to be processed
    jdiHandler().jdiVMDisconnect(event);
  }
  super.handleVMDisconnect(event);
}
 
开发者ID:UBPL,项目名称:jive,代码行数:11,代码来源:JiveDebugTarget.java

示例12: main

import com.sun.jdi.event.VMDisconnectEvent; //导入依赖的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

示例13: F3VMDisconnectEvent

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

示例14: underlying

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

示例15: vmDisconnectEvent

import com.sun.jdi.event.VMDisconnectEvent; //导入依赖的package包/类
public void vmDisconnectEvent(VMDisconnectEvent e) {
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:3,代码来源:EventNotifierAdapter.java


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