1 // **********************************************************************
3 // Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
5 // This copy of Ice is licensed to you under the terms described in the
6 // ICE_LICENSE file included in this distribution.
8 // **********************************************************************
10 package test
.Ice
.dispatcher
;
12 public class Dispatcher
implements Runnable
, Ice
.Dispatcher
19 throw new RuntimeException();
25 _thread
= new Thread(this);
37 if(!_terminated
&& _calls
.isEmpty())
43 catch(java
.lang
.InterruptedException ex
)
54 // Terminate only once all calls are dispatched.
67 // Exceptions should never propagate here.
74 synchronized public void
75 dispatch(Runnable call
, Ice
.Connection con
)
77 boolean added
= _calls
.offer(call
);
79 if(_calls
.size() == 1)
100 catch(java
.lang
.InterruptedException ex
)
109 return Thread
.currentThread() == _thread
;
112 private java
.util
.Queue
<Runnable
> _calls
= new java
.util
.LinkedList
<Runnable
>();
113 private Thread _thread
;
114 private boolean _terminated
= false;