/** {@inheritDoc} */ @Override public boolean create(@Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key, @Nonnull final Object value, @Nonnull final StorageSerializer serializer, @Nullable @Positive final Long expiration) throws IOException { return create(context, key, serializer.serialize(value), expiration); }
/** {@inheritDoc} */ @Override public boolean delete(@Nonnull final Object value) throws IOException { return delete(AnnotationSupport.getContext(value), AnnotationSupport.getKey(value)); }
/** {@inheritDoc} */ @Override protected void doDestroy() { if (entityManagerFactory.isOpen()) { entityManagerFactory.close(); } super.doDestroy(); }
/** {@inheritDoc} */ @Override public boolean update(@Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key, @Nonnull final Object value, @Nonnull final StorageSerializer serializer, @Nullable @Positive final Long expiration) throws IOException { return update(context, key, serializer.serialize(value), expiration); }
/** {@inheritDoc} */ // Checkstyle: ParameterNumber OFF @Override @Nullable public Long updateWithVersion(@Positive final long version, @Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key, @Nonnull final Object value, @Nonnull final StorageSerializer serializer, @Nullable @Positive final Long expiration) throws IOException, VersionMismatchException { return updateWithVersion(version, context, key, serializer.serialize(value), expiration); }
/** {@inheritDoc} */ @Override protected void doInitialize() throws ComponentInitializationException { super.doInitialize(); if (cleanupInterval > 0) { cleanupTask = getCleanupTask(); if (cleanupTask == null) { throw new ComponentInitializationException("Cleanup task cannot be null if cleanupInterval is set."); } else if (cleanupTaskTimer == null) { internalTaskTimer = new Timer(true); } else { internalTaskTimer = cleanupTaskTimer; } internalTaskTimer.schedule(cleanupTask, cleanupInterval, cleanupInterval); } }
/** {@inheritDoc} */ @Override protected void doInitialize() throws ComponentInitializationException { super.doInitialize(); connectionFactory.getConnectionPool().initialize(); }
/** {@inheritDoc} */ @Override public boolean deleteWithVersion(@Positive final long version, @Nonnull final Object value) throws IOException, VersionMismatchException { return deleteWithVersion(version, AnnotationSupport.getContext(value), AnnotationSupport.getKey(value)); }
/** {@inheritDoc} */ @Override public boolean updateExpiration(@Nonnull final Object value) throws IOException { return updateExpiration(AnnotationSupport.getContext(value), AnnotationSupport.getKey(value), AnnotationSupport.getExpiration(value)); }
/** {@inheritDoc} */ @Override @Nullable public Object read(@Nonnull final Object value) throws IOException { final StorageRecord record = read(AnnotationSupport.getContext(value), AnnotationSupport.getKey(value)); if (record != null) { AnnotationSupport.setValue(value, record.getValue()); AnnotationSupport.setExpiration(value, record.getExpiration()); return value; } return null; }
/** {@inheritDoc} */ @Override public boolean update(@Nonnull final Object value) throws IOException { return update(AnnotationSupport.getContext(value), AnnotationSupport.getKey(value), AnnotationSupport.getValue(value), AnnotationSupport.getExpiration(value)); }
/** {@inheritDoc} */ @Override @Nullable public Long updateWithVersion(@Positive final long version, @Nonnull final Object value) throws IOException, VersionMismatchException { return updateWithVersion(version, AnnotationSupport.getContext(value), AnnotationSupport.getKey(value), AnnotationSupport.getValue(value), AnnotationSupport.getExpiration(value)); }
/** {@inheritDoc} */ @Override public boolean create(@Nonnull final Object value) throws IOException { return create(AnnotationSupport.getContext(value), AnnotationSupport.getKey(value), AnnotationSupport.getValue(value), AnnotationSupport.getExpiration(value)); }
/** {@inheritDoc} */ @Override protected void doDestroy() { super.doDestroy(); if (isInitialized()) { connectionFactory.getConnectionPool().close(); connectionFactory = null; } }