private void reportStatusIfDebug(String message) { String threadName = Thread.currentThread().getName(); if (Log.isDebug()) Log.getLogger(FLEX_CLIENT_LOG_CATEGORY).debug("Poll wait thread '" + threadName + "' for FlexClient with id '" + this.id + "' is " + message); }
/** * Adds the channel id to the list of default channel ids. * * @param id The id of the channel to add to the list of default channel ids. */ public void addDefaultChannel(String id) { if (defaultChannels == null) defaultChannels = new ArrayList<String>(); else if (defaultChannels.contains(id)) return; List<String> channelIds = getChannelIds(); if (channelIds == null || !channelIds.contains(id)) { // No channel with id ''{0}'' is known by the MessageBroker. if (Log.isWarn()) { Log.getLogger(LOG_CATEGORY).warn("No channel with id '{0}' is known by the MessageBroker." + " Not adding the channel.", new Object[]{id}); } return; } defaultChannels.add(id); }
/** * Receive the next message from the underlying MessageConsumer or wait * indefinetely until a message arrives if there is no message. * * @return The received JMS message. * @throws JMSException The thrown JMS exception. */ public Message receive() throws JMSException { if (Log.isInfo()) Log.getLogger(JMSAdapter.LOG_CATEGORY).info(Thread.currentThread() + " JMS consumer for JMS destination '" + destinationJndiName + "' is waiting forever until a new message arrives."); return consumer.receive(); }
/** * @exclude * Removes a subscription from the subscription set for this MessageClient. * * @param selector The selector expression for the subscription. * @param subtopic The subtopic for the subscription. * @return true if no subscriptions remain for this MessageClient; otherwise false. */ public boolean removeSubscription(String selector, String subtopic) { synchronized (lock) { if (subscriptions.remove(new SubscriptionInfo(selector, subtopic))) return decrementReferences(); else if (Log.isError()) Log.getLogger(MessageService.LOG_CATEGORY).error("Error - unable to find subscription to remove for MessageClient: " + clientId + " selector: " + selector + " subtopic: " + subtopic); return numReferences == 0; } }
/** * Stops the <code>JMSProducer</code> by closing its underlying * <code>MessageProducer</code>. It then calls <code>JMSProxy.close</code> * for session and connection closure. */ public void stop() { if (Log.isInfo()) Log.getLogger(JMSAdapter.LOG_CATEGORY).info("JMS producer for JMS destination '" + destinationJndiName + "' is stopping."); try { if (producer != null) producer.close(); } catch (JMSException e) { if (Log.isWarn()) Log.getLogger(JMSAdapter.LOG_CATEGORY).warn("JMS producer for JMS destination '" + destinationJndiName + "' received an error while closing" + " its underlying MessageProducer: " + e.getMessage()); } super.stop(); }
/** * This is called remotely from other cluster members when a new remote subscription is identified. * * We add or remove a remote subscription... */ public void subscribeFromPeer(String destinationId, Boolean subscribe, String selector, String subtopic, Object remoteAddress) { Destination destination = getDestination(destinationId); RemoteSubscriptionManager subMgr = ((MessageDestination) destination).getRemoteSubscriptionManager(); if (destination instanceof MessageDestination) { if (Log.isDebug()) Log.getLogger(MessageService.LOG_CATEGORY).debug("Received subscription from peer: " + remoteAddress + " subscribe? " + subscribe + " selector: " + selector + " subtopic: " + subtopic); if (subscribe.booleanValue()) subMgr.addSubscriber(remoteAddress, selector, subtopic, null); else subMgr.removeSubscriber(remoteAddress, selector, subtopic, null); } else if (Log.isError()) Log.getLogger(LOG_CATEGORY).error("subscribeFromPeer called with destination: " + destinationId + " that is not a MessageDestination"); }
public void logEvent(LogEvent logevent) { String category = logevent.logger.getCategory(); if (this.categoryPrefix != null) { category = this.categoryPrefix + "." + category;
/** * Given a category, returns the logger associated with the category. * * @param category Categogry for the logger. * @return Logger associated with the category. */ public static Logger getLogger(String category) { if (log != null) return getLogger(log, category); // Return a dummy logger? return new Logger(category); }
/** * Sets up this target with the specified logger. * This allows this target to receive log events from the specified logger. * * @param logger this target should listen to. */ public void addLogger(Logger logger) { if (logger != null) { synchronized (lock) { loggerCount++; } logger.addTarget(this); } }
public void workRejected(WorkEvent event) { WorkException e = event.getException(); if (Log.isDebug()) Log.getLogger(LogCategories.EXECUTOR).error("AsynchBeansWorkManager's WorkListener.workRejected() callback invoked. WorkException? " + e); handleFailedExecution(((WorkCommandWrapper)event.getWork()).command, e); } public void workStarted(WorkEvent event)
/** * Stops the <code>JMSProducer</code> by closing its underlying * <code>MessageProducer</code>. It then calls <code>JMSProxy.close</code> * for session and connection closure. */ public void stop() { if (Log.isInfo()) Log.getLogger(JMSAdapter.LOG_CATEGORY).info("JMS producer for JMS destination '" + destinationJndiName + "' is stopping."); try { if (producer != null) producer.close(); } catch (JMSException e) { if (Log.isWarn()) Log.getLogger(JMSAdapter.LOG_CATEGORY).warn("JMS producer for JMS destination '" + destinationJndiName + "' received an error while closing" + " its underlying MessageProducer: " + e.getMessage()); } super.stop(); }
/** * This is called remotely from other cluster members when a new remote subscription is identified. * * We add or remove a remote subscription... * @param destinationId the destination ID * @param subscribe whehter it is a subscribe or unsubscribe * @param selector the selector string * @param subtopc the subtopic string * @param remoteAddress the remote node address in the cluster */ public void subscribeFromPeer(String destinationId, Boolean subscribe, String selector, String subtopic, Object remoteAddress) { Destination destination = getDestination(destinationId); RemoteSubscriptionManager subMgr = ((MessageDestination) destination).getRemoteSubscriptionManager(); if (destination instanceof MessageDestination) { if (debug) Log.getLogger(MessageService.LOG_CATEGORY).debug("Received subscription from peer: " + remoteAddress + " subscribe? " + subscribe + " selector: " + selector + " subtopic: " + subtopic); if (subscribe) subMgr.addSubscriber(remoteAddress, selector, subtopic, null); else subMgr.removeSubscriber(remoteAddress, selector, subtopic, null); } else if (Log.isError()) Log.getLogger(LOG_CATEGORY).error("subscribeFromPeer called with destination: " + destinationId + " that is not a MessageDestination"); }
("[" + event.logger.getCategory() + "] ") : ""; String level = ""; if (includeLevel)
/** * Given a category, returns the logger associated with the category. * * @param category Categogry for the logger. * @return Logger associated with the category. */ public static Logger getLogger(String category) { if (log != null) return getLogger(log, category); // Return a dummy logger? return new Logger(category); }
/** * Sets up this target with the specified logger. * This allows this target to receive log events from the specified logger. * * @param logger this target should listen to. */ public void addLogger(Logger logger) { if (logger != null) { synchronized (lock) { loggerCount++; } logger.addTarget(this); } }
public void workCompleted(WorkEvent event) { // This only needs to be handled if execution of the Runnable failed. WorkException e = event.getException(); if (e != null) { if (Log.isDebug()) Log.getLogger(LogCategories.EXECUTOR).error("AsynchBeansWorkManager's WorkListener.workCompleted() callback invoked for failed execution.", e); handleFailedExecution(((WorkCommandWrapper)event.getWork()).command, e); } } public void workRejected(WorkEvent event)
private void reportStatusIfDebug(String message) { String threadName = Thread.currentThread().getName(); if (Log.isDebug()) Log.getLogger(FLEX_CLIENT_LOG_CATEGORY).debug("Poll wait thread '" + threadName + "' for FlexClient with id '" + this.id + "' is " + message); }
/** * Adds the channel id to the list of default channel ids. * * @param id The id of the channel to add to the list of default channel ids. */ public void addDefaultChannel(String id) { if (defaultChannels == null) defaultChannels = new ArrayList(); else if (defaultChannels.contains(id)) return; List channelIds = getChannelIds(); if (channelIds == null || !channelIds.contains(id)) { // No channel with id ''{0}'' is known by the MessageBroker. if (Log.isWarn()) { Log.getLogger(LOG_CATEGORY).warn("No channel with id '{0}' is known by the MessageBroker." + " Not adding the channel.", new Object[]{id}); } return; } defaultChannels.add(id); }
/** * Stops the <code>JMSProducer</code> by closing its underlying * <code>MessageProducer</code>. It then calls <code>JMSProxy.close</code> * for session and connection closure. */ public void stop() { if (Log.isInfo()) Log.getLogger(JMSAdapter.LOG_CATEGORY).info("JMS producer for JMS destination '" + destinationJndiName + "' is stopping."); try { if (producer != null) producer.close(); } catch (JMSException e) { if (Log.isWarn()) Log.getLogger(JMSAdapter.LOG_CATEGORY).warn("JMS producer for JMS destination '" + destinationJndiName + "' received an error while closing" + " its underlying MessageProducer: " + e.getMessage()); } super.stop(); }
/** * Receive the next message from the underlying MessageConsumer or wait * indefinetely until a message arrives if there is no message. * * @return The received JMS message. * @throws JMSException The thrown JMS exception. */ public Message receive() throws JMSException { if (Log.isInfo()) Log.getLogger(JMSAdapter.LOG_CATEGORY).info(Thread.currentThread() + " JMS consumer for JMS destination '" + destinationJndiName + "' is waiting forever until a new message arrives."); return consumer.receive(); }