⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 connectnotifier.java

📁 提供ESB 应用mule源代码 提供ESB 应用mule源代码
💻 JAVA
字号:
/* * $Id: ConnectNotifier.java 13090 2008-10-17 13:14:07Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */package org.mule.retry.notifiers;import org.mule.MuleServer;import org.mule.api.retry.RetryContext;import org.mule.api.retry.RetryNotifier;import org.mule.config.ExceptionHelper;import org.mule.context.notification.ConnectionNotification;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;/** * Fires a {@link ConnectionNotification} each time a retry attempt is made. */public class ConnectNotifier implements RetryNotifier{    protected transient final Log logger = LogFactory.getLog(ConnectNotifier.class);    public void sucess(RetryContext context)    {        if (logger.isDebugEnabled())        {            logger.debug("Successfully connected to " + context.getDescription());        }        fireConnectNotification(ConnectionNotification.CONNECTION_CONNECTED, context.getDescription());    }    public void failed(RetryContext context, Throwable e)    {        fireConnectNotification(ConnectionNotification.CONNECTION_FAILED, context.getDescription());        if (logger.isErrorEnabled())        {            StringBuffer msg = new StringBuffer(512);            msg.append("Failed to connect/reconnect: ").append(context.getDescription());            Throwable t = ExceptionHelper.getRootException(e);            msg.append(". Root Exception was: ").append(ExceptionHelper.writeException(t));            logger.error(msg.toString());        }    }    protected void fireConnectNotification(int action, String description)    {        // TODO Make this class MuleContextAware        MuleServer.getMuleContext().fireNotification(new ConnectionNotification(null, description, action));    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -