| | |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | import org.opends.messages.Message; |
| | | |
| | | |
| | | |
| | |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.ErrorLogCategory; |
| | | import org.opends.server.types.ErrorLogSeverity; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.Operation; |
| | | import org.opends.server.types.ResultCode; |
| | | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.ErrorLogger.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import static org.opends.server.messages.ConfigMessages.*; |
| | | import static org.opends.server.messages.CoreMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import org.opends.server.types.AbstractOperation; |
| | | |
| | | |
| | |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_WORK_QUEUE_CANNOT_CREATE_MONITOR; |
| | | String message = getMessage(msgID, TraditionalWorkQueueMonitor.class, |
| | | String.valueOf(e)); |
| | | logError(ErrorLogCategory.CORE_SERVER, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | Message message = ERR_CONFIG_WORK_QUEUE_CANNOT_CREATE_MONITOR.get( |
| | | String.valueOf(TraditionalWorkQueueMonitor.class), String.valueOf(e)); |
| | | logError(message); |
| | | } |
| | | } |
| | | |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public void finalizeWorkQueue(String reason) |
| | | public void finalizeWorkQueue(Message reason) |
| | | { |
| | | shutdownRequested = true; |
| | | |
| | |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | logError(ErrorLogCategory.CORE_SERVER, ErrorLogSeverity.SEVERE_WARNING, |
| | | MSGID_QUEUE_UNABLE_TO_CANCEL, String.valueOf(o), |
| | | String.valueOf(e)); |
| | | logError(WARN_QUEUE_UNABLE_TO_CANCEL.get( |
| | | String.valueOf(o), String.valueOf(e))); |
| | | } |
| | | } |
| | | |
| | |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | logError(ErrorLogCategory.CORE_SERVER, ErrorLogSeverity.SEVERE_WARNING, |
| | | MSGID_QUEUE_UNABLE_TO_NOTIFY_THREAD, t.getName(), |
| | | String.valueOf(e)); |
| | | logError(WARN_QUEUE_UNABLE_TO_NOTIFY_THREAD.get( |
| | | t.getName(), String.valueOf(e))); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | if (shutdownRequested) |
| | | { |
| | | int messageID = MSGID_OP_REJECTED_BY_SHUTDOWN; |
| | | String message = getMessage(messageID); |
| | | throw new DirectoryException(ResultCode.UNAVAILABLE, message, messageID); |
| | | Message message = WARN_OP_REJECTED_BY_SHUTDOWN.get(); |
| | | throw new DirectoryException(ResultCode.UNAVAILABLE, message); |
| | | } |
| | | |
| | | if (! opQueue.offer(operation)) |
| | | { |
| | | queueFullRejects.incrementAndGet(); |
| | | |
| | | int messageID = MSGID_OP_REJECTED_BY_QUEUE_FULL; |
| | | String message = getMessage(messageID, maxCapacity); |
| | | throw new DirectoryException(ResultCode.UNAVAILABLE, message, messageID); |
| | | Message message = WARN_OP_REJECTED_BY_QUEUE_FULL.get(maxCapacity); |
| | | throw new DirectoryException(ResultCode.UNAVAILABLE, message); |
| | | } |
| | | |
| | | opsSubmitted.incrementAndGet(); |
| | |
| | | { |
| | | if (numFailures > MAX_RETRY_COUNT) |
| | | { |
| | | int msgID = MSGID_CONFIG_WORK_QUEUE_TOO_MANY_FAILURES; |
| | | String message = getMessage(msgID, Thread.currentThread().getName(), |
| | | numFailures, MAX_RETRY_COUNT); |
| | | logError(ErrorLogCategory.CORE_SERVER, ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | Message message = ERR_CONFIG_WORK_QUEUE_TOO_MANY_FAILURES.get( |
| | | Thread.currentThread().getName(), numFailures, MAX_RETRY_COUNT); |
| | | logError(message); |
| | | } |
| | | |
| | | return null; |
| | |
| | | |
| | | // If we've gotten here, then the worker thread was interrupted for some |
| | | // other reason. This should not happen, and we need to log a message. |
| | | logError(ErrorLogCategory.CORE_SERVER, ErrorLogSeverity.SEVERE_WARNING, |
| | | MSGID_WORKER_INTERRUPTED_WITHOUT_SHUTDOWN, |
| | | Thread.currentThread().getName(), String.valueOf(ie)); |
| | | logError(WARN_WORKER_INTERRUPTED_WITHOUT_SHUTDOWN.get( |
| | | Thread.currentThread().getName(), String.valueOf(ie))); |
| | | return retryNextOperation(workerThread, numFailures+1); |
| | | } |
| | | catch (Exception e) |
| | |
| | | |
| | | // This should not happen. The only recourse we have is to log a message |
| | | // and try again. |
| | | logError(ErrorLogCategory.CORE_SERVER, ErrorLogSeverity.SEVERE_WARNING, |
| | | MSGID_WORKER_WAITING_UNCAUGHT_EXCEPTION, |
| | | Thread.currentThread().getName(), String.valueOf(e)); |
| | | logError(WARN_WORKER_WAITING_UNCAUGHT_EXCEPTION.get( |
| | | Thread.currentThread().getName(), String.valueOf(e))); |
| | | return retryNextOperation(workerThread, numFailures + 1); |
| | | } |
| | | } |
| | |
| | | */ |
| | | public boolean isConfigurationChangeAcceptable( |
| | | TraditionalWorkQueueCfg configuration, |
| | | List<String> unacceptableReasons) |
| | | List<Message> unacceptableReasons) |
| | | { |
| | | // The provided configuration will always be acceptable. |
| | | return true; |
| | |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | TraditionalWorkQueueCfg configuration) |
| | | { |
| | | ArrayList<String> resultMessages = new ArrayList<String>(); |
| | | ArrayList<Message> resultMessages = new ArrayList<Message>(); |
| | | int newNumThreads = configuration.getNumWorkerThreads(); |
| | | int newMaxCapacity = configuration.getMaxWorkQueueCapacity(); |
| | | |