Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. synchronized <K, V, E> EventThread<K, V, E> getEventThread() {
  2. if (closed) {
  3. throw new IllegalStateException();
  4. }
  5. if (thread == null) {
  6. /* if there is no thread, then create a new one */
  7. thread = AccessController.doPrivileged(new PrivilegedAction<EventThread<K, V, E>>() {
  8. public EventThread<K, V, E> run() {
  9. EventThread<K, V, E> t = new EventThread<K, V, E>(threadGroup, threadName);
  10. return t;
  11. }
  12. });
  13. /* start the new thread */
  14. thread.start();
  15. }
  16.  
  17. @SuppressWarnings("unchecked")
  18. EventThread<K, V, E> result = (EventThread<K, V, E>) thread;
  19. return result;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement