Search in sources :

Example 11 with EventLogger

use of org.apache.qpid.server.logging.EventLogger in project qpid-broker-j by apache.

the class SystemLauncher method startup.

public void startup(final Map<String, Object> systemConfigAttributes) throws Exception {
    final SystemOutMessageLogger systemOutMessageLogger = new SystemOutMessageLogger();
    _eventLogger = new EventLogger(systemOutMessageLogger);
    Subject.doAs(_brokerTaskSubject, new PrivilegedExceptionAction<Object>() {

        @Override
        public Object run() throws Exception {
            _listener.beforeStartup();
            try {
                startupImpl(systemConfigAttributes);
            } catch (RuntimeException e) {
                systemOutMessageLogger.message(new SystemStartupMessage(e));
                LOGGER.error("Exception during startup", e);
                _listener.errorOnStartup(e);
                closeSystemConfigAndCleanUp();
            } finally {
                _listener.afterStartup();
            }
            return null;
        }
    });
}
Also used : SystemOutMessageLogger(org.apache.qpid.server.logging.SystemOutMessageLogger) EventLogger(org.apache.qpid.server.logging.EventLogger) TimeoutException(java.util.concurrent.TimeoutException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) ExecutionException(java.util.concurrent.ExecutionException)

Example 12 with EventLogger

use of org.apache.qpid.server.logging.EventLogger in project qpid-broker-j by apache.

the class AbstractSystemConfig method makeActive.

protected ListenableFuture<Void> makeActive() {
    final EventLogger eventLogger = _eventLogger;
    final EventLogger startupLogger = initiateStartupLogging();
    try {
        final Container<?> container = initiateStoreAndRecovery();
        container.setEventLogger(startupLogger);
        final SettableFuture<Void> returnVal = SettableFuture.create();
        addFutureCallback(container.openAsync(), new FutureCallback() {

            @Override
            public void onSuccess(final Object result) {
                State state = container.getState();
                if (state == State.ACTIVE) {
                    startupLogger.message(BrokerMessages.READY());
                    container.setEventLogger(eventLogger);
                    returnVal.set(null);
                } else {
                    returnVal.setException(new ServerScopedRuntimeException("Broker failed reach ACTIVE state (state is " + state + ")"));
                }
            }

            @Override
            public void onFailure(final Throwable t) {
                returnVal.setException(t);
            }
        }, getTaskExecutor());
        return returnVal;
    } catch (IOException e) {
        throw new IllegalArgumentException(e);
    }
}
Also used : EventLogger(org.apache.qpid.server.logging.EventLogger) IOException(java.io.IOException) FutureCallback(com.google.common.util.concurrent.FutureCallback) ServerScopedRuntimeException(org.apache.qpid.server.util.ServerScopedRuntimeException)

Example 13 with EventLogger

use of org.apache.qpid.server.logging.EventLogger in project qpid-broker-j by apache.

the class AbstractSystemConfig method startQuiesced.

@StateTransition(currentState = State.UNINITIALIZED, desiredState = State.QUIESCED)
protected ListenableFuture<Void> startQuiesced() {
    final EventLogger startupLogger = initiateStartupLogging();
    try {
        final Container<?> container = initiateStoreAndRecovery();
        container.setEventLogger(startupLogger);
        return Futures.immediateFuture(null);
    } catch (IOException e) {
        throw new IllegalArgumentException(e);
    }
}
Also used : EventLogger(org.apache.qpid.server.logging.EventLogger) IOException(java.io.IOException)

Example 14 with EventLogger

use of org.apache.qpid.server.logging.EventLogger in project qpid-broker-j by apache.

the class NonJavaTrustStoreTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    when(_broker.getTaskExecutor()).thenReturn(_taskExecutor);
    when(_broker.getChildExecutor()).thenReturn(_taskExecutor);
    when(_broker.getModel()).thenReturn(_model);
    when(_broker.getEventLogger()).thenReturn(new EventLogger());
    when(((Broker) _broker).getCategoryClass()).thenReturn(Broker.class);
}
Also used : Broker(org.apache.qpid.server.model.Broker) EventLogger(org.apache.qpid.server.logging.EventLogger)

Example 15 with EventLogger

use of org.apache.qpid.server.logging.EventLogger in project qpid-broker-j by apache.

the class SiteSpecificTrustStoreTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    int connectTimeout = Integer.getInteger("SiteSpecificTrustStoreTest.connectTimeout", 1000);
    int readTimeout = Integer.getInteger("SiteSpecificTrustStoreTest.readTimeout", 1000);
    setTestSystemProperty(SiteSpecificTrustStore.TRUST_STORE_SITE_SPECIFIC_CONNECT_TIMEOUT, String.valueOf(connectTimeout));
    setTestSystemProperty(SiteSpecificTrustStore.TRUST_STORE_SITE_SPECIFIC_READ_TIMEOUT, String.valueOf(readTimeout));
    when(_broker.getTaskExecutor()).thenReturn(_taskExecutor);
    when(_broker.getChildExecutor()).thenReturn(_taskExecutor);
    when(_broker.getModel()).thenReturn(_model);
    when(_broker.getEventLogger()).thenReturn(new EventLogger());
    when(((Broker) _broker).getCategoryClass()).thenReturn(Broker.class);
}
Also used : Broker(org.apache.qpid.server.model.Broker) EventLogger(org.apache.qpid.server.logging.EventLogger)

Aggregations

EventLogger (org.apache.qpid.server.logging.EventLogger)40 Broker (org.apache.qpid.server.model.Broker)15 SystemConfig (org.apache.qpid.server.model.SystemConfig)10 TaskExecutor (org.apache.qpid.server.configuration.updater.TaskExecutor)8 HashMap (java.util.HashMap)7 CurrentThreadTaskExecutor (org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor)7 Principal (java.security.Principal)6 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)6 ConfiguredObjectFactoryImpl (org.apache.qpid.server.model.ConfiguredObjectFactoryImpl)6 TaskExecutorImpl (org.apache.qpid.server.configuration.updater.TaskExecutorImpl)5 InetSocketAddress (java.net.InetSocketAddress)4 BrokerModel (org.apache.qpid.server.model.BrokerModel)4 Model (org.apache.qpid.server.model.Model)4 VirtualHostNode (org.apache.qpid.server.model.VirtualHostNode)4 AuthenticatedPrincipal (org.apache.qpid.server.security.auth.AuthenticatedPrincipal)4 IOException (java.io.IOException)3 Map (java.util.Map)3 Subject (javax.security.auth.Subject)3 UnitTestMessageLogger (org.apache.qpid.server.logging.UnitTestMessageLogger)3 AmqpPort (org.apache.qpid.server.model.port.AmqpPort)3