/** * @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; } }
/** * * This implementation relies on the default <code>RejectedExecutionHandler</code>, {@link java.util.concurrent.ThreadPoolExecutor.AbortPolicy}, which * throws a <code>RejectedExecutionException</code> if the command cannot be queued for execution. */ public void execute(Runnable command) { try { super.execute(command); } catch (RejectedExecutionException e) { FailedExecutionHandler handler = getFailedExecutionHandler(); if (handler != null) { handler.failedExecution(command, this, e); } else if (Log.isError()) { Log.getLogger(LogCategories.EXECUTOR).error("DefaultThreadPoolExecutor hit a RejectedExecutionException but no FailedExecutionHandler is registered to handle the error.", e); } } } }
/** * * This implementation relies on the default <code>RejectedExecutionHandler</code>, {@link java.util.concurrent.ThreadPoolExecutor.AbortPolicy}, which * throws a <code>RejectedExecutionException</code> if the command cannot be queued for execution. */ public void execute(Runnable command) { try { super.execute(command); } catch (RejectedExecutionException e) { FailedExecutionHandler handler = getFailedExecutionHandler(); if (handler != null) { handler.failedExecution(command, this, e); } else if (Log.isError()) { Log.getLogger(LogCategories.EXECUTOR).error("DefaultThreadPoolExecutor hit a RejectedExecutionException but no FailedExecutionHandler is registered to handle the error.", e); } } } }
if (Log.isError()) Log.getLogger(LOG_CATEGORY).error("TimeoutManager '" + System.identityHashCode(TimeoutManager.this) + "' encountered an error running the timeout task for instance '" + System.identityHashCode(timeoutObject) + "' of type '" + timeoutObject.getClass().getName() + "'. Task queue size: "+ timeoutService.getQueue().size(), t);
/** * Handles command execution problems by notifying the FailedExecutionHandler if one has been set * and otherwise logging the failure. * * @param command The command that failed to execute successfully. * @param e The exception generated by the failed command. */ private void handleFailedExecution(Runnable command, Exception e) { FailedExecutionHandler handler = getFailedExecutionHandler(); if (handler != null) { handler.failedExecution(command, this, e); } else if (Log.isError()) { Log.getLogger(LogCategories.EXECUTOR).error("AsynchBeansWorkManager hit an Exception but no FailedExecutionHandler is registered to handle the error.", e); } }
/** * * 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) { SubscriptionInfo si = new SubscriptionInfo(selector, subtopic); if (subscriptions.remove(si)) { unregisterSubscriptionWithThrottleManager(si); 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; } }
/** * * 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) { SubscriptionInfo si = new SubscriptionInfo(selector, subtopic); if (subscriptions.remove(si)) { unregisterSubscriptionWithThrottleManager(si); 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; } }
/** * This method is provided for a cluster peer broadcast, it is not invoked locally. It is used * by remote clients to send their subscription table to this server. * * */ public void receiveSubscriptions(String destinationId, Object subscriptions, Object senderAddress) { Destination destination = getDestination(destinationId); if (destination instanceof MessageDestination) ((MessageDestination) destination).getRemoteSubscriptionManager().setSubscriptionState(subscriptions, senderAddress); else if (subscriptions != null && Log.isError()) Log.getLogger(LOG_CATEGORY).error("receiveSubscriptions called with non-null value but destination: " + destinationId + " is not a MessageDestination"); }
/** * This method is provided for a cluster peer broadcast, it is not invoked locally. It is used * by remote clients to send their subscription table to this server. * * */ public void receiveSubscriptions(String destinationId, Object subscriptions, Object senderAddress) { Destination destination = getDestination(destinationId); if (destination instanceof MessageDestination) ((MessageDestination) destination).getRemoteSubscriptionManager().setSubscriptionState(subscriptions, senderAddress); else if (subscriptions != null && Log.isError()) Log.getLogger(LOG_CATEGORY).error("receiveSubscriptions called with non-null value but destination: " + destinationId + " is not a MessageDestination"); }
/** {@inheritDoc} */ @Override public Object clone() { try { AbstractProxy clonedProxy= (AbstractProxy) super.clone(); clonedProxy.setCloneFieldsFrom(this); return clonedProxy; } catch (CloneNotSupportedException e) { if (Log.isError()) { Logger log = Log.getLogger(LOG_CATEGORY); log.error("Failed to clone a property proxy: " + toString()); } MessageException ex = new MessageException(); ex.setMessage(CONVERSION_ERROR); throw ex; } }
/** {@inheritDoc} */ public Object clone() { try { AbstractProxy clonedProxy= (AbstractProxy) super.clone(); clonedProxy.setCloneFieldsFrom(this); return clonedProxy; } catch (CloneNotSupportedException e) { if (Log.isError()) { Logger log = Log.getLogger(LOG_CATEGORY); log.error("Failed to clone a property proxy: " + toString()); } MessageException ex = new MessageException(); ex.setMessage(CONVERSION_ERROR); throw ex; } }
/** {@inheritDoc} */ @Override public Object clone() { try { AbstractProxy clonedProxy= (AbstractProxy) super.clone(); clonedProxy.setCloneFieldsFrom(this); return clonedProxy; } catch (CloneNotSupportedException e) { if (Log.isError()) { Logger log = Log.getLogger(LOG_CATEGORY); log.error("Failed to clone a property proxy: " + toString()); } MessageException ex = new MessageException(); ex.setMessage(CONVERSION_ERROR); throw ex; } }
/** * This method is provided for a cluster peer broadcast, it is not invoked locally. It is used * by remote clients to send their subscription table to this server. * * @exclude */ public void receiveSubscriptions(String destinationId, Object subscriptions, Object senderAddress) { Destination destination = getDestination(destinationId); if (destination instanceof MessageDestination) { ((MessageDestination) destination).getRemoteSubscriptionManager().setSubscriptionState(subscriptions, senderAddress); } else if (subscriptions != null) { if (Log.isError()) Log.getLogger(LOG_CATEGORY).error("receiveSubscriptions called with non-null value but destination: " + destinationId + " is not a MessageDestination"); } }
/** * @exclude * This implementation relies on the default <code>RejectedExecutionHandler</code>, {@link java.util.concurrent.ThreadPoolExecutor.AbortPolicy}, which * throws a <code>RejectedExecutionException</code> if the command cannot be queued for execution. */ public void execute(Runnable command) { try { super.execute(command); } catch (RejectedExecutionException e) { FailedExecutionHandler handler = getFailedExecutionHandler(); if (handler != null) { handler.failedExecution(command, this, e); } else if (Log.isError()) { Log.getLogger(LogCategories.EXECUTOR).error("DefaultThreadPoolExecutor hit a RejectedExecutionException but no FailedExecutionHandler is registered to handle the error.", e); } } } }
/** * 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"); }
/** * Utility method to flush the outbound queue and log any problems. * If a specific client is passed, we need to invoke a client-specific flush. * If the passed client is null, we do a general flush of the queue. * Any exceptions are logged and then rethrown. */ private FlushResult internalFlush(EndpointQueue queue, MessageClient client) { FlushResult flushResult = null; try { flushResult = (client == null) ? queue.processor.flush(queue.messages) : queue.processor.flush(client, queue.messages); shutdownQueue(queue); // Update the last-use timestamp if we're writing messages back to the client. List messages = (flushResult != null) ? flushResult.getMessages() : null; if (messages != null && !messages.isEmpty()) updateLastUse(); } catch (RuntimeException e) { if (Log.isError()) Log.getLogger(FLEX_CLIENT_LOG_CATEGORY).error("Failed to flush an outbound queue for FlexClient '" + getId() + "'.", e); throw e; } return flushResult; }
if (Log.isError()) Log.getLogger(FLEX_CLIENT_LOG_CATEGORY).error("Failed to flush an outbound queue for FlexClient '" + getId() + "'.", e); throw e;
if (Log.isError()) Log.getLogger(FLEX_CLIENT_LOG_CATEGORY).error("Failed to flush an outbound queue for MessageClient '" + client.getClientId() + "' for FlexClient '" + getId() + "'.", e); throw e;
/** * 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"); }
/** * 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"); }