@Test public void allInitialDelaysShouldBeValid() throws Exception { repository.determineInitialDelay("00:00"); repository.determineInitialDelay("01:00"); repository.determineInitialDelay("02:00"); repository.determineInitialDelay("03:00"); repository.determineInitialDelay("04:00"); repository.determineInitialDelay("05:00"); repository.determineInitialDelay("06:00"); repository.determineInitialDelay("07:00"); repository.determineInitialDelay("08:00"); repository.determineInitialDelay("09:00"); repository.determineInitialDelay("10:00"); repository.determineInitialDelay("11:00"); repository.determineInitialDelay("12:00"); repository.determineInitialDelay("13:00"); repository.determineInitialDelay("14:00"); repository.determineInitialDelay("15:00"); repository.determineInitialDelay("16:00"); repository.determineInitialDelay("17:00"); repository.determineInitialDelay("18:00"); repository.determineInitialDelay("19:00"); repository.determineInitialDelay("20:00"); repository.determineInitialDelay("21:00"); repository.determineInitialDelay("22:00"); repository.determineInitialDelay("23:00"); }
protected long determineInitialDelay( String initialTimeExpression ) { Matcher matcher = RepositoryConfiguration.INITIAL_TIME_PATTERN.matcher(initialTimeExpression); if (matcher.matches()) { int hours = Integer.valueOf(matcher.group(1)); int mins = Integer.valueOf(matcher.group(2)); LocalDateTime dateTime = LocalDateTime.of(LocalDate.now(ZoneOffset.UTC), LocalTime.of(hours, mins)); long delay = dateTime.toInstant(ZoneOffset.UTC).toEpochMilli() - System.currentTimeMillis(); if (delay <= 0L) { delay = dateTime.plusDays(1).toInstant(ZoneOffset.UTC).toEpochMilli() - System.currentTimeMillis(); } if (delay < 10000L) delay += 10000L; assert delay >= 0; return delay; } String msg = JcrI18n.invalidGarbageCollectionInitialTime.text(repositoryName(), initialTimeExpression); throw new IllegalArgumentException(msg); }
JcrRepository implements org.modeshape.jcr.api.Repository { protected long determineInitialDelay( String initialTimeExpression ) { Matcher matcher = RepositoryConfiguration.INITIAL_TIME_PATTERN.matcher(initialTimeExpression); if (matcher.matches()) { int hours = Integer.valueOf(matcher.group(1)); int mins = Integer.valueOf(matcher.group(2)); LocalDateTime dateTime = LocalDateTime.of(LocalDate.now(ZoneOffset.UTC), LocalTime.of(hours, mins)); long delay = dateTime.toInstant(ZoneOffset.UTC).toEpochMilli() - System.currentTimeMillis(); if (delay <= 0L) { delay = dateTime.plusDays(1).toInstant(ZoneOffset.UTC).toEpochMilli() - System.currentTimeMillis(); } if (delay < 10000L) delay += 10000L; assert delay >= 0; return delay; } String msg = JcrI18n.invalidGarbageCollectionInitialTime.text(repositoryName(), initialTimeExpression); throw new IllegalArgumentException(msg); } }
JcrRepository implements org.modeshape.jcr.api.Repository { protected long determineInitialDelay( String initialTimeExpression ) { Matcher matcher = RepositoryConfiguration.INITIAL_TIME_PATTERN.matcher(initialTimeExpression); if (matcher.matches()) { int hours = Integer.valueOf(matcher.group(1)); int mins = Integer.valueOf(matcher.group(2)); LocalDateTime dateTime = LocalDateTime.of(LocalDate.now(ZoneOffset.UTC), LocalTime.of(hours, mins)); long delay = dateTime.toInstant(ZoneOffset.UTC).toEpochMilli() - System.currentTimeMillis(); if (delay <= 0L) { delay = dateTime.plusDays(1).toInstant(ZoneOffset.UTC).toEpochMilli() - System.currentTimeMillis(); } if (delay < 10000L) delay += 10000L; assert delay >= 0; return delay; } String msg = JcrI18n.invalidGarbageCollectionInitialTime.text(repositoryName(), initialTimeExpression); throw new IllegalArgumentException(msg); } protected  JcrRepository( RepositoryConfiguration configuration ); }
JcrRepository implements org.modeshape.jcr.api.Repository { protected long determineInitialDelay( String initialTimeExpression ) { Matcher matcher = RepositoryConfiguration.INITIAL_TIME_PATTERN.matcher(initialTimeExpression); if (matcher.matches()) { int hours = Integer.valueOf(matcher.group(1)); int mins = Integer.valueOf(matcher.group(2)); LocalDateTime dateTime = LocalDateTime.of(LocalDate.now(ZoneOffset.UTC), LocalTime.of(hours, mins)); long delay = dateTime.toInstant(ZoneOffset.UTC).toEpochMilli() - System.currentTimeMillis(); if (delay <= 0L) { delay = dateTime.plusDays(1).toInstant(ZoneOffset.UTC).toEpochMilli() - System.currentTimeMillis(); } if (delay < 10000L) delay += 10000L; assert delay >= 0; return delay; } String msg = JcrI18n.invalidGarbageCollectionInitialTime.text(repositoryName(), initialTimeExpression); throw new IllegalArgumentException(msg); } protected  JcrRepository( RepositoryConfiguration configuration ); State getState(); @Override String getName(); @Override int getActiveSessionsCount(); RepositoryStatistics getRepositoryStatistics(); Problems getStartupProblems(); Transactions transactions(); RepositoryConfiguration getConfiguration(); @Override String getDescriptor( String key ); @Override JcrValue getDescriptorValue( String key ); @Override JcrValue[] getDescriptorValues( String key ); @Override boolean isSingleValueDescriptor( String key ); @Override boolean isStandardDescriptor( String key ); @Override String[] getDescriptorKeys(); @Override synchronized JcrSession login(); @Override synchronized JcrSession login( Credentials credentials ); @Override synchronized JcrSession login( String workspaceName ); @Override synchronized JcrSession login( final Credentials credentials,
                                          String workspaceName ); }
