protected void doStart() throws ResourceManagerSystemException { if (persistenceStrategy != null) { try { persistenceStrategy.open(); } catch (IOException e) { throw new ResourceManagerSystemException(e); } } }
protected boolean shutdown(int mode, long timeoutMSecs) { try { if (persistenceStrategy != null) { persistenceStrategy.close(); } } catch (IOException e) { logger.error("Error closing persistent store", e); } return super.shutdown(mode, timeoutMSecs); }
protected void recover() throws ResourceManagerSystemException { if (persistenceStrategy != null) { try { List msgs = persistenceStrategy.restore(); for (Iterator it = msgs.iterator(); it.hasNext(); ) { Holder h = (Holder) it.next(); getQueue(h.getQueue()).putNow(h.getId()); } } catch (Exception e) { throw new ResourceManagerSystemException(e); } } }
protected Object doLoad(QueueInfo queue, Object id) throws IOException { QueuePersistenceStrategy ps = (queue.config.persistent) ? persistenceStrategy : memoryPersistenceStrategy; Object obj = ps.load(queue.name, id); return obj; }
protected void doRemove(QueueInfo queue, Object id) throws IOException { QueuePersistenceStrategy ps = (queue.config.persistent) ? persistenceStrategy : memoryPersistenceStrategy; ps.remove(queue.name, id); }
protected Object doStore(QueueInfo queue, Object object) throws IOException { QueuePersistenceStrategy ps = (queue.config.persistent) ? persistenceStrategy : memoryPersistenceStrategy; Object id = ps.store(queue.name, object); return id; }