@Override public void run () { entry.getValue ().disconnected (); } } );
public void removeFolderListener ( final FolderListener listener, final Location location ) { synchronized ( this.folderListeners ) { final FolderSyncController controller = this.folderListeners.get ( location ); if ( controller == null ) { return; } controller.removeListener ( listener ); } }
private synchronized void sync ( final boolean force ) { final boolean needSubscription = !this.listener.isEmpty (); if ( needSubscription != this.subscribed || force ) { if ( needSubscription ) { subscribe (); } else { unsubscribe (); } } }
public void addListener ( final FolderListener listener ) { synchronized ( this ) { if ( this.listener.add ( listener ) ) { sync (); } } transmitCache ( listener ); }
public void addFolderListener ( final FolderListener listener, final Location location ) { synchronized ( this.folderListeners ) { if ( !this.folderListeners.containsKey ( location ) ) { this.folderListeners.put ( location, new FolderSyncController ( this.connection, new Location ( location ) ) ); } final FolderSyncController controller = this.folderListeners.get ( location ); controller.addListener ( listener ); } }
public synchronized void resync () { sync ( true ); }
private synchronized void unsubscribe () { logger.debug ( "unsubscribing from folder: {}", this.location ); this.subscribed = false; try { this.connection.unsubscribeFolder ( this.location ); } catch ( final Exception e ) { handleError ( e ); } }
private void resyncAllFolders () { synchronized ( this.folderListeners ) { for ( final Map.Entry<Location, FolderSyncController> entry : this.folderListeners.entrySet () ) { entry.getValue ().resync (); } } }
public void addFolderListener ( final FolderListener listener, final Location location ) { synchronized ( this.folderListeners ) { if ( !this.folderListeners.containsKey ( location ) ) { this.folderListeners.put ( location, new FolderSyncController ( this.connection, new Location ( location ) ) ); } final FolderSyncController controller = this.folderListeners.get ( location ); controller.addListener ( listener ); } }
public void addListener ( final FolderListener listener ) { synchronized ( this ) { if ( this.listener.add ( listener ) ) { sync (); } } transmitCache ( listener ); }
public synchronized void resync () { sync ( true ); }
private synchronized void subscribe () { logger.debug ( "subscribing to folder: {}", this.location ); this.subscribed = true; try { this.connection.subscribeFolder ( this.location ); } catch ( final Exception e ) { handleError ( e ); } }
private void resyncAllFolders () { synchronized ( this.folderListeners ) { for ( final Map.Entry<Location, FolderSyncController> entry : this.folderListeners.entrySet () ) { entry.getValue ().resync (); } } }
private synchronized void sync ( final boolean force ) { final boolean needSubscription = !this.listener.isEmpty (); if ( needSubscription != this.subscribed || force ) { if ( needSubscription ) { subscribe (); } else { unsubscribe (); } } }
public synchronized void sync () { sync ( false ); }
private synchronized void unsubscribe () { logger.debug ( "unsubscribing from folder: {}", this.location ); this.subscribed = false; try { this.connection.unsubscribeFolder ( this.location ); } catch ( final Exception e ) { handleError ( e ); } }
@Override public void run () { entry.getValue ().disconnected (); } } );
public void removeFolderListener ( final FolderListener listener, final Location location ) { synchronized ( this.folderListeners ) { final FolderSyncController controller = this.folderListeners.get ( location ); if ( controller == null ) { return; } controller.removeListener ( listener ); } }
public synchronized void sync () { sync ( false ); }
private synchronized void subscribe () { logger.debug ( "subscribing to folder: {}", this.location ); this.subscribed = true; try { this.connection.subscribeFolder ( this.location ); } catch ( final Exception e ) { handleError ( e ); } }