Skip to content

Commit

Permalink
refactor: Removed memcached exception class
Browse files Browse the repository at this point in the history
  • Loading branch information
jruaux committed May 21, 2024
1 parent cc0b7b4 commit cbfc94b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import org.springframework.batch.item.Chunk;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemStreamException;
import org.springframework.batch.item.ItemStreamWriter;

import net.spy.memcached.MemcachedClient;
Expand All @@ -31,14 +30,14 @@ public MemcachedItemWriter(Supplier<MemcachedClient> clientSupplier) {
}

@Override
public synchronized void open(ExecutionContext executionContext) throws ItemStreamException {
public synchronized void open(ExecutionContext executionContext) {
if (client == null) {
client = clientSupplier.get();
}
}

@Override
public synchronized void close() throws ItemStreamException {
public synchronized void close() {
if (client != null) {
client.shutdown();
client = null;
Expand All @@ -52,7 +51,7 @@ public void write(Chunk<? extends MemcachedEntry> chunk) throws Exception {
for (int index = 0; index < results.size(); index++) {
Boolean result = results.get(index);
if (!Boolean.TRUE.equals(result)) {
throw new MemcachedException("Could not write key " + chunk.getItems().get(index).getKey());
throw new Exception("Could not write key " + chunk.getItems().get(index).getKey());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.apache.commons.logging.LogFactory;

import com.redis.spring.batch.item.AbstractQueuePollableItemReader;
import com.redis.spring.batch.memcached.MemcachedException;
import com.redis.spring.batch.memcached.reader.LruCrawlerMetadumpOperation.Callback;

import net.spy.memcached.MemcachedClient;
Expand Down Expand Up @@ -40,7 +39,7 @@ private void safePut(LruMetadumpEntry entry) {
queue.put(entry);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new MemcachedException("Interrupted while trying to add entry to queue", e);
throw new RuntimeException("Interrupted while trying to add entry to queue", e);
}
}

Expand Down

0 comments on commit cbfc94b

Please sign in to comment.