rename TorrentFileChangeAware methods

This commit is contained in:
anthonyraymond 2017-10-31 21:10:16 +01:00
parent 2696425bfe
commit bffcb85af3
4 changed files with 8 additions and 8 deletions

View file

@ -7,8 +7,8 @@ import org.araymond.joal.core.ttorent.client.MockedTorrent;
*/
public interface TorrentFileChangeAware {
void onTorrentAdded(final MockedTorrent torrent);
void onTorrentFileAdded(final MockedTorrent torrent);
void onTorrentRemoved(final MockedTorrent torrent);
void onTorrentFileRemoved(final MockedTorrent torrent);
}

View file

@ -100,7 +100,7 @@ public class TorrentFileProvider extends FileAlterationListenerAdaptor implement
logger.info("Torrent file deleting detected, hot deleted file: {}", file.getAbsolutePath());
this.torrentFiles.remove(file);
this.torrentFileChangeListener.forEach(listener -> listener.onTorrentRemoved(torrent));
this.torrentFileChangeListener.forEach(listener -> listener.onTorrentFileRemoved(torrent));
this.publisher.publishEvent(new TorrentFileDeletedEvent(torrent));
}
@ -111,7 +111,7 @@ public class TorrentFileProvider extends FileAlterationListenerAdaptor implement
final MockedTorrent torrent = MockedTorrent.fromFile(file);
this.torrentFiles.put(file, torrent);
if (this.isInitOver) {
this.torrentFileChangeListener.forEach(listener -> listener.onTorrentAdded(torrent));
this.torrentFileChangeListener.forEach(listener -> listener.onTorrentFileAdded(torrent));
}
this.publisher.publishEvent(new TorrentFileAddedEvent(torrent));
} catch (final IOException | NoSuchAlgorithmException e) {

View file

@ -106,7 +106,7 @@ public class Client implements AnnouncerEventListener, TorrentFileChangeAware {
}
@Override
public void onTorrentAdded(final MockedTorrent torrent) {
public void onTorrentFileAdded(final MockedTorrent torrent) {
if (this.currentState != ClientState.STARTED) {
return;
}
@ -117,7 +117,7 @@ public class Client implements AnnouncerEventListener, TorrentFileChangeAware {
}
@Override
public void onTorrentRemoved(final MockedTorrent torrent) {
public void onTorrentFileRemoved(final MockedTorrent torrent) {
// Work on a copy of the list for concurrency purpose (otherwise manually removing a torrent cause the app to crash)
for (final Announcer announcer : Lists.newArrayList(this.announcers)) {
if (announcer.isForTorrent(torrent)) {

View file

@ -289,12 +289,12 @@ public class TorrentFileProviderTest {
}
@Override
public void onTorrentAdded(final MockedTorrent torrent) {
public void onTorrentFileAdded(final MockedTorrent torrent) {
createLock.countDown();
}
@Override
public void onTorrentRemoved(final MockedTorrent torrent) {
public void onTorrentFileRemoved(final MockedTorrent torrent) {
deleteLock.countDown();
}
}