本文整理了Java中org.jgroups.util.Util.getGlobalThreadGroup()
方法的一些代码示例,展示了Util.getGlobalThreadGroup()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.getGlobalThreadGroup()
方法的具体详情如下:
包路径:org.jgroups.util.Util
类名称:Util
方法名:getGlobalThreadGroup
暂无
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
public SocketThread(Socket sock, DataInputStream ois, String group_name, Address logical_addr) {
super(Util.getGlobalThreadGroup(), "SocketThread " + (threadCounter++));
this.sock=sock;
input=ois;
this.group_name=group_name;
this.logical_addr=logical_addr;
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
public WriterThread(OutputStream out, byte[] buf) {
super(Util.getGlobalThreadGroup(), "TimedWriter.WriterThread");
this.out=new DataOutputStream(out);
this.buf=buf;
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
public WriterThread(OutputStream out, int i) {
super(Util.getGlobalThreadGroup(), "TimedWriter.WriterThread");
this.out=new DataOutputStream(out);
this.i=i;
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
public void start() {
if(thread == null) {
thread=new Thread(Util.getGlobalThreadGroup(), this, UCAST_RECEIVER_THREAD_NAME);
// thread.setDaemon(true);
running=true;
thread.start();
}
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
public Thread newThread(final Runnable command) {
Thread thread = new Thread(Util.getGlobalThreadGroup(), command,
"STREAMING_STATE_TRANSFER state provider-"
+ threadCounter.incrementAndGet());
return thread;
}
};
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
final void start() {
if(acceptor == null) {
acceptor=new Thread(Util.getGlobalThreadGroup(), this, "ServerSocket acceptor thread");
acceptor.setDaemon(true);
acceptor.start();
}
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
private void passStreamUp(final StateTransferInfo sti) {
Runnable readingThread = new Runnable() {
public void run() {
up_prot.up(new Event(Event.STATE_TRANSFER_INPUTSTREAM, sti));
}
};
if(use_reading_thread){
new Thread(Util.getGlobalThreadGroup(), readingThread,
"STREAMING_STATE_TRANSFER.reader").start();
}else{
readingThread.run();
}
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
public void start() {
if(t == null || !t.isAlive()) {
t=new Thread(Util.getGlobalThreadGroup(), this, THREAD_NAME);
t.setDaemon(true);
t.start();
}
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
public void start() {
if(thread == null || !thread.isAlive()) {
thread=new Thread(Util.getGlobalThreadGroup(), this, "MERGE2.FindSubgroups thread");
thread.setDaemon(true);
thread.start();
}
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
void start() {
if(t == null || !t.isAlive()) {
t=new Thread(Util.getGlobalThreadGroup(), this, THREAD_NAME);
t.setDaemon(true);
t.start();
}
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
private void startReceiver() {
if(receiver == null || !receiver.isAlive()) {
receiver=new Thread(Util.getGlobalThreadGroup(), this, "ReceiverThread");
receiver.setDaemon(true);
receiver.start();
if(log.isTraceEnabled())
log.trace("receiver thread started");
}
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
public void start() {
thread_lock.lock();
try {
if(thread == null || !thread.isAlive()) {
thread=new Thread(Util.getGlobalThreadGroup(), this, "PingWaiter");
thread.setDaemon(true);
thread.start();
}
}
finally {
thread_lock.unlock();
}
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
public void start() {
lock.lock();
try {
if(thread == null || !thread.isAlive()) {
thread=new Thread(Util.getGlobalThreadGroup(), this, "PingSender");
thread.setDaemon(true);
thread.start();
}
}
finally {
lock.unlock();
}
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
CloserThread(Event evt) {
super(Util.getGlobalThreadGroup(), "CloserThread");
this.evt=evt;
setDaemon(true);
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
/**
* Does *not* need to be synchronized on pinger_mutex because the caller (down()) already has the mutex acquired
*/
void startPingerThread() {
running=true;
if(pinger_thread == null) {
pinger_thread=new Thread(Util.getGlobalThreadGroup(), this, "FD_SOCK Ping thread");
pinger_thread.setDaemon(true);
pinger_thread.start();
if(group_name != null) {
String tmp, prefix=Global.THREAD_PREFIX;
tmp=pinger_thread.getName();
if(tmp != null && !tmp.contains(prefix)) {
tmp+=prefix + group_name + ")";
pinger_thread.setName(tmp);
}
}
}
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
void start() throws IOException {
diag_sock=new MulticastSocket(diagnostics_port);
java.util.List interfaces=Util.getAllAvailableInterfaces();
bindToInterfaces(interfaces, diag_sock);
if(thread == null || !thread.isAlive()) {
thread=new Thread(Util.getGlobalThreadGroup(), this, THREAD_NAME);
thread.setDaemon(true);
thread.start();
}
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
public void connectionStatusChange(int newState) {
if(currentState == RouterStub.STATUS_CONNECTED && newState == RouterStub.STATUS_CONNECTION_LOST){
startReconnecting();
}
else if(currentState != RouterStub.STATUS_CONNECTED && newState == RouterStub.STATUS_CONNECTED){
stopReconnecting();
Thread receiver = new Thread(Util.getGlobalThreadGroup(), new TunnelReceiver(), "TUNNEL receiver");
receiver.setDaemon(true);
receiver.start();
}
currentState = newState;
}
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
synchronized void start(boolean unsuspend) {
if(q.closed())
q.reset();
if(unsuspend) {
suspended=false;
Future future;
synchronized(resume_tasks) {
future=resume_tasks.remove(merge_id);
}
if(future != null)
future.cancel(true);
}
merge_id=null;
if(thread == null || !thread.isAlive()) {
thread=new Thread(Util.getGlobalThreadGroup(), this, "ViewHandler");
thread.setDaemon(false); // thread cannot terminate if we have tasks left, e.g. when we as coord leave
thread.start();
if(log.isTraceEnabled())
log.trace("ViewHandler started");
}
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
protected static ThreadPoolExecutor createThreadPool() {
int min_threads=1, max_threads=4;
long keep_alive=30000;
ThreadFactory factory=new ThreadFactory() {
AtomicInteger num = new AtomicInteger(1);
ThreadGroup mux_threads=new ThreadGroup(Util.getGlobalThreadGroup(), "MultiplexerThreads");
public Thread newThread(Runnable command) {
Thread ret=new Thread(mux_threads, command, "Multiplexer-" + num.incrementAndGet());
ret.setDaemon(true);
return ret;
}
};
min_threads=Global.getPropertyAsInteger(Global.MUX_MIN_THREADS, min_threads);
max_threads=Global.getPropertyAsInteger(Global.MUX_MAX_THREADS, max_threads);
keep_alive=Global.getPropertyAsLong(Global.MUX_KEEPALIVE, keep_alive);
return new ThreadPoolExecutor(min_threads, max_threads, keep_alive, TimeUnit.MILLISECONDS,
new SynchronousQueue<Runnable>(), factory,
new ThreadPoolExecutor.CallerRunsPolicy());
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
public final void start() throws Exception {
super.start();
//Roland Kurmann 4/7/2003, build new thread group
thread_group = new ThreadGroup(Util.getGlobalThreadGroup(), "ConnectionTableThreads");
init();
srv_sock=createServerSocket(srv_port, max_port);
if (external_addr!=null)
local_addr=new IpAddress(external_addr, srv_sock.getLocalPort());
else if (bind_addr != null)
local_addr=new IpAddress(bind_addr, srv_sock.getLocalPort());
else
local_addr=new IpAddress(srv_sock.getLocalPort());
if(log.isDebugEnabled()) log.debug("server socket created on " + local_addr);
//Roland Kurmann 4/7/2003, put in thread_group
acceptor=new Thread(thread_group, this, "ConnectionTable.AcceptorThread");
acceptor.setDaemon(true);
acceptor.start();
m_backGroundThreads.add(acceptor);
// start the connection reaper - will periodically remove unused connections
if(use_reaper && reaper == null) {
reaper=new Reaper();
reaper.start();
}
}
内容来源于网络,如有侵权,请联系作者删除!