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();
}
}
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;
}
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();
}
}
Aggregations