/** * @return */ public EventOrdering subsequence() { int nextSubsequence = m_nextSubsequence.getAndIncrement(); return new EventOrdering(this, nextSubsequence); }
@Override public void addEvent(Event event) { m_events.addEvent(event); m_events.initialize(m_partition, new EventOrdering()); }
@Override public void reload() throws DataAccessException { InputStream is = null; InputStreamReader isr = null; try { is = m_resource.getInputStream(); isr = new InputStreamReader(is); final Reader reader = isr; m_events = JaxbUtils.unmarshal(Events.class, reader); m_events.loadEventFiles(m_resource); m_events.initialize(new EnterpriseIdPartition(), new EventOrdering()); } catch (final IOException e) { throw new DataRetrievalFailureException("Failed to read from " + m_resource.toString(), e); } finally { IOUtils.closeQuietly(isr); IOUtils.closeQuietly(is); } }
@Override public void reload() throws DataAccessException { InputStream is = null; InputStreamReader isr = null; try { is = m_resource.getInputStream(); isr = new InputStreamReader(is); final Reader reader = isr; m_events = JaxbUtils.unmarshal(Events.class, reader); m_events.loadEventFiles(m_resource); m_events.initialize(new EnterpriseIdPartition(), new EventOrdering()); } catch (final IOException e) { throw new DataRetrievalFailureException("Failed to read from " + m_resource.toString(), e); } finally { IOUtils.closeQuietly(isr); IOUtils.closeQuietly(is); } }
@Override public boolean removeEventFromProgrammaticStore(Event event) { Events programmaticEvents = m_events.getLoadEventsByFile(m_programmaticStoreRelativePath); if (programmaticEvents == null) return false; programmaticEvents.removeEvent(event); if (programmaticEvents.getEvents().size() <= 0) { m_events.removeLoadedEventFile(m_programmaticStoreRelativePath); } m_events.initialize(m_partition, new EventOrdering()); return true; }
events.initialize(m_partition, new EventOrdering());
@Override public void addEventToProgrammaticStore(Event event) { Events programmaticEvents = m_events.getLoadEventsByFile(m_programmaticStoreRelativePath); if (programmaticEvents == null) { programmaticEvents = new Events(); m_events.addLoadedEventFile(m_programmaticStoreRelativePath, programmaticEvents); } programmaticEvents.addEvent(event); m_events.initialize(m_partition, new EventOrdering()); }
private synchronized void loadConfig() throws DataAccessException { try { Events events = JaxbUtils.unmarshal(Events.class, m_configResource); m_lastModifiedEventFiles = events.loadEventFiles(m_configResource); m_partition = new EnterpriseIdPartition(); events.initialize(m_partition, new EventOrdering()); m_events = events; } catch (Exception e) { throw new DataRetrievalFailureException("Unabled to load " + m_configResource, e); } }