JcrRepository implements org.modeshape.jcr.api.Repository { protected long determineInitialDelay( String initialTimeExpression ) { Matcher matcher = RepositoryConfiguration.INITIAL_TIME_PATTERN.matcher(initialTimeExpression); if (matcher.matches()) { int hours = Integer.valueOf(matcher.group(1)); int mins = Integer.valueOf(matcher.group(2)); LocalDateTime dateTime = LocalDateTime.of(LocalDate.now(ZoneOffset.UTC), LocalTime.of(hours, mins)); long delay = dateTime.toInstant(ZoneOffset.UTC).toEpochMilli() - System.currentTimeMillis(); if (delay <= 0L) { delay = dateTime.plusDays(1).toInstant(ZoneOffset.UTC).toEpochMilli() - System.currentTimeMillis(); } if (delay < 10000L) delay += 10000L; assert delay >= 0; return delay; } String msg = JcrI18n.invalidGarbageCollectionInitialTime.text(repositoryName(), initialTimeExpression); throw new IllegalArgumentException(msg); } protected  JcrRepository( RepositoryConfiguration configuration ); State getState(); @Override String getName(); @Override int getActiveSessionsCount(); RepositoryStatistics getRepositoryStatistics(); Problems getStartupProblems(); Transactions transactions(); RepositoryConfiguration getConfiguration(); @Override String getDescriptor( String key ); @Override JcrValue getDescriptorValue( String key ); @Override JcrValue[] getDescriptorValues( String key ); @Override boolean isSingleValueDescriptor( String key ); @Override boolean isStandardDescriptor( String key ); @Override String[] getDescriptorKeys(); @Override synchronized JcrSession login(); @Override synchronized JcrSession login( Credentials credentials ); @Override synchronized JcrSession login( String workspaceName ); @Override synchronized JcrSession login( final Credentials credentials,
                                          String workspaceName );  }