553 if (xembedLog.isLoggable(PlatformLogger.Level.FINER)) {
554 xembedLog.finer("Waiting for " + XEmbedHelper.msgidToString(event) + " starting from " + position);
555 }
556 try {
557 EVENT_LOCK.wait(3000);
558 } catch (InterruptedException ie) {
559 xembedLog.warning("Event wait interrupted", ie);
560 }
561 eventWaited = -1;
562 if (checkEventList(position, event) == -1) {
563 dumpReceivedEvents();
564 throw new RuntimeException("Didn't receive event " + XEmbedHelper.msgidToString(event) + " but recevied " + XEmbedHelper.msgidToString(eventReceived));
565 } else {
566 if (xembedLog.isLoggable(PlatformLogger.Level.FINER)) {
567 xembedLog.finer("Successfully recevied " + XEmbedHelper.msgidToString(event));
568 }
569 }
570 }
571 }
572 /**
573 * Checks if the <code>event</code> is already in a list at position >= <code>position</code>
574 */
575 private int checkEventList(int position, int event) {
576 if (position == -1) {
577 return -1;
578 }
579 synchronized(EVENT_LOCK) {
580 for (int i = position; i < events.size(); i++) {
581 if (events.get(i) == event) {
582 return i;
583 }
584 }
585 return -1;
586 }
587 }
588
589 private void checkFocusedServerNext() {
590 if (focusedServerComponent != 0) {
591 throw new RuntimeException("Wrong focused server component, should be 0, but it is " + focusedServerComponent);
592 }
593 }
|
553 if (xembedLog.isLoggable(PlatformLogger.Level.FINER)) {
554 xembedLog.finer("Waiting for " + XEmbedHelper.msgidToString(event) + " starting from " + position);
555 }
556 try {
557 EVENT_LOCK.wait(3000);
558 } catch (InterruptedException ie) {
559 xembedLog.warning("Event wait interrupted", ie);
560 }
561 eventWaited = -1;
562 if (checkEventList(position, event) == -1) {
563 dumpReceivedEvents();
564 throw new RuntimeException("Didn't receive event " + XEmbedHelper.msgidToString(event) + " but recevied " + XEmbedHelper.msgidToString(eventReceived));
565 } else {
566 if (xembedLog.isLoggable(PlatformLogger.Level.FINER)) {
567 xembedLog.finer("Successfully recevied " + XEmbedHelper.msgidToString(event));
568 }
569 }
570 }
571 }
572 /**
573 * Checks if the {@code event} is already in a list at position >= {@code position}
574 */
575 private int checkEventList(int position, int event) {
576 if (position == -1) {
577 return -1;
578 }
579 synchronized(EVENT_LOCK) {
580 for (int i = position; i < events.size(); i++) {
581 if (events.get(i) == event) {
582 return i;
583 }
584 }
585 return -1;
586 }
587 }
588
589 private void checkFocusedServerNext() {
590 if (focusedServerComponent != 0) {
591 throw new RuntimeException("Wrong focused server component, should be 0, but it is " + focusedServerComponent);
592 }
593 }
|