Search in sources :

Example 6 with MQThread

use of com.sun.messaging.jmq.util.MQThread in project openmq by eclipse-ee4j.

the class ConsumerInfoNotifyManager method createNotifyThread.

private void createNotifyThread() {
    if (notifyThread == null) {
        notifyThread = new MQThread(this, "ConsumerInfoNotifyManager");
        notifyThread.setDaemon(true);
        notifyThread.start();
    }
}
Also used : MQThread(com.sun.messaging.jmq.util.MQThread)

Example 7 with MQThread

use of com.sun.messaging.jmq.util.MQThread in project openmq by eclipse-ee4j.

the class ThreadPool method createNewThread.

/**
 * create a new thread and add it to the thread list
 *
 * @throws ArrayIndexOutOfBoundsException if max threads has been reached
 */
private synchronized BasicRunnable createNewThread(int indx) throws ArrayIndexOutOfBoundsException {
    if (indx >= max) {
        throw new ArrayIndexOutOfBoundsException(Globals.getBrokerResources().getString(BrokerResources.X_INTERNAL_EXCEPTION, "Too many threads " + current_count + "," + max));
    }
    BasicRunnable runner = null;
    if (indx < current.size()) {
        // get current if possible
        runner = (BasicRunnable) current.get(indx);
    }
    if (runner == null) {
        runner = runfac.getRunnable(indx, this);
        if (current.size() <= indx) {
            current.add(indx, runner);
        } else {
            current.set(indx, runner);
        }
    }
    runner.setState(BasicRunnable.RUN_READY);
    Thread thr = new MQThread(tgroup, runner, "Thread-" + name + "[" + indx + "]");
    thr.setPriority(priority);
    if (indx >= min) {
        runner.setThreadBehavior(BasicRunnable.B_TIMEOUT_THREAD);
    }
    current_count++;
    thr.start();
    return runner;
}
Also used : MQThread(com.sun.messaging.jmq.util.MQThread) MQThread(com.sun.messaging.jmq.util.MQThread)

Example 8 with MQThread

use of com.sun.messaging.jmq.util.MQThread in project openmq by eclipse-ee4j.

the class FileTransactionLogWriter method init.

private void init(File parent, String child, long size) throws IOException {
    this.debug = Boolean.getBoolean(TXNLOG_DEBUG_PROP_NAME);
    this.doFileBackup = Boolean.getBoolean(TXNLOG_BACKUP_PROP_NAME);
    file = new File(parent, child);
    setMaximumSize(size);
    if (raf != null) {
        raf.close();
    }
    if (doAsyncWrites) {
        log("starting asyncwrite");
        asyncWriteThread = new MQThread(this, child + "AsyncWrite");
        asyncWriteThread.setPriority(Thread.NORM_PRIORITY - 1);
        asyncWriteThread.start();
    }
    /**
     * The default file mode is RWD_MODE ("rwd"). If this class is instantiated with a file mode, the file mode is set to
     * the specified mode ("rw", "rws", "rwd" only).
     */
    log("Using file mode: " + fileMode);
    raf = new RandomAccessFile(file, fileMode);
    /**
     * If "rw" mode is specified, useFileChannelSync flag is set to true.
     */
    if (this.useFileChannelSync) {
        log("File Channel Sync flag is on ...");
        fchannel = raf.getChannel();
    }
    if (raf.length() > 0) {
        if (debug) {
            log("file exists: " + file.getAbsolutePath() + ", file size: " + raf.length());
        }
        readFileHeader();
        if (this.playBackRequired == false) {
            writeFileHeader(FILE_STATUS_CHK_POINT_UPDATED, FILE_HEADER_SIZE);
        }
    } else {
        // do create header for now.
        existingAppCookie = currentAppCookie;
        initNewFile();
    }
}
Also used : RandomAccessFile(java.io.RandomAccessFile) MQThread(com.sun.messaging.jmq.util.MQThread) RandomAccessFile(java.io.RandomAccessFile) File(java.io.File)

Aggregations

MQThread (com.sun.messaging.jmq.util.MQThread)8 Agent (com.sun.messaging.jmq.jmsserver.management.agent.Agent)2 BridgeServiceManager (com.sun.messaging.bridge.api.BridgeServiceManager)1 com.sun.messaging.jmq.jmsserver.cluster.api (com.sun.messaging.jmq.jmsserver.cluster.api)1 PacketRouter (com.sun.messaging.jmq.jmsserver.data.PacketRouter)1 AdminDataHandler (com.sun.messaging.jmq.jmsserver.data.handlers.admin.AdminDataHandler)1 CoreLifecycleSpi (com.sun.messaging.jmq.jmsserver.plugin.spi.CoreLifecycleSpi)1 Password (com.sun.messaging.jmq.util.Password)1 Rlimit (com.sun.messaging.jmq.util.Rlimit)1 MQTimer (com.sun.messaging.jmq.util.timer.MQTimer)1 File (java.io.File)1 RandomAccessFile (java.io.RandomAccessFile)1 ArrayList (java.util.ArrayList)1