class JMSAppender implements PaxAppender {

    public void doAppend(final PaxLoggingEvent paxLoggingEvent) {
        if (exclude(paxLoggingEvent) || jmsConnectionFactory == null) {
            return;
        }
        Runnable worker = new Runnable() {
            public void run() {
                try {
                    // Send message to the destination
                    TextMessage message = getOrCreateSession().createTextMessage();
                    message.setText(format.toString(paxLoggingEvent));
                    MessageProducer producer = getOrCreatePublisher();
                    producer.send(message);
                } catch (JMSException e) {
                    LOG.warn("Exception caught while sending log event - reinitializing JMS resources to recover",e);
                    closeJMSResources();
                }
            }
        };
        executor.execute(worker);
    }

}