@Override public ClusterManager cloneFromTemplate() { BackupManager result = new BackupManager(); clone(result); result.mapSendOptions = mapSendOptions; result.rpcTimeout = rpcTimeout; result.terminateOnStartFailure = terminateOnStartFailure; return result; }
import android.app.backup.BackupManager; ... public void requestBackup() { BackupManager bm = new BackupManager(this); bm.dataChanged(); }
if (getCluster() == null) { Cluster cluster = getContext().getCluster(); if (cluster instanceof CatalinaCluster) { setCluster((CatalinaCluster)cluster); } else { throw new LifecycleException( sm.getString("backupManager.noCluster", getName())); this, cluster.getChannel(), rpcTimeout, getMapName(), getClassLoaders(), terminateOnStartFailure); map.setChannelSendOptions(mapSendOptions); this.sessions = map; } catch ( Exception x ) { log.error(sm.getString("backupManager.startUnable", getName()),x); throw new LifecycleException(sm.getString("backupManager.startFailed", getName()),x); setState(LifecycleState.STARTING);
if (getCluster() == null) { Cluster cluster = getContainer().getCluster(); if (cluster instanceof CatalinaCluster) { setCluster((CatalinaCluster)cluster); } else { throw new LifecycleException( sm.getString("backupManager.noCluster", getName())); cluster.getChannel(), rpcTimeout, getMapName(), getClassLoaders()); map.setChannelSendOptions(mapSendOptions); this.sessions = map; } catch ( Exception x ) { log.error(sm.getString("backupManager.startUnable", getName()),x); throw new LifecycleException(sm.getString("backupManager.startFailed", getName()),x); setState(LifecycleState.STARTING);
/** * Start this component and implement the requirements * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}. * * Starts the cluster communication channel, this will connect with the * other nodes in the cluster, and request the current session state to be * transferred to this node. * * @exception LifecycleException if this component detects a fatal error * that prevents this component from being used */ @Override protected synchronized void startInternal() throws LifecycleException { super.startInternal(); try { if (cluster == null) throw new LifecycleException(sm.getString("backupManager.noCluster", getName())); LazyReplicatedMap<String,Session> map = new LazyReplicatedMap<>( this, cluster.getChannel(), rpcTimeout, getMapName(), getClassLoaders(), terminateOnStartFailure); map.setChannelSendOptions(mapSendOptions); map.setAccessTimeout(accessTimeout); this.sessions = map; } catch ( Exception x ) { log.error(sm.getString("backupManager.startUnable", getName()),x); throw new LifecycleException(sm.getString("backupManager.startFailed", getName()),x); } setState(LifecycleState.STARTING); }
/** * Stop this component and implement the requirements * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}. * * This will disconnect the cluster communication channel and stop the * listener thread. * * @exception LifecycleException if this component detects a fatal error * that prevents this component from being used */ @Override protected synchronized void stopInternal() throws LifecycleException { if (log.isDebugEnabled()) log.debug(sm.getString("backupManager.stopped", getName())); setState(LifecycleState.STOPPING); if (sessions instanceof LazyReplicatedMap) { LazyReplicatedMap<String,Session> map = (LazyReplicatedMap<String,Session>)sessions; map.breakdown(); } super.stopInternal(); }
/** * Observes the wallpaper for changes and notifies all IWallpaperServiceCallbacks * that the wallpaper has changed. The CREATE is triggered when there is no * wallpaper set and is created for the first time. The CLOSE_WRITE is triggered * everytime the wallpaper is changed. */ private final FileObserver mWallpaperObserver = new FileObserver( WALLPAPER_DIR.getAbsolutePath(), CREATE | CLOSE_WRITE | DELETE | DELETE_SELF) { @Override public void onEvent(int event, String path) { if (path == null) { return; } synchronized (mLock) { // changing the wallpaper means we'll need to back up the new one long origId = Binder.clearCallingIdentity(); BackupManager bm = new BackupManager(mContext); bm.dataChanged(); Binder.restoreCallingIdentity(origId); File changedFile = new File(WALLPAPER_DIR, path); if (WALLPAPER_FILE.equals(changedFile)) { notifyCallbacksLocked(); } } } };
public String getMapName() { String name = cluster.getManagerName(getName(),this)+"-"+"map"; if ( log.isDebugEnabled() ) log.debug("Backup manager, Setting map name to:"+name); return name; }
@Override public ClusterMessage requestCompleted(String sessionId) { if (!getState().isAvailable()) return null; LazyReplicatedMap<String,Session> map = (LazyReplicatedMap<String,Session>)sessions; map.replicate(sessionId,false); return null; }
public ClassLoader[] getClassLoaders() { if ( manager instanceof BackupManager ) return ((BackupManager)manager).getClassLoaders(); else if ( manager instanceof ClusterManagerBase ) return ((ClusterManagerBase)manager).getClassLoaders(); else if ( manager instanceof StandardManager ) { StandardManager sm = (StandardManager)manager; return ClusterManagerBase.getClassLoaders(sm.getContainer()); } else if ( manager instanceof ManagerBase ) { ManagerBase mb = (ManagerBase)manager; return ClusterManagerBase.getClassLoaders(mb.getContainer()); }//end if return null; }
/** * Stop this component and implement the requirements * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}. * * This will disconnect the cluster communication channel and stop the * listener thread. * * @exception LifecycleException if this component detects a fatal error * that prevents this component from being used */ @Override protected synchronized void stopInternal() throws LifecycleException { if (log.isDebugEnabled()) log.debug(sm.getString("backupManager.stopped", getName())); setState(LifecycleState.STOPPING); if (sessions instanceof LazyReplicatedMap) { LazyReplicatedMap<String,Session> map = (LazyReplicatedMap<String,Session>)sessions; map.breakdown(); } cluster.removeManager(this); super.stopInternal(); }
if (android.os.Build.VERSION.SDK_INT >= 8) { BackupManager bm = new BackupManager(this); bm.dataChanged(); }
public String getMapName() { String name = cluster.getManagerName(getName(),this)+"-"+"map"; if ( log.isDebugEnabled() ) log.debug("Backup manager, Setting map name to:"+name); return name; }
@Override public ClusterMessage requestCompleted(String sessionId) { if (!getState().isAvailable()) return null; LazyReplicatedMap<String,Session> map = (LazyReplicatedMap<String,Session>)sessions; map.replicate(sessionId,false); return null; }
public ClassLoader[] getClassLoaders() { if ( manager instanceof BackupManager ) return ((BackupManager)manager).getClassLoaders(); else if ( manager instanceof ClusterManagerBase ) return ((ClusterManagerBase)manager).getClassLoaders(); else if ( manager instanceof StandardManager ) { StandardManager sm = (StandardManager)manager; return ClusterManagerBase.getClassLoaders(sm.getContext()); } else if ( manager instanceof ManagerBase ) { ManagerBase mb = (ManagerBase)manager; return ClusterManagerBase.getClassLoaders(mb.getContext()); }//end if return null; }
@Override public ClusterManager cloneFromTemplate() { BackupManager result = new BackupManager(); clone(result); result.mapSendOptions = mapSendOptions; result.rpcTimeout = rpcTimeout; result.terminateOnStartFailure = terminateOnStartFailure; result.accessTimeout = accessTimeout; return result; }
/** * Stop this component and implement the requirements * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}. * * This will disconnect the cluster communication channel and stop the * listener thread. * * @exception LifecycleException if this component detects a fatal error * that prevents this component from being used */ @Override protected synchronized void stopInternal() throws LifecycleException { if (log.isDebugEnabled()) log.debug(sm.getString("backupManager.stopped", getName())); setState(LifecycleState.STOPPING); if (sessions instanceof LazyReplicatedMap) { LazyReplicatedMap map = (LazyReplicatedMap)sessions; map.breakdown(); } cluster.removeManager(this); super.stopInternal(); }
public String getMapName() { String name = cluster.getManagerName(getName(),this)+"-"+"map"; if ( log.isDebugEnabled() ) log.debug("Backup manager, Setting map name to:"+name); return name; }
@Override public ClusterMessage requestCompleted(String sessionId) { if (!getState().isAvailable()) return null; LazyReplicatedMap map = (LazyReplicatedMap)sessions; map.replicate(sessionId,false); return null; }
@Override public ClusterManager cloneFromTemplate() { BackupManager result = new BackupManager(); clone(result); result.mExpireSessionsOnShutdown = mExpireSessionsOnShutdown; result.mapSendOptions = mapSendOptions; result.rpcTimeout = rpcTimeout; return result; }