@Transactional @Test void testIdentifierInitializedOnDemand() { Optional<String> id1 = jpaTokenStore.retrieveStorageIdentifier(); assertTrue(id1.isPresent()); Optional<String> id2 = jpaTokenStore.retrieveStorageIdentifier(); assertTrue(id2.isPresent()); assertEquals(id1.get(), id2.get()); }
@Override public Optional<String> retrieveStorageIdentifier() { try { return Optional.of(getConfig()).map(i -> i.get("id")); } catch (Exception e) { throw new UnableToRetrieveIdentifierException("Exception occurred while trying to establish storage identifier", e); } }
JpaTokenStore implements TokenStore { @Override public Optional<String> retrieveStorageIdentifier() { try { return Optional.of(getConfig()).map(i -> i.get("id")); } catch (Exception e) { throw new UnableToRetrieveIdentifierException("Exception occurred while trying to establish storage identifier", e); } } }
JpaTokenStore implements TokenStore { @Override public Optional<String> retrieveStorageIdentifier() { try { return Optional.of(getConfig()).map(i -> i.get("id")); } catch (Exception e) { throw new UnableToRetrieveIdentifierException("Exception occurred while trying to establish storage identifier", e); } } protected  JpaTokenStore(Builder builder); }
JpaTokenStore implements TokenStore { @Override public Optional<String> retrieveStorageIdentifier() { try { return Optional.of(getConfig()).map(i -> i.get("id")); } catch (Exception e) { throw new UnableToRetrieveIdentifierException("Exception occurred while trying to establish storage identifier", e); } } protected  JpaTokenStore(Builder builder); static Builder builder(); @Override void initializeTokenSegments(String processorName, int segmentCount); @Override void initializeTokenSegments(String processorName, int segmentCount, TrackingToken initialToken); @Override void storeToken(TrackingToken token, String processorName, int segment); @Override void releaseClaim(String processorName, int segment); @Override void initializeSegment(TrackingToken token, String processorName, int segment); @Override boolean requiresExplicitSegmentInitialization(); @Override void deleteToken(String processorName, int segment); @Override TrackingToken fetchToken(String processorName, int segment); @Override void extendClaim(String processorName, int segment); @Override int[] fetchSegments(String processorName); @Override Optional<String> retrieveStorageIdentifier(); Serializer serializer(); }
JpaTokenStore implements TokenStore { @Override public Optional<String> retrieveStorageIdentifier() { try { return Optional.of(getConfig()).map(i -> i.get("id")); } catch (Exception e) { throw new UnableToRetrieveIdentifierException("Exception occurred while trying to establish storage identifier", e); } } protected  JpaTokenStore(Builder builder); static Builder builder(); @Override void initializeTokenSegments(String processorName, int segmentCount); @Override void initializeTokenSegments(String processorName, int segmentCount, TrackingToken initialToken); @Override void storeToken(TrackingToken token, String processorName, int segment); @Override void releaseClaim(String processorName, int segment); @Override void initializeSegment(TrackingToken token, String processorName, int segment); @Override boolean requiresExplicitSegmentInitialization(); @Override void deleteToken(String processorName, int segment); @Override TrackingToken fetchToken(String processorName, int segment); @Override void extendClaim(String processorName, int segment); @Override int[] fetchSegments(String processorName); @Override Optional<String> retrieveStorageIdentifier(); Serializer serializer();  }