⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 threadpoolentry.java

📁 network management, thread implement
💻 JAVA
字号:
// Developed by Kinva Network Inc. 2000


// Source File Name:   ThreadPoolEntry.java

package com.kinva.util.thread;

import java.io.PrintStream;

// Referenced classes of package com.kinva.util.thread:
//            PoolThread, ThreadPool

public class ThreadPoolEntry
{

    ThreadPoolEntry(ThreadPool threadpool, PoolThread poolthread)
    {
        pool = threadpool;
        pt = poolthread;
        state = 0;
    }

    public PoolThread getThread()
    {
        return pt;
    }

    synchronized void waitForRelease()
    {
        while(state != 1) 
            try
            {
                wait();
            }
            catch(InterruptedException interruptedexception)
            {
                System.err.println(interruptedexception);
            }
    }

    public synchronized void release()
    {
        state = 1;
        notify();
    }

    void idle()
    {
        state = 0;
        pool.insertIdle(this);
    }

    void init()
    {
        pt.setPoolEntry(this);
        pt.start();
    }

    synchronized void shutdown()
    {
        if(state == 1)
            pt.abort();
        pt.stop();
    }

    public String toString()
    {
        return pt.toString();
    }

    public static final int TS_IDLE = 0;
    public static final int TS_BUSY = 1;
    private int state;
    private PoolThread pt;
    private ThreadPool pool;
    ThreadPoolEntry next;
    ThreadPoolEntry prev;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -