org.jgroups.util.Util.getGlobalThreadGroup()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(174)

本文整理了Java中org.jgroups.util.Util.getGlobalThreadGroup()方法的一些代码示例,展示了Util.getGlobalThreadGroup()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.getGlobalThreadGroup()方法的具体详情如下:
包路径:org.jgroups.util.Util
类名称:Util
方法名:getGlobalThreadGroup

Util.getGlobalThreadGroup介绍

暂无

代码示例

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. public SocketThread(Socket sock, DataInputStream ois, String group_name, Address logical_addr) {
  2. super(Util.getGlobalThreadGroup(), "SocketThread " + (threadCounter++));
  3. this.sock=sock;
  4. input=ois;
  5. this.group_name=group_name;
  6. this.logical_addr=logical_addr;
  7. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. public WriterThread(OutputStream out, byte[] buf) {
  2. super(Util.getGlobalThreadGroup(), "TimedWriter.WriterThread");
  3. this.out=new DataOutputStream(out);
  4. this.buf=buf;
  5. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. public WriterThread(OutputStream out, int i) {
  2. super(Util.getGlobalThreadGroup(), "TimedWriter.WriterThread");
  3. this.out=new DataOutputStream(out);
  4. this.i=i;
  5. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. public void start() {
  2. if(thread == null) {
  3. thread=new Thread(Util.getGlobalThreadGroup(), this, UCAST_RECEIVER_THREAD_NAME);
  4. // thread.setDaemon(true);
  5. running=true;
  6. thread.start();
  7. }
  8. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. public Thread newThread(final Runnable command) {
  2. Thread thread = new Thread(Util.getGlobalThreadGroup(), command,
  3. "STREAMING_STATE_TRANSFER state provider-"
  4. + threadCounter.incrementAndGet());
  5. return thread;
  6. }
  7. };

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. final void start() {
  2. if(acceptor == null) {
  3. acceptor=new Thread(Util.getGlobalThreadGroup(), this, "ServerSocket acceptor thread");
  4. acceptor.setDaemon(true);
  5. acceptor.start();
  6. }
  7. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. private void passStreamUp(final StateTransferInfo sti) {
  2. Runnable readingThread = new Runnable() {
  3. public void run() {
  4. up_prot.up(new Event(Event.STATE_TRANSFER_INPUTSTREAM, sti));
  5. }
  6. };
  7. if(use_reading_thread){
  8. new Thread(Util.getGlobalThreadGroup(), readingThread,
  9. "STREAMING_STATE_TRANSFER.reader").start();
  10. }else{
  11. readingThread.run();
  12. }
  13. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. public void start() {
  2. if(t == null || !t.isAlive()) {
  3. t=new Thread(Util.getGlobalThreadGroup(), this, THREAD_NAME);
  4. t.setDaemon(true);
  5. t.start();
  6. }
  7. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. public void start() {
  2. if(thread == null || !thread.isAlive()) {
  3. thread=new Thread(Util.getGlobalThreadGroup(), this, "MERGE2.FindSubgroups thread");
  4. thread.setDaemon(true);
  5. thread.start();
  6. }
  7. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. void start() {
  2. if(t == null || !t.isAlive()) {
  3. t=new Thread(Util.getGlobalThreadGroup(), this, THREAD_NAME);
  4. t.setDaemon(true);
  5. t.start();
  6. }
  7. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. private void startReceiver() {
  2. if(receiver == null || !receiver.isAlive()) {
  3. receiver=new Thread(Util.getGlobalThreadGroup(), this, "ReceiverThread");
  4. receiver.setDaemon(true);
  5. receiver.start();
  6. if(log.isTraceEnabled())
  7. log.trace("receiver thread started");
  8. }
  9. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. public void start() {
  2. thread_lock.lock();
  3. try {
  4. if(thread == null || !thread.isAlive()) {
  5. thread=new Thread(Util.getGlobalThreadGroup(), this, "PingWaiter");
  6. thread.setDaemon(true);
  7. thread.start();
  8. }
  9. }
  10. finally {
  11. thread_lock.unlock();
  12. }
  13. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. public void start() {
  2. lock.lock();
  3. try {
  4. if(thread == null || !thread.isAlive()) {
  5. thread=new Thread(Util.getGlobalThreadGroup(), this, "PingSender");
  6. thread.setDaemon(true);
  7. thread.start();
  8. }
  9. }
  10. finally {
  11. lock.unlock();
  12. }
  13. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. CloserThread(Event evt) {
  2. super(Util.getGlobalThreadGroup(), "CloserThread");
  3. this.evt=evt;
  4. setDaemon(true);
  5. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. /**
  2. * Does *not* need to be synchronized on pinger_mutex because the caller (down()) already has the mutex acquired
  3. */
  4. void startPingerThread() {
  5. running=true;
  6. if(pinger_thread == null) {
  7. pinger_thread=new Thread(Util.getGlobalThreadGroup(), this, "FD_SOCK Ping thread");
  8. pinger_thread.setDaemon(true);
  9. pinger_thread.start();
  10. if(group_name != null) {
  11. String tmp, prefix=Global.THREAD_PREFIX;
  12. tmp=pinger_thread.getName();
  13. if(tmp != null && !tmp.contains(prefix)) {
  14. tmp+=prefix + group_name + ")";
  15. pinger_thread.setName(tmp);
  16. }
  17. }
  18. }
  19. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. void start() throws IOException {
  2. diag_sock=new MulticastSocket(diagnostics_port);
  3. java.util.List interfaces=Util.getAllAvailableInterfaces();
  4. bindToInterfaces(interfaces, diag_sock);
  5. if(thread == null || !thread.isAlive()) {
  6. thread=new Thread(Util.getGlobalThreadGroup(), this, THREAD_NAME);
  7. thread.setDaemon(true);
  8. thread.start();
  9. }
  10. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. public void connectionStatusChange(int newState) {
  2. if(currentState == RouterStub.STATUS_CONNECTED && newState == RouterStub.STATUS_CONNECTION_LOST){
  3. startReconnecting();
  4. }
  5. else if(currentState != RouterStub.STATUS_CONNECTED && newState == RouterStub.STATUS_CONNECTED){
  6. stopReconnecting();
  7. Thread receiver = new Thread(Util.getGlobalThreadGroup(), new TunnelReceiver(), "TUNNEL receiver");
  8. receiver.setDaemon(true);
  9. receiver.start();
  10. }
  11. currentState = newState;
  12. }
  13. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. synchronized void start(boolean unsuspend) {
  2. if(q.closed())
  3. q.reset();
  4. if(unsuspend) {
  5. suspended=false;
  6. Future future;
  7. synchronized(resume_tasks) {
  8. future=resume_tasks.remove(merge_id);
  9. }
  10. if(future != null)
  11. future.cancel(true);
  12. }
  13. merge_id=null;
  14. if(thread == null || !thread.isAlive()) {
  15. thread=new Thread(Util.getGlobalThreadGroup(), this, "ViewHandler");
  16. thread.setDaemon(false); // thread cannot terminate if we have tasks left, e.g. when we as coord leave
  17. thread.start();
  18. if(log.isTraceEnabled())
  19. log.trace("ViewHandler started");
  20. }
  21. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. protected static ThreadPoolExecutor createThreadPool() {
  2. int min_threads=1, max_threads=4;
  3. long keep_alive=30000;
  4. ThreadFactory factory=new ThreadFactory() {
  5. AtomicInteger num = new AtomicInteger(1);
  6. ThreadGroup mux_threads=new ThreadGroup(Util.getGlobalThreadGroup(), "MultiplexerThreads");
  7. public Thread newThread(Runnable command) {
  8. Thread ret=new Thread(mux_threads, command, "Multiplexer-" + num.incrementAndGet());
  9. ret.setDaemon(true);
  10. return ret;
  11. }
  12. };
  13. min_threads=Global.getPropertyAsInteger(Global.MUX_MIN_THREADS, min_threads);
  14. max_threads=Global.getPropertyAsInteger(Global.MUX_MAX_THREADS, max_threads);
  15. keep_alive=Global.getPropertyAsLong(Global.MUX_KEEPALIVE, keep_alive);
  16. return new ThreadPoolExecutor(min_threads, max_threads, keep_alive, TimeUnit.MILLISECONDS,
  17. new SynchronousQueue<Runnable>(), factory,
  18. new ThreadPoolExecutor.CallerRunsPolicy());
  19. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. public final void start() throws Exception {
  2. super.start();
  3. //Roland Kurmann 4/7/2003, build new thread group
  4. thread_group = new ThreadGroup(Util.getGlobalThreadGroup(), "ConnectionTableThreads");
  5. init();
  6. srv_sock=createServerSocket(srv_port, max_port);
  7. if (external_addr!=null)
  8. local_addr=new IpAddress(external_addr, srv_sock.getLocalPort());
  9. else if (bind_addr != null)
  10. local_addr=new IpAddress(bind_addr, srv_sock.getLocalPort());
  11. else
  12. local_addr=new IpAddress(srv_sock.getLocalPort());
  13. if(log.isDebugEnabled()) log.debug("server socket created on " + local_addr);
  14. //Roland Kurmann 4/7/2003, put in thread_group
  15. acceptor=new Thread(thread_group, this, "ConnectionTable.AcceptorThread");
  16. acceptor.setDaemon(true);
  17. acceptor.start();
  18. m_backGroundThreads.add(acceptor);
  19. // start the connection reaper - will periodically remove unused connections
  20. if(use_reaper && reaper == null) {
  21. reaper=new Reaper();
  22. reaper.start();
  23. }
  24. }

相关文章

Util类方法