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


Java EventQueue类代码示例

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


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

示例1: run

import com.sun.jdi.event.EventQueue; //导入依赖的package包/类
/**
 * Run the event handling thread.
 * 
 * As long as the thread remains connected to the VM, events are removed
 * from the queue and dispatched.
 */
@Override
public void run() {
    EventQueue queue = vm.eventQueue();

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

            EventIterator eventIterator = eventSet.eventIterator();
            while (eventIterator.hasNext()) {
                handleEvent(eventIterator.nextEvent());
            }
            eventSet.resume();
        } catch (InterruptedException ie) {
            vm.dispose();
            break;
        } catch (VMDisconnectedException vmde) {
            handleDisconnectedException();
            break;
        }
    }
}
 
开发者ID:adrianherrera,项目名称:jdivisitor,代码行数:29,代码来源:EventThread.java

示例2: eventLoop

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

示例3: handleDisconnectedException

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

示例4: eventQueue

import com.sun.jdi.event.EventQueue; //导入依赖的package包/类
public EventQueue eventQueue() {
    /*
     * No VM validation here. We allow access to the event queue
     * after disconnection, so that there is access to the terminating
     * events.
     */
    return eventQueue;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:VirtualMachineImpl.java

示例5: notifyDequeueEventSet

import com.sun.jdi.event.EventQueue; //导入依赖的package包/类
void notifyDequeueEventSet() {
    int maxQueueSize = 0;
    synchronized(eventQueues) {
        Iterator<EventQueue> iter = eventQueues.iterator();
        while (iter.hasNext()) {
            EventQueueImpl queue = (EventQueueImpl)iter.next();
            maxQueueSize = Math.max(maxQueueSize, queue.size());
        }
    }
    controlEventFlow(maxQueueSize);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:TargetVM.java

示例6: queueEventSet

import com.sun.jdi.event.EventQueue; //导入依赖的package包/类
private void queueEventSet(EventSet eventSet) {
    int maxQueueSize = 0;

    synchronized(eventQueues) {
        Iterator<EventQueue> iter = eventQueues.iterator();
        while (iter.hasNext()) {
            EventQueueImpl queue = (EventQueueImpl)iter.next();
            queue.enqueue(eventSet);
            maxQueueSize = Math.max(maxQueueSize, queue.size());
        }
    }

    controlEventFlow(maxQueueSize);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:TargetVM.java

示例7: loop

import com.sun.jdi.event.EventQueue; //导入依赖的package包/类
private void loop(BreakpointRequest br, Field contextField) throws Exception {
  int lineNumber = br.location().lineNumber();

  br.setSuspendPolicy(BreakpointRequest.SUSPEND_EVENT_THREAD);
  br.enable();
  EventQueue evtQueue = vm.eventQueue();
  boolean run = true;
  while (run) {
    EventSet evtSet = evtQueue.remove();
    EventIterator evtIter = evtSet.eventIterator();
    while (evtIter.hasNext()) {
      try {
        Event evt = evtIter.next();
        EventRequest evtReq = evt.request();
        if (evtReq instanceof BreakpointRequest
            && ((BreakpointRequest) evtReq).location().lineNumber() == lineNumber) {
          new BreakpointProcessor(missingPerms)
              .processBreakpoint(contextField, (BreakpointEvent) evt);

          // TODO: 12/20/17 Remove when full loop processing is restored
          // run = false;
          System.out.println(missingPerms);
          missingPerms.clear();
        }
      } finally {
        evtSet.resume();
      }
    }
  }

  //    System.out.println(missingPerms);
  //    printPerms(missingPerms);
}
 
开发者ID:coyotesqrl,项目名称:acdebugger,代码行数:34,代码来源:PermissionDebugger.java

示例8: eventQueue

import com.sun.jdi.event.EventQueue; //导入依赖的package包/类
public EventQueue eventQueue() {
  return myVirtualMachine.eventQueue();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:VirtualMachineProxyImpl.java

示例9: EventsCollector

import com.sun.jdi.event.EventQueue; //导入依赖的package包/类
EventsCollector(EventQueue queue, EventsHandler handler) {
  this.queue = queue;
  this.handler = handler;

  thread = new Thread(this);
  running = true;
  thread.start();
}
 
开发者ID:eclipse,项目名称:che,代码行数:9,代码来源:EventsCollector.java

示例10: F3EventQueue

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

示例11: testEventQueueNotNull

import com.sun.jdi.event.EventQueue; //导入依赖的package包/类
@Test
public void testEventQueueNotNull() {
    EventQueue evtQ = getVM().eventQueue();
    if (evtQ == null) {
        Assert.fail("EventQueue is null!");
    }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:8,代码来源:VirtualMachineTest.java

示例12: handleDisconnectedException

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

示例13: run

import com.sun.jdi.event.EventQueue; //导入依赖的package包/类
/**
* Run the event handling thread.
* As long as we are connected, get event sets off
* the queue and dispatch the events within them.
*/

   public void run() {
       EventQueue queue = vm.eventQueue();
               
       while (connected && !forceExit) {
           try {
           	
                EventSet eventSet = queue.remove();
                EventIterator it = eventSet.eventIterator();
                while (it.hasNext())
               	 handleEvent(it.nextEvent());
                eventSet.resume();
                
           } catch (InterruptedException exc) {
              exc.printStackTrace();
           } catch (VMDisconnectedException discExc) {
           	discExc.printStackTrace();
               handleDisconnectedException();
               break;
           }
       }
       
       if (forceExit){
       	vm.exit(-1);
       	if (!enableProfiling)
       		writer.close();
       	tracer.finishedTrace();
       }
   }
 
开发者ID:DiegoArranzGarcia,项目名称:JavaTracer,代码行数:35,代码来源:EventThread.java

示例14: eventQueue

import com.sun.jdi.event.EventQueue; //导入依赖的package包/类
public EventQueue eventQueue() {
    throwNotReadOnlyException("VirtualMachine.eventQueue()");
    return null;
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:5,代码来源:VirtualMachineImpl.java

示例15: start

import com.sun.jdi.event.EventQueue; //导入依赖的package包/类
/**
 * Starts retrieving events from the event queue of the specified virtual machine.
 *
 * @param vm
 *            the target virtual machine.
 */
@Override
public void start(VirtualMachine vm) {
    if (isClosed) {
        throw new IllegalStateException("This event hub is already closed.");
    }

    workingThread = new Thread(() -> {
        EventQueue queue = vm.eventQueue();
        while (true) {
            try {
                if (Thread.interrupted()) {
                    subject.onComplete();
                    return;
                }

                EventSet set = queue.remove();

                boolean shouldResume = true;
                for (Event event : set) {
                    try {
                        logger.fine("\nJDI Event: " + event + "\n");
                    } catch (VMDisconnectedException e) {
                        // do nothing
                    }
                    DebugEvent dbgEvent = new DebugEvent();
                    dbgEvent.event = event;
                    dbgEvent.eventSet = set;
                    subject.onNext(dbgEvent);
                    shouldResume &= dbgEvent.shouldResume;
                }

                if (shouldResume) {
                    set.resume();
                }
            } catch (InterruptedException e) {
                isClosed = true;
                subject.onComplete();
                return;
            } catch (VMDisconnectedException e) {
                isClosed = true;
                subject.onError(e);
                return;
            }
        }
    }, "Event Hub");

    workingThread.start();
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:55,代码来源:EventHub.java


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