private static AsyncEventQueue createAsyncEventQueue( AsyncEventQueueDescription aeqd, Cache cache) { // configure the factory AsyncEventQueueFactory f = cache.createAsyncEventQueueFactory(); log.info("Configuring async event queue factory"); aeqd.configure(f); log.info("Configured async event queue factory " + f); // create the async event queue log.info("Creating and starting async event queue " + aeqd.getName()); AsyncEventQueue queue = f.create(aeqd.getName(), aeqd.getAsyncEventListenerInstance()); log.info("Created and started async event queue: " + asyncEventQueueToString(queue)); return queue; }
/** * Creates and starts an async event queue in the current cache. The queue is configured using the * {@link AsyncEventQueueDescription} corresponding to the given configuration from {@link * AsyncEventQueuePrms#names}. The id for the queue is the same as the queue configuration name. * * <p>This method is thread-safe. The async event queues for a given logical queue configuration * will only be created once. * * @throws HydraRuntimeException if an attempt is made to reconfigure an existing async event * queue. */ public static synchronized AsyncEventQueue createAndStartAsyncEventQueue( String asyncEventQueueConfig) { AsyncEventQueue queue = getAsyncEventQueue(asyncEventQueueConfig); if (queue == null) { // get the cache Cache cache = CacheHelper.getCache(); if (cache == null) { String s = "Cache has not been created yet"; throw new HydraRuntimeException(s); } // look up the async event queue configuration AsyncEventQueueDescription aeqd = getAsyncEventQueueDescription(asyncEventQueueConfig); // create the disk store DiskStoreHelper.createDiskStore(aeqd.getDiskStoreDescription().getName()); // create the async event queue queue = createAsyncEventQueue(aeqd, cache); } return queue; }
/** Returns the given async event queue as a string. */ public static String asyncEventQueueToString(AsyncEventQueue aeq) { return AsyncEventQueueDescription.asyncEventQueueToString(aeq); }